mak-gitdev/HA_enoceanmqtt

Can't turn the LEARN switch on

fredericseiler opened this issue ยท 10 comments

Hi,

When I try to turn the LEARN switch on in HA, I get this log from the addon:

WARNING: Unexpected or erroneous MQTT message: enoceanmqtt/__system/learn/req: b'ON'

And the switch immediately turns off.

Is it just a visual bug or is the learning process not starting at all ? I can't add a specific device (avidsen 970221 with EEP D5-00-01) and I don't know if it's because of the LEARN issue or something else.

My setup:
EnOcean MQTT 0.1.24 dev (HA addon)
MQTT Broker 6.1.3 (HA addon)
HA 2023.2.5

I also have 2 NodOn devices which are working fine with your addon, so, many thanks for that !

Hi @fredericseiler,

For D5-00-01, you don't need to learn them.
Just add them in your device file, stop then start the addon and you should see them as new MQTT devices.

I will have a look at learn switch. This may be a real issue.

Ok, this is an issue. I will push version 0.1.25 to fix it.
Thanks for spotting this one ๐Ÿ‘

For D5-00-01, you don't need to learn them. Just add them in you device file, stop then start the addon and you should see them as new MQTT devices.

Yep, that's what I thought too, but the device still is in unknown state, and its manual talks about a pairing button (page 9) so I'm kinda lost on this one (brand new to the enocean club). If you have any idea...

Ok, this is an issue. I will push version 0.1.25 to fix it. Thanks for spotting this one ๐Ÿ‘

You rock, thanks again for your work!

D5-00-01 is a contact sensor. It sends the contact status at a regular interval or if the status changes.
It may be in unknown state because no message has been received yet.

D5-00-01 is a contact sensor. It sends the contact status at a regular interval or if the status changes. It may be in unknown state because no message has been received yet.

I know, the events of my other EPP D5-00-01 test device (NodOn SDO-2-1-0x) are received correctly. The advisen one even has a little led that flashes when I bring close the magnet, but still nothing (well, "unknown") in HA.

By the way, the NodOn one also has pairing instructions with a dedicated button, so I'm a little bit confused right now: when you said that those devices don't need to be learned, is this the same as zigbee pairing or something else ?

Could you report your enoceanmqtt.log here ?

By the way, the NodOn one also has pairing instructions with a dedicated button, so I'm a little bit confused right now: when you said that those devices don't need to be learned.

Just to clarify, they don't need to be learned in OUR use case.
But EnOcean devices can communicate with each other. Hence in such use case, you will have to learn your D5-00-01 to another device so that it can control that device depending on the contact status.

Sure, here you go, with debug: true and log_packets: true

