thejeffreystone / hassio_addons

Apache License 2.0
47 stars 28 forks source link

Persistent crash - instance referenced before assignment #43

Closed bpkbpk closed 1 year ago

bpkbpk commented 1 year ago

Everything works great for a few hours and then consistently a crash is reported in the logs and all sensor updates stop. This is in home assistant. The devices are a bunch of acurite temp/humidity sensors (6 in quantity)

A restart, of course, fixes things for another few hours.

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/client.py", line 3591, in _thread_main self.loop_forever(retry_first_connection=True) File "/usr/lib/python3.10/site-packages/paho/mqtt/client.py", line 1756, in loop_forever rc = self._loop(timeout) File "/usr/lib/python3.10/site-packages/paho/mqtt/client.py", line 1164, in _loop rc = self.loop_read() File "/usr/lib/python3.10/site-packages/paho/mqtt/client.py", line 1556, in loop_read rc = self._packet_read() File "/usr/lib/python3.10/site-packages/paho/mqtt/client.py", line 2439, in _packet_read rc = self._packet_handle() File "/usr/lib/python3.10/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle return self._handle_publish() File "/usr/lib/python3.10/site-packages/paho/mqtt/client.py", line 3327, in _handle_publish self._handle_on_message(message) File "/usr/lib/python3.10/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message on_message(self, self._userdata, message) File "/scripts/rtl_433_mqtt_hass.py", line 522, in mqtt_message bridge_event_to_hass(client, msg.topic, data) File "/scripts/rtl_433_mqtt_hass.py", line 595, in bridge_event_to_hass if not instance: UnboundLocalError: local variable 'instance' referenced before assignment

bpkbpk commented 1 year ago

OK - I had my device filter to nothing so "all" devices were being discovered. I changed it to only Accurite devices and so far, I have not seen any crashes like previously....

thejeffreystone commented 1 year ago

Right on. I am working on a fix I think for that instance issue.

bpkbpk commented 1 year ago

Awesome - thanks!