core icon indicating copy to clipboard operation
core copied to clipboard

thermostat unavailable after update

Open HandHsince1920 opened this issue 3 years ago • 16 comments

The problem

After update to beta channel first one then after a reboot both thermostats unavailable. I believe this update also brought the bluetooth integration to my system, might be related

What version of Home Assistant Core has the issue?

2022.8.0b4

What was the last working version of Home Assistant Core?

2022.6.7

What type of installation are you running?

Home Assistant OS

Integration causing the issue

EQ3 Bluetooth Smart Thermostats

Link to integration documentation on our website

https://www.home-assistant.io/integrations/eq3btsmart/

Diagnostics information

Logger: homeassistant.components.climate Source: components/eq3btsmart/climate.py:219 Integration: Climate (documentation, issues) First occurred: 15:32:13 (2 occurrences) Last logged: 15:32:14

eq3btsmart: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 477, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 702, in async_device_update await task File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/eq3btsmart/climate.py", line 219, in update self._thermostat.update() File "/usr/local/lib/python3.10/site-packages/eq3bt/eq3btsmart.py", line 217, in update self._conn.make_request(PROP_WRITE_HANDLE, value) File "/usr/local/lib/python3.10/site-packages/eq3bt/bleakconnection.py", line 106, in make_request with self: File "/usr/local/lib/python3.10/site-packages/eq3bt/bleakconnection.py", line 51, in enter self._loop.run_until_complete(self._conn.connect()) File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 107, in connect device = await BleakScannerBlueZDBus.find_device_by_address( File "/usr/local/lib/python3.10/site-packages/bleak/backends/scanner.py", line 221, in find_device_by_address return await cls.find_device_by_filter( File "/usr/local/lib/python3.10/site-packages/bleak/backends/scanner.py", line 250, in find_device_by_filter async with cls(detection_callback=apply_filter, **kwargs): File "/usr/local/lib/python3.10/site-packages/bleak/backends/scanner.py", line 96, in aenter await self.start() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/scanner.py", line 137, in start self._stop = await manager.active_scan( File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 376, in active_scan reply = await self._bus.call( File "/usr/local/lib/python3.10/site-packages/dbus_next/aio/message_bus.py", line 305, in call await future RuntimeError: Task <Task pending name='Task-1797' coro=<BleakClientBlueZDBus.connect() running at /usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py:107> cb=[_run_until_complete_cb() at /usr/local/lib/python3.10/asyncio/base_events.py:184]> got Future <Future pending> attached to a different loop

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

HandHsince1920 avatar Aug 01 '22 15:08 HandHsince1920

Hey there @rytilahti, mind taking a look at this issue as it has been labeled with an integration (eq3btsmart) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

Thanks for the report. I didn't have that problem with my local installation but I have seen that issue on python<3.10. https://github.com/rytilahti/python-eq3bt/pull/58 is potential fix for this, but I'm unsure if it's the correct way to handle it.

rytilahti avatar Aug 01 '22 16:08 rytilahti

I have the same issue 😄 Do you want me to try your potential fix?

TechHummel avatar Aug 03 '22 16:08 TechHummel

Alas, that fix is not likely enough due to how homeassistant os uses bleak, but if you know how to modify your local installation you could try and check it out.

The real solution to make these thermostats available is more involved than I hoped it would be, and therefore I'm not going to promise anything. For the time being you could use some of the available bt to mqtt gateways (e.g., https://github.com/zewelor/bt-mqtt-gateway uses python-eq3bt library to provide support for these devices). I'm terribly sorry for getting your hopes up :-(

rytilahti avatar Aug 03 '22 16:08 rytilahti

Just in case it is important: I am not using homeassistant os (I'm running homeassistant in a docker container on a debian on x86 hardware).

Thanks for your workaround suggestion, looks promising indeed.

TechHummel avatar Aug 03 '22 17:08 TechHummel

Okay, maybe a dockerized system works with that PR, feel free to test and report back at the PR :-)

rytilahti avatar Aug 03 '22 17:08 rytilahti

Okay, maybe a dockerized system works with that PR, feel free to test and report back at the PR :-)

The PR did not help for me running in a docker container using HA 2022.8.0 unfortunately

bvweerd avatar Aug 04 '22 07:08 bvweerd

I just upgraded to the latest version of Hassio on HASS OS and I have had the same issue since the upgrade.

I am on: Home Assistant 2022.8.1 Supervisor 2022.07.0 Operating System 8.4 Frontend 20220802.0

wjarka avatar Aug 07 '22 12:08 wjarka

Alas, that fix is not likely enough due to how homeassistant os uses bleak, but if you know how to modify your local installation you could try and check it out.

The real solution to make these thermostats available is more involved than I hoped it would be, and therefore I'm not going to promise anything. For the time being you could use some of the available bt to mqtt gateways (e.g., https://github.com/zewelor/bt-mqtt-gateway uses python-eq3bt library to provide support for these devices). I'm terribly sorry for getting your hopes up :-(

Oh no, does that mean you are generally giving up on updating the eq3 integration for the current Home Assistant version?

HandHsince1920 avatar Aug 07 '22 12:08 HandHsince1920

Oh no, does that mean you are generally giving up on updating the eq3 integration for the current Home Assistant version?

So the backend library (nor the homeassistant integration) has not been maintained actively by myself for several years. As making it work with the newest release seemed straight-forward from the surface, I thought I'd do a favor and make that happen.

I'm not personally using these thermostats actively, I just have a single thermostat I have kept just in case I need to test something in case someone else contributes pull requests to the project. Unfortunately I don't currently have the time nor energy to work on this, but you can follow https://github.com/rytilahti/python-eq3bt/issues/59 if some progress gets made later on.

rytilahti avatar Aug 16 '22 18:08 rytilahti

@rytilahti , can you check this please - same problem with eq3 integration, but maybe other issue? https://github.com/home-assistant/core/issues/76888 Thanks! Michael

=> EDIT: this is solved!

michapr avatar Aug 17 '22 17:08 michapr

@rytilahti , can you check this please - same problem with eq3 integration, but maybe other issue? #76888 Thanks! Michael

=> EDIT: this is solved!

How can we change docker-compose.yml in HA installed with HA Operating System?

r-jordan avatar Sep 19 '22 15:09 r-jordan

@r-jordan

How can we change docker-compose.yml in HA installed with HA Operating System?

This described issue was docker related.

But the instable connection/ work with thermostat like issues above and https://github.com/hbldh/bleak/issues/946 is still present...

michapr avatar Sep 19 '22 18:09 michapr

Here is what I have in logs:

Logger: homeassistant.components.eq3btsmart.climate
Source: components/eq3btsmart/climate.py:191 
Integration: eq3btsmart (documentation, issues) 
First occurred: 1:13:09 PM (7 occurrences) 
Last logged: 1:15:48 PM

Updating the state failed: Exception on write using bleak
Updating the state failed: unable to connect to device using bleak

wjarka avatar Sep 20 '22 11:09 wjarka

I have this in logs after updating HA OS to 9.0:

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: 12:59:12 (1 occurrences)
Last logged: 12:59:12

Detected integration that attempted to call BleakClient with an address instead of a BLEDevice. Please report issue for eq3btsmart using this method at homeassistant/components/eq3btsmart/climate.py, line 189: self._thermostat.update()
Logger: homeassistant.helpers.entity
Source: components/eq3btsmart/climate.py:189
First occurred: 13:03:44 (2 occurrences)
Last logged: 13:05:44

Update for climate.eq3_salon1 fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 168, in connect
    reply = await self._bus.call(
  File "/usr/local/lib/python3.10/site-packages/dbus_fast/aio/message_bus.py", line 337, in call
    await future
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 718, in async_device_update
    await task
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/eq3btsmart/climate.py", line 189, in update
    self._thermostat.update()
  File "/usr/local/lib/python3.10/site-packages/eq3bt/eq3btsmart.py", line 217, in update
    self._conn.make_request(PROP_WRITE_HANDLE, value)
  File "/usr/local/lib/python3.10/site-packages/eq3bt/bleakconnection.py", line 106, in make_request
    with self:
  File "/usr/local/lib/python3.10/site-packages/eq3bt/bleakconnection.py", line 51, in __enter__
    self._loop.run_until_complete(self._conn.connect())
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 167, in connect
    async with async_timeout.timeout(timeout):
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError
Logger: homeassistant.components.eq3btsmart.climate
Source: components/eq3btsmart/climate.py:191
Integration: eq3btsmart ([documentation](https://www.home-assistant.io/integrations/eq3btsmart), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+eq3btsmart%22))
First occurred: 13:00:52 (20 occurrences)
Last logged: 13:23:07

Updating the state failed: Exception on write using bleak
Updating the state failed: unable to connect to device using bleak

r-jordan avatar Sep 21 '22 10:09 r-jordan

There is a very dirty workaround which kind of works for me. If I define a switch in configuration and send a command to set the temperature thats working for me:

switch: heating: command_on: "eq3cli --mac 00:1a:22:xx:xx:xx temp --target 22" command_off: "eq3cli --mac 00:1a:22:xx:xx:xx temp --target 15"

You a loose a lot of options at setting, logging and modifying temperature but at least you will have a basic turn on/off switch.

As far as I see it the eq3cli script is working however the problem is that the integration is calling bleak with the mac and not with the BLEDevice object. My programming skills are to bad to figure out how to fix that. Maybe my workaround helps somebody.

Pygmaee avatar Sep 22 '22 16:09 Pygmaee

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 23 '22 03:12 github-actions[bot]

See https://github.com/rytilahti/python-eq3bt/issues/70 for a custom component solution, which will hopefully replace the current implementation in the future.

rytilahti avatar Jan 01 '23 18:01 rytilahti

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.