diff --git a/custom_components/localtuya/core/tuya_devices/climates.py b/custom_components/localtuya/core/tuya_devices/climates.py index 4af3dec0e..3fdde75d4 100644 --- a/custom_components/localtuya/core/tuya_devices/climates.py +++ b/custom_components/localtuya/core/tuya_devices/climates.py @@ -80,7 +80,7 @@ def localtuya_climate( values_precsion=0.1, target_precision=0.1, ), - ) + ), ), # Heater # https://developer.tuya.com/en/docs/iot/f?id=K9gf46epy4j82 @@ -98,7 +98,7 @@ def localtuya_climate( target_precision=0.1, preset_set="auto/smart", ), - ) + ), ), # Heater # https://developer.tuya.com/en/docs/iot/categoryrs?id=Kaiuz0nfferyx diff --git a/custom_components/localtuya/discovery.py b/custom_components/localtuya/discovery.py index 181be424b..a6fc01831 100644 --- a/custom_components/localtuya/discovery.py +++ b/custom_components/localtuya/discovery.py @@ -23,6 +23,7 @@ PREFIX_55AA_BIN = b"\x00\x00U\xaa" PREFIX_6699_BIN = b"\x00\x00\x66\x99" +UDP_COMMAND = b"\x00\x00\x00\x00" DEFAULT_TIMEOUT = 6.0 @@ -37,7 +38,10 @@ def _unpad(data): def decrypt_udp(message): """Decrypt encrypted UDP broadcasts.""" if message[:4] == PREFIX_55AA_BIN: - return decrypt(message[20:-8], UDP_KEY) + payload = message[20:-8] + if message[8:12] == UDP_COMMAND: + return payload + return decrypt(payload, UDP_KEY) if message[:4] == PREFIX_6699_BIN: unpacked = pytuya.unpack_message(message, hmac_key=UDP_KEY, no_retcode=None) payload = unpacked.payload.decode()