enoceanmqtt.log
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Preparing to start...
Retrieved devices file: /config/enoceanmqtt.devices
Starting EnOceanMQTT...
/usr/lib/python3.10/site-packages/beautifulsoup4-4.11.2-py3.10.egg/bs4/builder/__init__.py:545: XMLParsedAsHTMLWarning: It looks like you're parsing an XML document using an HTML parser. If this really is an HTML document (maybe it's XHTML?), you can ignore or filter this warning. If it's XML, you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the lxml package installed, and pass the keyword argument `features="xml"` into the BeautifulSoup constructor.
  warnings.warn(
2023-02-19 21:07:11,816 INFO: Logging to file: /config/enoceanmqtt.log
2023-02-19 21:07:11,816 INFO: Loading config file /data/enoceanmqtt.conf
2023-02-19 21:07:11,817 DEBUG: Created sensor: {'name': 'enoceanmqtt/Temp1', 'address': 86200076, 'rorg': 165, 'func': 4, 'type': 1}
2023-02-19 21:07:11,817 DEBUG: Created sensor: {'name': 'enoceanmqtt/Porte1', 'address': 86154355, 'rorg': 213, 'func': 0, 'type': 1}
2023-02-19 21:07:11,818 DEBUG: Created sensor: {'name': 'enoceanmqtt/Porte2', 'address': 92800905, 'rorg': 213, 'func': 0, 'type': 1}
2023-02-19 21:07:11,818 DEBUG: Global config: {'enocean_port': '/dev/ttyUSB1', 'log_packets': 'true', 'overlay': 'HA', 'db_file': '/data/enoceanmqtt_db.json', 'mapping_file': '', 'mqtt_discovery_prefix': 'homeassistant/', 'mqtt_host': 'core-mosquitto', 'mqtt_port': '1883', 'mqtt_client_id': 'enocean_gateway', 'mqtt_keepalive': '60', 'mqtt_prefix': 'enoceanmqtt/', 'mqtt_user': 'addons', 'mqtt_pwd': '*****', 'mqtt_debug': 'true'}
2023-02-19 21:07:11,818 INFO: Selected overlay : Home Assistant
2023-02-19 21:07:12,313 INFO: Mapping file correctly read: /app/enocean-mqtt/enoceanmqtt/overlays/homeassistant/mapping.yaml
2023-02-19 21:07:12,313 INFO: Device database /data/enoceanmqtt_db.json correctly read/created
2023-02-19 21:07:12,313 INFO: Authenticating: addons
2023-02-19 21:07:12,314 DEBUG: Connecting to host core-mosquitto, port 1883, keepalive 60
2023-02-19 21:07:12,315 INFO: SerialCommunicator started
2023-02-19 21:07:12,315 INFO: Auto Teach-in is disabled
2023-02-19 21:07:12,317 WARNING: Replacing Packet.optional with default value.
2023-02-19 21:07:12,317 DEBUG: Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'enocean_gateway'
2023-02-19 21:07:12,415 INFO: Sending packet
2023-02-19 21:07:12,416 DEBUG: 0x05 ['0x8'] [] OrderedDict()
2023-02-19 21:07:12,516 DEBUG: 0x02 ['0x0', '0xff', '0xeb', '0xc1', '0x0'] ['0xa'] OrderedDict()
2023-02-19 21:07:12,516 INFO: got response packet: OK
2023-02-19 21:07:12,690 DEBUG: Received CONNACK (0, 0)
2023-02-19 21:07:12,690 INFO: Succesfully connected to MQTT broker.
2023-02-19 21:07:12,691 DEBUG: Sending SUBSCRIBE (d0, m1) [(b'enoceanmqtt/Temp1/req/#', 0)]
2023-02-19 21:07:12,691 DEBUG: Sending SUBSCRIBE (d0, m2) [(b'enoceanmqtt/Porte1/req/#', 0)]
2023-02-19 21:07:12,691 DEBUG: Sending SUBSCRIBE (d0, m3) [(b'enoceanmqtt/Porte2/req/#', 0)]
2023-02-19 21:07:12,692 DEBUG: Sending PUBLISH (d0, q0, r1, m4), 'b'homeassistant/sensor/enocean_A50401_05234F0C_NONE_h_raw/config'', ... (460 bytes)
2023-02-19 21:07:12,692 DEBUG: Sending PUBLISH (d0, q0, r1, m5), 'b'homeassistant/sensor/enocean_A50401_05234F0C_NONE_hum/config'', ... (436 bytes)
2023-02-19 21:07:12,692 DEBUG: Sending PUBLISH (d0, q0, r1, m6), 'b'homeassistant/sensor/enocean_A50401_05234F0C_NONE_t_raw/config'', ... (469 bytes)
2023-02-19 21:07:12,692 DEBUG: Sending PUBLISH (d0, q0, r1, m7), 'b'homeassistant/sensor/enocean_A50401_05234F0C_NONE_tempC/config'', ... (449 bytes)
2023-02-19 21:07:12,692 DEBUG: Sending PUBLISH (d0, q0, r1, m8), 'b'homeassistant/binary_sensor/enocean_A50401_05234F0C_NONE_status/config'', ... (409 bytes)
2023-02-19 21:07:12,692 DEBUG: Sending PUBLISH (d0, q0, r1, m9), 'b'homeassistant/sensor/enocean_A50401_05234F0C_NONE_rssi/config'', ... (472 bytes)
2023-02-19 21:07:12,693 DEBUG: Sending PUBLISH (d0, q0, r1, m10), 'b'homeassistant/sensor/enocean_A50401_05234F0C_NONE_last_seen/config'', ... (512 bytes)
2023-02-19 21:07:12,693 DEBUG: Sending SUBSCRIBE (d0, m11) [(b'homeassistant/sensor/enocean_A50401_05234F0C_NONE_h_raw/config/#', 0)]
2023-02-19 21:07:12,693 DEBUG: Sending SUBSCRIBE (d0, m12) [(b'enoceanmqtt/Temp1/__system/#', 0)]
2023-02-19 21:07:12,696 INFO: Device enoceanmqtt/Temp1 (UID: A50401_05234F0C_NONE / EEP: A5-04-01) updated on device database
2023-02-19 21:07:12,697 DEBUG: Sending PUBLISH (d0, q0, r1, m13), 'b'homeassistant/binary_sensor/enocean_D50001_05229C73_NONE_contact/config'', ... (418 bytes)
2023-02-19 21:07:12,697 DEBUG: Sending PUBLISH (d0, q0, r1, m14), 'b'homeassistant/sensor/enocean_D50001_05229C73_NONE_rssi/config'', ... (475 bytes)
2023-02-19 21:07:12,697 DEBUG: Sending PUBLISH (d0, q0, r1, m15), 'b'homeassistant/sensor/enocean_D50001_05229C73_NONE_last_seen/config'', ... (515 bytes)
2023-02-19 21:07:12,698 DEBUG: Sending SUBSCRIBE (d0, m16) [(b'homeassistant/binary_sensor/enocean_D50001_05229C73_NONE_contact/config/#', 0)]
2023-02-19 21:07:12,698 DEBUG: Sending SUBSCRIBE (d0, m17) [(b'enoceanmqtt/Porte1/__system/#', 0)]
2023-02-19 21:07:12,699 INFO: Device enoceanmqtt/Porte1 (UID: D50001_05229C73_NONE / EEP: D5-00-01) updated on device database
2023-02-19 21:07:12,700 DEBUG: Sending PUBLISH (d0, q0, r1, m18), 'b'homeassistant/binary_sensor/enocean_D50001_05880789_NONE_contact/config'', ... (418 bytes)
2023-02-19 21:07:12,700 DEBUG: Sending PUBLISH (d0, q0, r1, m19), 'b'homeassistant/sensor/enocean_D50001_05880789_NONE_rssi/config'', ... (475 bytes)
2023-02-19 21:07:12,700 DEBUG: Sending PUBLISH (d0, q0, r1, m20), 'b'homeassistant/sensor/enocean_D50001_05880789_NONE_last_seen/config'', ... (515 bytes)
2023-02-19 21:07:12,701 DEBUG: Sending SUBSCRIBE (d0, m21) [(b'homeassistant/binary_sensor/enocean_D50001_05880789_NONE_contact/config/#', 0)]
2023-02-19 21:07:12,701 DEBUG: Sending SUBSCRIBE (d0, m22) [(b'enoceanmqtt/Porte2/__system/#', 0)]
2023-02-19 21:07:12,703 INFO: Device enoceanmqtt/Porte2 (UID: D50001_05880789_NONE / EEP: D5-00-01) updated on device database
2023-02-19 21:07:12,703 DEBUG: List of remaining UIDS: []
2023-02-19 21:07:12,703 DEBUG: Sending PUBLISH (d0, q0, r1, m23), 'b'homeassistant/switch/enoceanmqtt_learn_FFEBC100/config'', ... (374 bytes)
2023-02-19 21:07:12,703 DEBUG: Sending SUBSCRIBE (d0, m24) [(b'enoceanmqtt/__system/learn/req/#', 0)]
2023-02-19 21:07:12,703 DEBUG: Sending PUBLISH (d0, q0, r1, m25), 'b'enoceanmqtt/__system/learn'', ... (3 bytes)
2023-02-19 21:07:12,704 DEBUG: Received SUBACK
2023-02-19 21:07:12,704 DEBUG: Received SUBACK
2023-02-19 21:07:12,705 DEBUG: Received SUBACK
2023-02-19 21:07:12,719 DEBUG: Received SUBACK
2023-02-19 21:07:12,720 DEBUG: Received PUBLISH (d0, q0, r1, m0), 'homeassistant/sensor/enocean_A50401_05234F0C_NONE_h_raw/config', ...  (460 bytes)
2023-02-19 21:07:12,720 DEBUG: Received SUBACK
2023-02-19 21:07:12,720 DEBUG: Received SUBACK
2023-02-19 21:07:12,721 DEBUG: Received PUBLISH (d0, q0, r1, m0), 'homeassistant/binary_sensor/enocean_D50001_05229C73_NONE_contact/config', ...  (418 bytes)
2023-02-19 21:07:12,721 DEBUG: Received SUBACK
2023-02-19 21:07:12,721 DEBUG: Received SUBACK
2023-02-19 21:07:12,721 DEBUG: Received PUBLISH (d0, q0, r1, m0), 'homeassistant/binary_sensor/enocean_D50001_05880789_NONE_contact/config', ...  (418 bytes)
2023-02-19 21:07:12,760 DEBUG: Received SUBACK
2023-02-19 21:07:12,761 DEBUG: Received SUBACK

The faulty one is 05880789.

Generate some traffic with your "faulty" sensor and report the log again.
It should contain log from the device. Otherwise, may be your device just doesn't have enough energy to send messages.

Ok, surprising twist: the events are now well transmitted to MQTT !

I think the restart to enable debug logs helped somehow (I already restarted a couple of times after the device integration, so, don't ask me what happened).

Sorry for the trouble, and thanks for your help!

Fixed by commit be01b5e