mjmccans / hassio-addon-airthings

Home Assistant Add-on for Airthings devices that uses mqtt to integrate with Home Assistant via mqtt discovery.
MIT License
20 stars 3 forks source link

Airthings not starting on boot, possibly related to the new BLE integration? #18

Open bobloadmire opened 2 years ago

bobloadmire commented 2 years ago

Since the last update, the AT addon won't auto start, even thought its toggled on the addon page. I do have the new bluetooth integration enabled, related? I can manually start AT add on after boot though, no logged errors.

mjmccans commented 2 years ago

Do you have the watchdog toggle selected? I ask because if the add-on fails to communicate with the bluetooth adapter when it first boots it relies on the watchdog function to keep restarting the add-on until it can. Please give that a try and let me know if it helps. Thank you.

bobloadmire commented 2 years ago

the watchdog is enabled. I looked at the logs, not seeing anything useful.

mjmccans commented 2 years ago

Very strange. I gather from your comment that the add-on just doesn't start on boot despite the option being selected. I could be wrong, but this seems like a Home Assistant issue and not a bug in the add-on because you would have log entries / errors if the add-on was started. Probably not super helpful, but I suggest trying uninstalling and reinstalling the add-on and see if that helps anything. Sorry about not being able to provide more guidance; this is not an issue that I am seeing or anyone else has reported.

bobloadmire commented 2 years ago

no worries, I can start it manually, just thought you would like to know.

bobloadmire commented 2 years ago

Ok think I finally got a relevant log:

[2022-08-18 08:37:14] ERROR: A message handler raised an exception: 'org.bluez.Device1'. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 668, in _process_message result = handler(msg) File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 746, in _parse_msg condition_callback() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 658, in callback self._properties[device_path][defs.DEVICE_INTERFACE][property_name] KeyError: 'org.bluez.Device1' [2022-08-18 08:37:14] ERROR: A message handler raised an exception: 'org.bluez.Device1'. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 668, in _process_message result = handler(msg) File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 746, in _parse_msg condition_callback() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 658, in callback self._properties[device_path][defs.DEVICE_INTERFACE][property_name] KeyError: 'org.bluez.Device1' [2022-08-18 08:37:14] ERROR: A message handler raised an exception: 'org.bluez.Device1'. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 668, in _process_message result = handler(msg) File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 746, in _parse_msg condition_callback() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 658, in callback self._properties[device_path][defs.DEVICE_INTERFACE][property_name] KeyError: 'org.bluez.Device1' [2022-08-18 08:37:14] ERROR: A message handler raised an exception: 'org.bluez.Device1'. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 668, in _process_message result = handler(msg) File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 746, in _parse_msg condition_callback() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 658, in callback self._properties[device_path][defs.DEVICE_INTERFACE][property_name] KeyError: 'org.bluez.Device1' [2022-08-18 08:37:14] ERROR: A message handler raised an exception: 'org.bluez.Device1'. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 668, in _process_message result = handler(msg) File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 746, in _parse_msg condition_callback() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 658, in callback self._properties[device_path][defs.DEVICE_INTERFACE][property_name] KeyError: 'org.bluez.Device1' [2022-08-18 08:37:14] ERROR: A message handler raised an exception: 'org.bluez.Device1'. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 668, in _process_message result = handler(msg) File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 746, in _parse_msg condition_callback() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 658, in callback self._properties[device_path][defs.DEVICE_INTERFACE][property_name] KeyError: 'org.bluez.Device1' [2022-08-18 08:37:14] ERROR: A message handler raised an exception: 'org.bluez.Device1'. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 668, in _process_message result = handler(msg) File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 746, in _parse_msg condition_callback() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 658, in callback self._properties[device_path][defs.DEVICE_INTERFACE][property_name] KeyError: 'org.bluez.Device1' [2022-08-18 08:38:19] ERROR: A message handler raised an exception: 'org.bluez.Device1'. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 668, in _process_message result = handler(msg) File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 746, in _parse_msg condition_callback() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 658, in callback self._properties[device_path][defs.DEVICE_INTERFACE][property_name] KeyError: 'org.bluez.Device1' [2022-08-18 08:38:19] ERROR: A message handler raised an exception: 'org.bluez.Device1'. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 668, in _process_message result = handler(msg) File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 746, in _parse_msg condition_callback() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 658, in callback self._properties[device_path][defs.DEVICE_INTERFACE][property_name] KeyError: 'org.bluez.Device1' [2022-08-18 08:38:19] ERROR: A message handler raised an exception: 'org.bluez.Device1'. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 668, in _process_message result = handler(msg) File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 746, in _parse_msg condition_callback() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 658, in callback self._properties[device_path][defs.DEVICE_INTERFACE][property_name] KeyError: 'org.bluez.Device1'

mjmccans commented 2 years ago

All of that appears to be in Home Assistant Core and not the add-on, although it is interesting that it seeks to bork automatic startup of the add-on. I will do a bit of digging to see if I can find anything else to help, but I cannot seem to reproduce the error. However, the best news that I may have for you is that someone is working on bringing support for Airthings devices to Home Assistant Core using the new bluetooth support. In my mind this is a better option than using my add-on, and if done will render this add-on obsolete. If you are interested you can go here to see the discussion.

peregrines2 commented 2 years ago

Same problem here. Watchdog and Autostart enabled. Very strange :(

mjmccans commented 2 years ago

Apologies for the delay responding. I was away for a while, but more importantly I am holding off making changes to this addon because it looks like support for Airthings devices is likely being brought into Home Assistant Core (see this pull request). I understand that it almost made it into 2022.09 and is currently slated to be included with 2022.10. The addition to Core includes the changes I made to use the new Bleak library, and is a better solution than this addon. For example, it will include device discovery, which is a much better user experience. Fingers crossed it will make it in and this addon will be rendered obsolete.

bobloadmire commented 2 years ago

good news. Is there a temporary work around for now?

mjmccans commented 2 years ago

Unfortunately I have not been able to recreate the issue so I do not have a workaround to suggest. Not sure if this would help, but have you tried uninstalling the addon, perhaps rebooting Home Assistant, and then re-installing the addon? Another option would be to disable the new bluetooth integration to see if that is interfering, but I have it installed and it is not causing an issue on my system. Not great suggestions but I am not sure where things are going off the rails.

bobloadmire commented 1 year ago

Did this make it to 2022.10 release? only seeing the standard cloud integration.

mjmccans commented 1 year ago

It did not make the 2022.10 release (it just missed the deadline), but I believe it will be included in the 2022.11 release. You can see the new integration in the Home Assistant Core git repository at the following: https://github.com/home-assistant/core/tree/dev/homeassistant/components/airthings_ble