mak-gitdev / HA_enoceanmqtt

Home Assistant wrapper for enocean-mqtt (https://github.com/embyt/enocean-mqtt)
GNU General Public License v3.0
54 stars 14 forks source link

Error in device selection when sending data #73

Closed mak-gitdev closed 9 months ago

mak-gitdev commented 1 year ago

Discussed in https://github.com/mak-gitdev/HA_enoceanmqtt/discussions/70

Originally posted by vbreit June 27, 2023 Hello all, I have 3 modules Nodon SIN-2-RS-01 Two of them work 100% (old modules firmware 1.3 and 1.2) The 3rd and newest module does not work (firmware 1.5.1) in my configuration it is [shutter_wz_terrasse1]. What is the reason ? Can you help me please ? ``` ###shutters### [shutter_wz_terrasse] address = 0x050E7E6E rorg = 0xD2 func = 0x05 type = 0x00 [shutter_küche_terrasse] address = 0x0587A2F7 rorg = 0xD2 func = 0x05 type = 0x00 [shutter_wz_terrasse1] address = 0x059EEC27 rorg = 0xD2 func = 0x05 type = 0x00 ###lights### [light_haustür_outside] address = 0x059E2EEB rorg = 0xD2 func = 0x01 type = 0x12 [light_terrasse_outside] address = 0x0590ECEE rorg = 0xD2 func = 0x01 type = 0x0F [light_terasse1_outside] address = 0x05A084CF rorg = 0xD2 func = 0x01 type = 0x12 ``` ``` 2023-06-27 13:10:42,448 INFO: Authenticating: addons 2023-06-27 13:10:42,449 DEBUG: Connecting to host core-mosquitto, port 1883, keepalive 60 2023-06-27 13:10:42,461 DEBUG: Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'enocean_gateway' 2023-06-27 13:10:42,463 INFO: SerialCommunicator started 2023-06-27 13:10:42,464 INFO: Auto Teach-in is disabled 2023-06-27 13:10:42,467 WARNING: Replacing Packet.optional with default value. 2023-06-27 13:10:42,565 INFO: Sending packet 2023-06-27 13:10:42,566 DEBUG: 0x05 ['0x8'] [] OrderedDict() 2023-06-27 13:10:42,667 DEBUG: 0x02 ['0x0', '0xff', '0xc9', '0xc0', '0x80'] ['0xa'] OrderedDict() 2023-06-27 13:10:42,669 INFO: got response packet: OK 2023-06-27 13:10:42,964 DEBUG: Received CONNACK (0, 0) 2023-06-27 13:10:42,965 INFO: Succesfully connected to MQTT broker. 2023-06-27 13:10:42,966 DEBUG: Sending SUBSCRIBE (d0, m1) [(b'enoceanmqtt/shutter_wz_terrasse/req/#', 0)] 2023-06-27 13:10:42,967 DEBUG: Sending SUBSCRIBE (d0, m2) [(b'enoceanmqtt/shutter_k\xc3\xbcche_terrasse/req/#', 0)] 2023-06-27 13:10:42,967 DEBUG: Sending SUBSCRIBE (d0, m3) [(b'enoceanmqtt/shutter_wz_terrasse1/req/#', 0)] 2023-06-27 13:10:42,968 DEBUG: Sending SUBSCRIBE (d0, m4) [(b'enoceanmqtt/light_haust\xc3\xbcr_outside/req/#', 0)] 2023-06-27 13:10:42,969 DEBUG: Sending SUBSCRIBE (d0, m5) [(b'enoceanmqtt/light_terrasse_outside/req/#', 0)] 2023-06-27 13:10:42,970 DEBUG: Sending SUBSCRIBE (d0, m6) [(b'enoceanmqtt/light_terasse1_outside/req/#', 0)] 2023-06-27 13:10:42,972 DEBUG: Sending PUBLISH (d0, q0, r1, m7), 'b'homeassistant/cover/enocean_D20500_050E7E6E_NONE_cover/config'', ... (1345 bytes) 2023-06-27 13:10:42,973 DEBUG: Sending PUBLISH (d0, q0, r1, m8), 'b'homeassistant/sensor/enocean_D20500_050E7E6E_NONE_rssi/config'', ... (514 bytes) 2023-06-27 13:10:42,974 DEBUG: Sending PUBLISH (d0, q0, r1, m9), 'b'homeassistant/sensor/enocean_D20500_050E7E6E_NONE_last_seen/config'', ... (554 bytes) 2023-06-27 13:10:42,975 DEBUG: Sending SUBSCRIBE (d0, m10) [(b'homeassistant/cover/enocean_D20500_050E7E6E_NONE_cover/config/#', 0)] 2023-06-27 13:10:42,976 DEBUG: Sending SUBSCRIBE (d0, m11) [(b'enoceanmqtt/shutter_wz_terrasse/__system/#', 0)] 2023-06-27 13:10:42,990 INFO: Device enoceanmqtt/shutter_wz_terrasse (UID: D20500_050E7E6E_NONE / EEP: D2-05-00) updated on device database 2023-06-27 13:10:42,993 DEBUG: Sending PUBLISH (d0, q0, r1, m12), 'b'homeassistant/cover/enocean_D20500_0587A2F7_NONE_cover/config'', ... (1401 bytes) 2023-06-27 13:10:42,995 DEBUG: Sending PUBLISH (d0, q0, r1, m13), 'b'homeassistant/sensor/enocean_D20500_0587A2F7_NONE_rssi/config'', ... (538 bytes) 2023-06-27 13:10:42,996 DEBUG: Sending PUBLISH (d0, q0, r1, m14), 'b'homeassistant/sensor/enocean_D20500_0587A2F7_NONE_last_seen/config'', ... (578 bytes) 2023-06-27 13:10:42,997 DEBUG: Sending SUBSCRIBE (d0, m15) [(b'homeassistant/cover/enocean_D20500_0587A2F7_NONE_cover/config/#', 0)] 2023-06-27 13:10:42,998 DEBUG: Sending SUBSCRIBE (d0, m16) [(b'enoceanmqtt/shutter_k\xc3\xbcche_terrasse/__system/#', 0)] 2023-06-27 13:10:43,004 INFO: Device enoceanmqtt/shutter_küche_terrasse (UID: D20500_0587A2F7_NONE / EEP: D2-05-00) updated on device database 2023-06-27 13:10:43,006 DEBUG: Sending PUBLISH (d0, q0, r1, m17), 'b'homeassistant/cover/enocean_D20500_059EEC27_NONE_cover/config'', ... (1352 bytes) 2023-06-27 13:10:43,007 DEBUG: Sending PUBLISH (d0, q0, r1, m18), 'b'homeassistant/sensor/enocean_D20500_059EEC27_NONE_rssi/config'', ... (517 bytes) 2023-06-27 13:10:43,008 DEBUG: Sending PUBLISH (d0, q0, r1, m19), 'b'homeassistant/sensor/enocean_D20500_059EEC27_NONE_last_seen/config'', ... (557 bytes) 2023-06-27 13:10:43,009 DEBUG: Sending SUBSCRIBE (d0, m20) [(b'homeassistant/cover/enocean_D20500_059EEC27_NONE_cover/config/#', 0)] 2023-06-27 13:10:43,010 DEBUG: Sending SUBSCRIBE (d0, m21) [(b'enoceanmqtt/shutter_wz_terrasse1/__system/#', 0)] 2023-06-27 13:10:43,016 INFO: Device enoceanmqtt/shutter_wz_terrasse1 (UID: D20500_059EEC27_NONE / EEP: D2-05-00) updated on device database 2023-06-27 13:10:43,018 DEBUG: Sending PUBLISH (d0, q0, r1, m22), 'b'homeassistant/light/enocean_D20112_059E2EEB_NONE_IO0/config'', ... (762 bytes) 2023-06-27 13:10:43,019 DEBUG: Sending PUBLISH (d0, q0, r1, m23), 'b'homeassistant/button/enocean_D20112_059E2EEB_NONE_query_status_IO0/config'', ... (490 bytes) 2023-06-27 13:10:43,020 DEBUG: Sending PUBLISH (d0, q0, r1, m24), 'b'homeassistant/binary_sensor/enocean_D20112_059E2EEB_NONE_IO0_LC/config'', ... (522 bytes) 2023-06-27 13:10:43,020 DEBUG: Sending PUBLISH (d0, q0, r1, m25), 'b'homeassistant/light/enocean_D20112_059E2EEB_NONE_IO1/config'', ... (762 bytes) 2023-06-27 13:10:43,021 DEBUG: Sending PUBLISH (d0, q0, r1, m26), 'b'homeassistant/button/enocean_D20112_059E2EEB_NONE_query_status_IO1/config'', ... (490 bytes) 2023-06-27 13:10:43,022 DEBUG: Sending PUBLISH (d0, q0, r1, m27), 'b'homeassistant/binary_sensor/enocean_D20112_059E2EEB_NONE_IO1_LC/config'', ... (522 bytes) 2023-06-27 13:10:43,023 DEBUG: Sending PUBLISH (d0, q0, r1, m28), 'b'homeassistant/button/enocean_D20112_059E2EEB_NONE_query_status_all/config'', ... (491 bytes) 2023-06-27 13:10:43,024 DEBUG: Sending PUBLISH (d0, q0, r1, m29), 'b'homeassistant/sensor/enocean_D20112_059E2EEB_NONE_rssi/config'', ... (535 bytes) 2023-06-27 13:10:43,025 DEBUG: Sending PUBLISH (d0, q0, r1, m30), 'b'homeassistant/sensor/enocean_D20112_059E2EEB_NONE_last_seen/config'', ... (575 bytes) 2023-06-27 13:10:43,026 DEBUG: Sending SUBSCRIBE (d0, m31) [(b'homeassistant/light/enocean_D20112_059E2EEB_NONE_IO0/config/#', 0)] 2023-06-27 13:10:43,026 DEBUG: Sending SUBSCRIBE (d0, m32) [(b'enoceanmqtt/light_haust\xc3\xbcr_outside/__system/#', 0)] 2023-06-27 13:10:43,032 INFO: Device enoceanmqtt/light_haustür_outside (UID: D20112_059E2EEB_NONE / EEP: D2-01-12) updated on device database 2023-06-27 13:10:43,034 DEBUG: Sending PUBLISH (d0, q0, r1, m33), 'b'homeassistant/switch/enocean_D2010F_0590ECEE_NONE_switch/config'', ... (741 bytes) 2023-06-27 13:10:43,034 DEBUG: Sending PUBLISH (d0, q0, r1, m34), 'b'homeassistant/button/enocean_D2010F_0590ECEE_NONE_query_status/config'', ... (471 bytes) 2023-06-27 13:10:43,035 DEBUG: Sending PUBLISH (d0, q0, r1, m35), 'b'homeassistant/binary_sensor/enocean_D2010F_0590ECEE_NONE_LC/config'', ... (498 bytes) 2023-06-27 13:10:43,035 DEBUG: Sending PUBLISH (d0, q0, r1, m36), 'b'homeassistant/sensor/enocean_D2010F_0590ECEE_NONE_rssi/config'', ... (523 bytes) 2023-06-27 13:10:43,036 DEBUG: Sending PUBLISH (d0, q0, r1, m37), 'b'homeassistant/sensor/enocean_D2010F_0590ECEE_NONE_last_seen/config'', ... (563 bytes) 2023-06-27 13:10:43,036 DEBUG: Sending SUBSCRIBE (d0, m38) [(b'homeassistant/switch/enocean_D2010F_0590ECEE_NONE_switch/config/#', 0)] 2023-06-27 13:10:43,036 DEBUG: Sending SUBSCRIBE (d0, m39) [(b'enoceanmqtt/light_terrasse_outside/__system/#', 0)] 2023-06-27 13:10:43,042 INFO: Device enoceanmqtt/light_terrasse_outside (UID: D2010F_0590ECEE_NONE / EEP: D2-01-0F) updated on device database 2023-06-27 13:10:43,044 DEBUG: Sending PUBLISH (d0, q0, r1, m40), 'b'homeassistant/light/enocean_D20112_05A084CF_NONE_IO0/config'', ... (746 bytes) 2023-06-27 13:10:43,045 DEBUG: Sending PUBLISH (d0, q0, r1, m41), 'b'homeassistant/button/enocean_D20112_05A084CF_NONE_query_status_IO0/config'', ... (478 bytes) 2023-06-27 13:10:43,045 DEBUG: Sending PUBLISH (d0, q0, r1, m42), 'b'homeassistant/binary_sensor/enocean_D20112_05A084CF_NONE_IO0_LC/config'', ... (510 bytes) 2023-06-27 13:10:43,046 DEBUG: Sending PUBLISH (d0, q0, r1, m43), 'b'homeassistant/light/enocean_D20112_05A084CF_NONE_IO1/config'', ... (746 bytes) 2023-06-27 13:10:43,046 DEBUG: Sending PUBLISH (d0, q0, r1, m44), 'b'homeassistant/button/enocean_D20112_05A084CF_NONE_query_status_IO1/config'', ... (478 bytes) 2023-06-27 13:10:43,047 DEBUG: Sending PUBLISH (d0, q0, r1, m45), 'b'homeassistant/binary_sensor/enocean_D20112_05A084CF_NONE_IO1_LC/config'', ... (510 bytes) 2023-06-27 13:10:43,047 DEBUG: Sending PUBLISH (d0, q0, r1, m46), 'b'homeassistant/button/enocean_D20112_05A084CF_NONE_query_status_all/config'', ... (479 bytes) 2023-06-27 13:10:43,048 DEBUG: Sending PUBLISH (d0, q0, r1, m47), 'b'homeassistant/sensor/enocean_D20112_05A084CF_NONE_rssi/config'', ... (523 bytes) 2023-06-27 13:10:43,049 DEBUG: Sending PUBLISH (d0, q0, r1, m48), 'b'homeassistant/sensor/enocean_D20112_05A084CF_NONE_last_seen/config'', ... (563 bytes) 2023-06-27 13:10:43,049 DEBUG: Sending SUBSCRIBE (d0, m49) [(b'homeassistant/light/enocean_D20112_05A084CF_NONE_IO0/config/#', 0)] 2023-06-27 13:10:43,050 DEBUG: Sending SUBSCRIBE (d0, m50) [(b'enoceanmqtt/light_terasse1_outside/__system/#', 0)] 2023-06-27 13:10:43,055 INFO: Device enoceanmqtt/light_terasse1_outside (UID: D20112_05A084CF_NONE / EEP: D2-01-12) updated on device database 2023-06-27 13:10:43,056 DEBUG: List of remaining UIDS: [] 2023-06-27 13:10:43,056 DEBUG: Sending PUBLISH (d0, q0, r1, m51), 'b'homeassistant/switch/enoceanmqtt_learn_FFC9C080/config'', ... (374 bytes) 2023-06-27 13:10:43,057 DEBUG: Sending SUBSCRIBE (d0, m52) [(b'enoceanmqtt/__system/learn/req/#', 0)] 2023-06-27 13:10:43,057 DEBUG: Sending PUBLISH (d0, q0, r1, m53), 'b'enoceanmqtt/__system/learn'', ... (3 bytes) 2023-06-27 13:10:43,064 DEBUG: Received SUBACK 2023-06-27 13:10:43,065 DEBUG: Received SUBACK 2023-06-27 13:10:43,066 DEBUG: Received SUBACK 2023-06-27 13:10:43,067 DEBUG: Received SUBACK 2023-06-27 13:10:43,084 DEBUG: Received SUBACK 2023-06-27 13:10:43,085 DEBUG: Received SUBACK 2023-06-27 13:10:43,086 DEBUG: Received SUBACK 2023-06-27 13:10:43,086 DEBUG: Received PUBLISH (d0, q0, r1, m0), 'homeassistant/cover/enocean_D20500_050E7E6E_NONE_cover/config', ... (1345 bytes) 2023-06-27 13:10:43,087 DEBUG: Received SUBACK 2023-06-27 13:10:43,088 DEBUG: Received SUBACK 2023-06-27 13:10:43,088 DEBUG: Received PUBLISH (d0, q0, r1, m0), 'homeassistant/cover/enocean_D20500_0587A2F7_NONE_cover/config', ... (1401 bytes) 2023-06-27 13:10:43,117 DEBUG: Received SUBACK 2023-06-27 13:10:43,118 DEBUG: Received SUBACK 2023-06-27 13:10:43,119 DEBUG: Received PUBLISH (d0, q0, r1, m0), 'homeassistant/cover/enocean_D20500_059EEC27_NONE_cover/config', ... (1352 bytes) 2023-06-27 13:10:43,119 DEBUG: Received SUBACK 2023-06-27 13:10:43,120 DEBUG: Received SUBACK 2023-06-27 13:10:43,120 DEBUG: Received PUBLISH (d0, q0, r1, m0), 'homeassistant/light/enocean_D20112_059E2EEB_NONE_IO0/config', ... (762 bytes) 2023-06-27 13:10:43,152 DEBUG: Received SUBACK 2023-06-27 13:10:43,152 DEBUG: Received SUBACK 2023-06-27 13:10:43,153 DEBUG: Received PUBLISH (d0, q0, r1, m0), 'homeassistant/switch/enocean_D2010F_0590ECEE_NONE_switch/config', ... (741 bytes) 2023-06-27 13:10:43,154 DEBUG: Received SUBACK 2023-06-27 13:10:43,154 DEBUG: Received SUBACK 2023-06-27 13:10:43,155 DEBUG: Received PUBLISH (d0, q0, r1, m0), 'homeassistant/light/enocean_D20112_05A084CF_NONE_IO0/config', ... (746 bytes) 2023-06-27 13:10:43,194 DEBUG: Received SUBACK 2023-06-27 13:10:43,195 DEBUG: Received SUBACK 2023-06-27 13:11:30,971 DEBUG: Received PUBLISH (d0, q0, r0, m0), 'enoceanmqtt/shutter_wz_terrasse1/req', ... (81 bytes) 2023-06-27 13:11:30,972 DEBUG: Got MQTT message: enoceanmqtt/shutter_wz_terrasse1/req 2023-06-27 13:11:30,973 WARNING: Unexpected or erroneous MQTT message: enoceanmqtt/shutter_wz_terrasse1/req: b'{"CMD":"1","POS":"19","ANG":"127","REPO":"0","LOCK":"0","CHN":"0","send":"clear"}' ```
Originally posted by mak-gitdev July 9, 2023 Ok this is a bug at enocean-mqtt level. And as previously explained, this is not related to the firmware. When a send request is received, we have to determine which sensor is targeted. To select the correct sensor, a name comparison is done between the MQTT topic and the list of sensors. At the moment, this name comparison checks whether a sensor name is **IN** the MQTT topic. Thus, when a request targeting `shutterwz/terrasse1` is received, as `shutterwz/terrasse` appears first in the list of sensors and as **"shutterwz/terrasse"** is also in "**shutterwz/terrasse**1", it will pass the current name comparison and it will be selected as the targeted device. Then as the wrong device is selected, you end up with this message indicating that the MQTT message is unexpected or erroneous. Fortunately, fixing this is simple. While waiting for the fix to be applied, you can just choose a different name for `shutterwz/terrasse1` very different from `shutterwz/terrasse`. Thanks for discovering this one :+1:
mak-gitdev commented 11 months ago

https://github.com/users/mak-gitdev/projects/1?pane=issue&itemId=35566300

mak-gitdev commented 9 months ago

Fixed by commit 0d0a4cd