mak-gitdev / HA_enoceanmqtt

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

1 day later ... everything stopped working after 24hrs #10

Closed commentsonly closed 1 year ago

commentsonly commented 1 year ago

Log snipped from the EnOcean MQTT Log from within Home Assistant ---cut---cut---cut--- INFO: Auto Teach-in is disabled 2022-11-20 14:05:01,474 WARNING: Replacing Packet.optional with default value. 2022-11-20 14:05:01,477 INFO: Succesfully connected to MQTT broker. 2022-11-20 14:05:01,477 WARNING: Replacing Packet.optional with default value. 2022-11-20 14:05:01,575 INFO: Sending packet 2022-11-20 14:05:01,575 INFO: Sending packet Exception in thread Thread-1 (_thread_main): Traceback (most recent call last): File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/usr/lib/python3.10/site-packages/paho_mqtt-1.6.1-py3.10.egg/paho/mqtt/client.py", line 3591, in _thread_main self.loop_forever(retry_first_connection=True) File "/usr/lib/python3.10/site-packages/paho_mqtt-1.6.1-py3.10.egg/paho/mqtt/client.py", line 1756, in loop_forever rc = self._loop(timeout) File "/usr/lib/python3.10/site-packages/paho_mqtt-1.6.1-py3.10.egg/paho/mqtt/client.py", line 1164, in _loop rc = self.loop_read() File "/usr/lib/python3.10/site-packages/paho_mqtt-1.6.1-py3.10.egg/paho/mqtt/client.py", line 1556, in loop_read rc = self._packet_read() File "/usr/lib/python3.10/site-packages/paho_mqtt-1.6.1-py3.10.egg/paho/mqtt/client.py", line 2439, in _packet_read rc = self._packet_handle() File "/usr/lib/python3.10/site-packages/paho_mqtt-1.6.1-py3.10.egg/paho/mqtt/client.py", line 3039, in _packet_handle return self._handle_connack() File "/usr/lib/python3.10/site-packages/paho_mqtt-1.6.1-py3.10.egg/paho/mqtt/client.py", line 3138, in _handle_connack on_connect( File "/app/enocean-mqtt/enoceanmqtt/overlays/homeassistant/ha_communicator.py", line 87, in _on_connect self._mqtt_discovery_system('learn') File "/app/enocean-mqtt/enoceanmqtt/overlays/homeassistant/ha_communicator.py", line 149, in _mqtt_discovery_system sender = enocean.utils.combine_hex(self.enocean_sender) File "/usr/lib/python3.10/site-packages/enocean-0.60.1-py3.10.egg/enocean/utils.py", line 13, in combine_hex for i, value in enumerate(reversed(data)): TypeError: 'NoneType' object is not reversible ---cut---cut---

any idea what happened? by now none of the 2 rockers work. better said one of them is now permanently on? (taster kein schalter if you know what I mean) snap3

happend while I was in the process to add another rocker ... same model, same tpye. I added it to the enoceanmqtt.devices file like this [gira_4way_1] address = 0xFEE50F9C rorg = 0xF6 func = 0x02 type = 0x01 [gira_4way_2] address = 0xFEE3448D rorg = 0xF6 func = 0x02 type = 0x01 second one is the new one. And before having rebooted HA I was even able to see the "unknown device : FE E3 44 8D ... but then everything stopped and I found the log from above.

commentsonly commented 1 year ago

can answer this myself ... after nothing worked whereas it did ... no actions upon button presses. I rebooted HA and also unplugged and replugged the EnOcean stick. And ......what a miracle .... everything works. Also MQTT recognised the new rocker.

mak-gitdev commented 1 year ago

There might be a real issue hidden here.

Not sure about the real cause yet but it seems that, for an unknown reason, your dongle wasn't available and that leads to the exception reported in the log. Your rocker wasn't working because of that exception. In fact, the state of the rocker displayed on the device page was the last one received before the exception.

I certainly have to better handle such case. In a future commit, I will add an availability information that will clearly indicate that the devices are not available when the addon isn't working. I may also add some kind of waiting loop while the dongle isn't available and report that in the log as well.

mak-gitdev commented 1 year ago

As I thought, this is a real issue. This has also been reported in #1. It is in fact due to a lack of synchronization between threads during startup. This will be fixed with the next commit.

Before that fix is available, restarting the addon may "solve" this issue as this happen from time to time.

mak-gitdev commented 1 year ago

Fixed by commit 7806f87