def encode(self, value: dict) -> dict:
        """Encode data from hass to device."""
        payload = {}
        for k, v in value.items():
            for conv in self.converters:
                if conv.full_name == k:
                    conv.encode(self, payload, v)
        return payload
Encode data from hass to device.
custom_components/xiaomi_miot/core/device.py