home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.8k stars 30.89k forks source link

Airthings sensor stopped being recognized by BLE integration #94623

Closed sombrero2003 closed 6 months ago

sombrero2003 commented 1 year ago

The problem

Hello, I have been using the Airthings BLE integration ever since it was released and it has been remarkably stable. However, both my sensors have stopped being recognized. The logs read as follows:

2023-06-14 22:59:28.291 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Airthings Wave2 (035828)' for airthings_ble integration not ready yet: Could not find Airthings device with address XXX; Retrying in background
2023-06-14 22:59:28.297 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Airthings Wave+ (137579)' for airthings_ble integration not ready yet: Could not find Airthings device with address XXX; Retrying in background
2023-06-14 23:00:25.528 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Airthings Wave2 (035828)' for airthings_ble integration not ready yet: Could not find Airthings device with address XXX; Retrying in background
2023-06-14 23:00:35.971 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Airthings Wave2 (035828)' for airthings_ble integration not ready yet: Could not find Airthings device with address XXX; Retrying in background

They are properly recognized by the Airthings Android app. I have also tried to remove one of my sensor but it's not detected by the integration if I try to add it back. I have also tried to replace the batteries, no success either. Any idea what could be going on? Thanks a lot.

What version of Home Assistant Core has the issue?

core-2023.6.1

What was the last working version of Home Assistant Core?

some version of core-2023.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Airthings-BLE

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

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

Code owner commands Code owners of `airthings_ble` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign airthings_ble` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


airthings_ble documentation airthings_ble source (message by IssueLinks)

xawill commented 1 year ago

Same here. Restarting the host raspberry pi fixed the issue temporarily but my airthings device sensors now report values erratically (around 40% of the states are « unavailable » over a period of 24h).

peregrines2 commented 1 year ago

same issue here. getting some data points per day ... sensors mostly unavailable.

Obbo99 commented 1 year ago

Very similar issue for me, here's what I think the history is:

Deployed a Wave+ several weeks ago (think I did it without updating the firmware) and found that, occasionally, all entities showed "unavailable". Reloading the integration would be enough to show the entities again and get readings updated, until everything broke again.

Then, I decided to update the firmware on the Wave+ and now have the following symptoms: 2 entities (Illuminance, Pressure) update when the integration is (re-)loaded and then do not receive any updates but DO NOT show unavailable. Other entities update and various length intervals, Radon (2 entities) several hours apart, remaining entities a lot more regularly but also not all of them at the same time.

Some additional information (just in case): I run the following stack: proxmox ubuntu server docker HA The bluetooth is an ASUS BT500 USB dongle

Obbo99 commented 1 year ago

A quick update: After posting the above, I updated HA to the June release (2023.6.2), from being on a May release prior.

Guess what?! The Airthings BLE integration has been all good since, seems that

sombrero2003 commented 1 year ago

Unfortunately this does not fix the issue for me. I tried to remove both of my airthings sensors but they are not being detected anymore. They are registering/updating fine on the airthings app.

On Wed, Jun 21, 2023, 1:07 PM Obbo99 @.***> wrote:

A quick update: After posting the above, I updated HA to the June release (2023.6.2), from being on a May release prior.

Guess what?! The Airthings BLE integration has been all good since, seems that

  • updates are more timely
  • all entities are now reporting in (there were two "Radon level" related entities that hadn't been available at all before this change, even when restarting the integration, and they also reported in - only once in 19 hour but still better than before)

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/94623#issuecomment-1601246227, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2HZ4BXXC5UTRVPKMUR4IU3XMMS57ANCNFSM6AAAAAAZHGVUFY . You are receiving this because you authored the thread.Message ID: @.***>

Obbo99 commented 1 year ago

Unfortunately this does not fix the issue for me. I tried to remove both of my airthings sensors but they are not being detected anymore. They are registering/updating fine on the airthings app.

In the absence of someone else with expertise jumping in, here's my home assistant & home automation / BLE noob 2 cents worth:

I wonder if your problem is one of bluetooth pairing. When I updated the firmware on the airthings device, I initially had a problem getting the mobile phone app to "see" the device (it had previously communicated with it, prior to the home assistant integration). I ended up pulling the Bluetooth USB dongle out of my server and after some more forth and back, eventually the app paired. You may be seeing the reverse, that there's another device holding the bluetooth connection "slot" on the airthings occupied so home assistant can't grab it.

When releasing the airthings wave+ from the phone, I think to recall that I had some issues to get home assistant to see it again, I may have ended up rebooting the server after switching bluetooth off completely on my phone. I assume you've already gone through the HA server reboot.

Here's another check you could run: Do you have a second smartphone you could install the airthings app on? If it can successfully connect to and manage the airthings device, its a strong indicator that the problem is within your home assistant server. If the second smartphone can't ... well, then something else grabbed the wave+

sombrero2003 commented 1 year ago

Thanks. That's very helpful. I removed the airthings app from my phone and rebooted the home assistant host. Magic, both sensors are now detected. I just changed my phone and I suspect it is indeed holding the connection slot unlike my old phone. I much prefer the ha integration to the app so I am fine with this solution. Thanks a lot. This is such a great community

On Wed, Jun 21, 2023, 3:31 PM Obbo99 @.***> wrote:

Unfortunately this does not fix the issue for me. I tried to remove both of my airthings sensors but they are not being detected anymore. They are registering/updating fine on the airthings app.

In the absence of someone else with expertise jumping in, here's my home assistant & home automation / BLE noob 2 cents worth:

I wonder if your problem is one of bluetooth pairing. When I updated the firmware on the airthings device, I initially had a problem getting the mobile phone app to "see" the device (it had previously communicated with it, prior to the home assistant integration). I ended up pulling the Bluetooth USB dongle out of my server and after some more forth and back, eventually the app paired. You may be seeing the reverse, that there's another device holding the bluetooth connection "slot" on the airthings occupied so home assistant can't grab it.

When releasing the airthings wave+ from the phone, I think to recall that I had some issues to get home assistant to see it again, I may have ended up rebooting the server after switching bluetooth off completely on my phone. I assume you've already gone through the HA server reboot.

Here's another check you could run: Do you have a second smartphone you could install the airthings app on? If it can successfully connect to and manage the airthings device, its a strong indicator that the problem is within your home assistant server. If the second smartphone can't ... well, then something else grabbed the wave+

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/94623#issuecomment-1601556863, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2HZ4BT54VCWLPVK2P3GTUDXMNDXNANCNFSM6AAAAAAZHGVUFY . You are receiving this because you authored the thread.Message ID: @.***>

sombrero2003 commented 1 year ago

Issue has been resolved by removing Airthings app from Android phone (Samsung S23)

Obbo99 commented 1 year ago

Thanks. That's very helpful. I removed the airthings app from my phone and rebooted the home assistant host. Magic, both sensors are now detected. I just changed my phone and I suspect it is indeed holding the connection slot unlike my old phone. I much prefer the ha integration to the app so I am fine with this solution. Thanks a lot. This is such a great community

Happy this worked for you and appreciate the feedback. For completeness sake and anyone who comes by here in the future:

I think any of the following would have given you the same result (allowed the HA airthings BLE integration to re-acquire the device via bluetooth):

  1. Disable bluetooth on the phone
  2. Shut the phone off
  3. Place the phone into flight mode

That said, removing the app from the phone eliminates the risk of these two different apps contending for the airthings device in the future. You'll just need to reinstall it occasionally for firmware updates.

carloslema commented 1 year ago

Hi there. Updating HA to 2023.6.3, disabling/shutting down phone, or deleting App from iOS does not solve HA integration with multiple Airthings Wave+ and defeats the point of having HA. After full reboot or soft-restart, AW+ devices show up temporarily, but they disconnect after 1-2mins. Loaded up my back up with Supervisor 2023.06.2 HAOS 10.2 where I know it was working reliably and flawlessly — but, it is not working anymore. Very frustrating.

Well, it looks like another device (Tacx Neo) is hugging the BLE IDs and causing all sort of havoc in HA.

phildespres commented 1 year ago

Same problem here with multiple devices: spotty measurements since upgrade to 2023.06. Was working A1 before. Removing phone app did nothing to restore the previous behavior. Some log info:

2023-06-29 16:36:09.108 ERROR (MainThread) [homeassistant.components.airthings_ble] Error fetching airthings_ble data: Unable to fetch data: D8:71:4D:AA:XX:XX - D8:71:4D:AA:XX;XX: Failed to connect: No backend with an available connection slot that can reach address D8:71:4D:AA:XX;XX was found: The proxy/adapter is out of connection slots; Add additional proxies near this device

stephane-j commented 1 year ago

I have the same problem since 2023.6. Nothing else has changed. Using Docker container and before it worked flawlessly. Same issue with the application uninstalled or bluetooth disabled on my iPhone. It was working well using both HA and the mobile app before 2023.6.

Logger: homeassistant.components.airthings_ble
Source: helpers/update_coordinator.py:229
Integration: Airthings BLE ([documentation](https://www.home-assistant.io/integrations/airthings_ble), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+airthings_ble%22))
First occurred: 25 juin 2023 à 21:43:19 (173 occurrences)
Last logged: 08:34:25

Error fetching airthings_ble data: Unable to fetch data: 'NoneType' object has no attribute 'address'
Error fetching airthings_ble data: Unable to fetch data: D8:71:4D:B9:XX:XX - D8:71:4D:B9:XX:XX: Failed to connect: No backend with an available connection slot that can reach address D8:71:4D:B9:XX:XX was found: The proxy/adapter is out of connection slots; Add additional proxies near this device
Error fetching airthings_ble data: Unable to fetch data: D8:71:4D:B9:XX:XX - D8:71:4D:B9:XX:XX: Failed to connect: 

Also:

Logger: bluetooth_auto_recovery.recover
Source: components/bluetooth/util.py:78
First occurred: 25 juin 2023 à 23:20:28 (33 occurrences)
Last logged: 29 juin 2023 à 19:32:10

    Getting Bluetooth adapter failed hci0 [48:F1:7F:XX:XX:XX] because the system cannot create a bluetooth socket: Unable to open PF_BLUETOOTH socket
    Could not find adapter with mac address 48:F1:7F:XX:XX:XX or hci0
    Closing Bluetooth adapter hci0 [48:F1:7F:XX:XX:XX] failed: 'NoneType' object has no attribute 'detach'
schettada commented 1 year ago

Same issue here with airthings with an iPhone. even after removing the app from the phone.

Logger: homeassistant.components.airthings_ble
Source: helpers/update_coordinator.py:229
Integration: Airthings BLE (documentation, issues)
First occurred: 8:59:33 PM (1 occurrences)
Last logged: 8:59:33 PM

Error fetching airthings_ble data: Unable to fetch data: 'NoneType' object has no attribute 'address'
Logger: homeassistant.config_entries
Source: config_entries.py:432
First occurred: 8:49:05 PM (1 occurrences)
Last logged: 8:49:05 PM

Config entry 'Airthings Wave2 (064741)' for airthings_ble integration not ready yet: Unable to fetch data: F4:60:77:76:06:C0 - F4:60:77:76:06:C0: Failed to connect: No backend with an available connection slot that can reach address F4:60:77:76:06:C0 was found: The proxy/adapter is out of connection slots; Add additional proxies near this device; Retrying in background
robthebold commented 1 year ago

Same issue here, too. Never had the "app." Don't own a device that can "app." So probably not the "app."

larsar commented 1 year ago

My two Airthing Wave devices also stopped working in HA a while back. I have tested with the device close by my HA server and also tried to have it close to a proxy (esp32). (Removing the integration and re-adding it has no effect. The devices are discovered, but initialization fails.)

2023-07-07 01:58:56.665 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Airthings Wave+ (0044XX)’ for airthings_ble integration not ready yet: Unable to fetch data: C4:64:XX:XX:XX:XX - C4:64:XX:XX:XX:XX: Failed to connect: ; Retrying in background

2023-07-07 01:58:56.668 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Airthings Wave2 (0008XX)’ for airthings_ble integration not ready yet: Unable to fetch data: E0:7D:XX:XX:XX:XX - E0:7D:XX:XX:XX:XX: Failed to connect: ; Retrying in background

carloslema commented 1 year ago

Well, last night I reloaded an old back up with HA Core 2023.3.3 and OS 10.2. I know this was working perfectly for a long stretch — AW+ controlled ERVs and dehumidifiers flawlessly, happy times. I dreaded this, but I might have to go a clean slate and rebuild. Digging up my old Raspi 4 to see if it works as it did, test 2023.7.1 before fiddling with the NUC's SSD.

phildespres commented 1 year ago

I moved my Airthings devices from the bluetooth services of my RPI 4 to ESPHome devices and this is working fine. The problem seems to be with BT on the RPI.

carloslema commented 1 year ago

@phildespres Great to hear the news. How did you that? Did you use the bluetooth_proxy in ESPHome?

robthebold commented 1 year ago

I moved my Airthings devices from the bluetooth services of my RPI 4 to ESPHome devices and this is working fine. The problem seems to be with BT on the RPI.

Nope. It's not the Pi. Unless all the Pi's had a suicide pact . . . maybe . . . spooky . . .

carloslema commented 1 year ago

@robthebold it might be contagious, because my NUC has the same issue.

MarcAnt1 commented 1 year ago

Hi,

To add to this issue I have a brand new Airthing Wave Plus, configured in the App.

When I want to add the device via the UI using "Airthing BLE" i'm getting: "Error: Config flow could not be loaded: Unknow error".

I'm running Proxmox VM HA 2023.7.3 Supervisor: 2023.7.1 OS: 10.3

My bluetooth is working with others devices.

Obbo99 commented 1 year ago

Just an update on how things have been going for me:

Following what seemed to be an initial success in getting this stabilized by upgrading to a more recent HA release, I have seen the same problems return, seemingly at random. Sometimes the integration works for several days in a row, other days, a daily reset, sometimes twice in a day, is required. For this, I walk up to the system hosting HA, pull and re-insert the ASUS BT500 bluetooth usb dongle and shortly thereafter, life is good again... at least for a while.

Seems that the path forward to having a more stable solution is to move this to using an ESPHome based communication path instead. Regrettably, I don't have any ESPHome / wifi devices that home assistant uses. This is for various reasons, one of them being that the server that hosts HA doesn't have access to my wifi network (the only WIFI interface reachable for the HA server is the Wifi's WAN interface so I might have to do some port forwarding - but that's for a different forum to seek help in, if I end up needing it).

robthebold commented 1 year ago

I updated to HA 2023.08.1 last night. Airthings hasn't flaked out yet and it's been 17 hours. Previously, the integration would go off in the weeds multiple times a day and I'd have to go into settings and click "Reload" on the "three-dots" menu. I was about to investigate if automating the reload process was possible.

And edit . . . just after I wrote that the integration crapped out. Reloaded and it's back in action . . . for now.

carloslema commented 1 year ago

I quick update, looked into @phildespres comment of using ESPHome proxy. It has been 3 days, and HA still processing AW+ BLE data. I added these two lines at the bottom of two of my ESPHome's configurations:

bluetooth_proxy: active: true

schettada commented 1 year ago

This error is back by using esphome bluetooth proxy as well.

Logger: homeassistant.components.sensor Source: helpers/entity_registry.py:904 Integration: Sensor (documentation, issues) First occurred: 7:59:43 AM (1 occurrences) Last logged: 7:59:43 AM

Error while setting up airthings_ble platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform await asyncio.shield(task) File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 184, in async_setup_entry async_migrate(hass, coordinator.data.address, sensor_type) File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 150, in async_migrate ent_reg.async_update_entity(entity_id=entity_id, new_unique_id=new_unique_id) File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 958, in async_update_entity return self._async_update_entity( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 904, in _async_update_entity raise ValueError( ValueError: Unique id 'F4:60:77:76:06:C0_humidity' is already in use by 'sensor.airthings_wave2_064741_humidity'

If i delete and re-add the integration, it works, but the moment i reboot my HA server for any reason, it starts throwing this error.

schettada commented 1 year ago

Seems to have started with HA 2023.09 release. I have been using with esphome bluetooth proxy for 1.5 months without any issues.

LaStrada commented 1 year ago

This error is back by using esphome bluetooth proxy as well.

Logger: homeassistant.components.sensor

Source: helpers/entity_registry.py:904

Integration: Sensor (documentation, issues)

First occurred: 7:59:43 AM (1 occurrences)

Last logged: 7:59:43 AM

Error while setting up airthings_ble platform for sensor

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform

await asyncio.shield(task)

File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 184, in async_setup_entry

async_migrate(hass, coordinator.data.address, sensor_type)

File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 150, in async_migrate

ent_reg.async_update_entity(entity_id=entity_id, new_unique_id=new_unique_id)

File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 958, in async_update_entity

return self._async_update_entity(

       ^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 904, in _async_update_entity

raise ValueError(

ValueError: Unique id 'F4:60:77:76:06:C0_humidity' is already in use by 'sensor.airthings_wave2_064741_humidity'

If i delete and re-add the integration, it works, but the moment i reboot my HA server for any reason, it starts throwing this error.

Not the same issue, but will be fixed in 2023.9.3.

xawill commented 1 year ago

2023.9 greatly improves the situation on my side. I am not using esphome.

fredriklj commented 1 year ago

Seems to have started with HA 2023.09 release. I have been using with esphome bluetooth proxy for 1.5 months without any issues.

Same issue here after upgrade. Been working for months before that.

LaStrada commented 1 year ago

As I mentioned above, the issues should be fixed in 2023.9.3. Or if you want to wait, the 2023.10 will be released tomorrow (no changes to Airthings BLE compared to the 2023.9.3 release).

fredriklj commented 1 year ago

Sorry, forgot to mention I already run 2023.9.3. The clues I am getting from the debug logging is this:

2023-10-03 16:13:37.444 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: airthings_ble
2023-10-03 16:13:38.389 DEBUG (MainThread) [homeassistant.components.airthings_ble] Characteristics not handled: 00002a29-0000-...
2023-10-03 16:13:39.316 DEBUG (MainThread) [homeassistant.components.airthings_ble] Finished fetching airthings_ble data in 6.264 seconds (success: True)
2023-10-03 16:13:39.320 DEBUG (MainThread) [homeassistant.components.airthings_ble.sensor] got sensors: {'humidity': xx, 'radon_1day_avg': xx, 'radon_longterm_avg': xx, 'temperature': xx, 'co2': xx, 'voc': xx, 'radon_1day_level': 'xx', 'radon_longterm_level': 'xx', 'pressure': xx, 'illuminance': xx, 'battery': xx}
2023-10-03 16:13:39.321 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up airthings_ble platform for sensor
  File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 185, in async_setup_entry
  File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 151, in async_migrate
2023-10-03 16:13:40.851 DEBUG (MainThread) [homeassistant.components.airthings_ble] Characteristics not handled: 00002a29-0000-1000-8000-00805f9b34fb
2023-10-03 16:13:41.809 DEBUG (MainThread) [homeassistant.components.airthings_ble] Finished fetching airthings_ble data in 8.756 seconds (success: True)
2023-10-03 16:13:41.834 DEBUG (MainThread) [homeassistant.components.airthings_ble.sensor] got sensors: {'humidity': xx, 'radon_1day_avg': xx, 'radon_longterm_avg': xx, 'temperature': xx, 'co2': xx, 'voc': xx, 'pressure': xx, 'illuminance': xx, 'battery': xx}
2023-10-03 16:13:41.845 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up airthings_ble platform for sensor
  File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 185, in async_setup_entry
  File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 151, in async_migrate
2023-10-03 16:13:42.475 DEBUG (MainThread) [homeassistant.components.airthings_ble.config_flow] Discovered BT device: <home_assistant_bluetooth.models.BluetoothServiceInfoBleak object at 0x7f5bb5f12f40>
2023-10-03 16:13:42.512 DEBUG (MainThread) [homeassistant.components.airthings_ble.config_flow] Discovered BT device: <home_assistant_bluetooth.models.BluetoothServiceInfoBleak object at 0x7f5bb5f12fc0>

Note, I have two devices. And I do get readings from them, but somehow the setup of the platform fails.

I should also add that once I upgraded to 2023.9.3, I had to reverse back to 2023.8.3 due to another integration failing (not related to this issue). Considering there is "migrate" function here, possibly going back and forth between versions may have caused the issue?

LaStrada commented 1 year ago

Sorry, forgot to mention I already run 2023.9.3. The clues I am getting from the debug logging is this:

2023-10-03 16:13:37.444 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: airthings_ble
2023-10-03 16:13:38.389 DEBUG (MainThread) [homeassistant.components.airthings_ble] Characteristics not handled: 00002a29-0000-...
2023-10-03 16:13:39.316 DEBUG (MainThread) [homeassistant.components.airthings_ble] Finished fetching airthings_ble data in 6.264 seconds (success: True)
2023-10-03 16:13:39.320 DEBUG (MainThread) [homeassistant.components.airthings_ble.sensor] got sensors: {'humidity': xx, 'radon_1day_avg': xx, 'radon_longterm_avg': xx, 'temperature': xx, 'co2': xx, 'voc': xx, 'radon_1day_level': 'xx', 'radon_longterm_level': 'xx', 'pressure': xx, 'illuminance': xx, 'battery': xx}
2023-10-03 16:13:39.321 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up airthings_ble platform for sensor
  File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 185, in async_setup_entry
  File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 151, in async_migrate
2023-10-03 16:13:40.851 DEBUG (MainThread) [homeassistant.components.airthings_ble] Characteristics not handled: 00002a29-0000-1000-8000-00805f9b34fb
2023-10-03 16:13:41.809 DEBUG (MainThread) [homeassistant.components.airthings_ble] Finished fetching airthings_ble data in 8.756 seconds (success: True)
2023-10-03 16:13:41.834 DEBUG (MainThread) [homeassistant.components.airthings_ble.sensor] got sensors: {'humidity': xx, 'radon_1day_avg': xx, 'radon_longterm_avg': xx, 'temperature': xx, 'co2': xx, 'voc': xx, 'pressure': xx, 'illuminance': xx, 'battery': xx}
2023-10-03 16:13:41.845 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up airthings_ble platform for sensor
  File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 185, in async_setup_entry
  File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 151, in async_migrate
2023-10-03 16:13:42.475 DEBUG (MainThread) [homeassistant.components.airthings_ble.config_flow] Discovered BT device: <home_assistant_bluetooth.models.BluetoothServiceInfoBleak object at 0x7f5bb5f12f40>
2023-10-03 16:13:42.512 DEBUG (MainThread) [homeassistant.components.airthings_ble.config_flow] Discovered BT device: <home_assistant_bluetooth.models.BluetoothServiceInfoBleak object at 0x7f5bb5f12fc0>

Note, I have two devices. And I do get readings from them, but somehow the setup of the platform fails.

I should also add that once I upgraded to 2023.9.3, I had to reverse back to 2023.8.3 due to another integration failing (not related to this issue). Considering there is "migrate" function here, possibly going back and forth between versions may have caused the issue?

That's a bit different error message 🤔 The previous error was for example:

ValueError: Unique id 'xx:xx:xx:xx:xx:xx_humidity' is already in use by 'sensor.airthings_wave2_xxxxxx_humidity'

Not sure what happened in your case, but as you mentioned, it might be the issue that you rolled back to 2023.8.3 and then back to 2023.9.x. Will keep an eye on it 👀

fredriklj commented 1 year ago

Not sure what happened in your case, but as you mentioned, it might be the issue that you rolled back to 2023.8.3 and then back to 2023.9.x. Will keep an eye on it 👀

Any suggestions for a work-around in the meantime? It seems odd I do not get what is causing the error, only "line 151, in async_migrate". Could it be as easy as commenting out this call in line 185?

Btw, line 151 is:

ent_reg.async_update_entity(entity_id=entity_id, new_unique_id=new_unique_id)
LaStrada commented 1 year ago

Not sure what happened in your case, but as you mentioned, it might be the issue that you rolled back to 2023.8.3 and then back to 2023.9.x. Will keep an eye on it 👀

Any suggestions for a work-around in the meantime? It seems odd I do not get what is causing the error, only "line 151, in async_migrate". Could it be as easy as commenting out this call in line 185?

Btw, line 151 is:

ent_reg.async_update_entity(entity_id=entity_id, new_unique_id=new_unique_id)

If a restart of Home Assistant doesn't help, you can try to remove the devices that fails and add them again.

I will try to reproduce this issue by downgrade and then upgrade, as you did, to see if I will have the same issues.

fredriklj commented 1 year ago

I have attempted restarts, but not adding/removing the entities since I am careful not to ruin the history. I tried commenting out line 185, and I think it works as expected. I do get some timeouts, which I haven't noticed before, but might be normal.

LaStrada commented 1 year ago

Yeah, don't remove the devices if you care about the history. Timeouts shouldn't be related to this code.

You can comment out everything inside async_migrate (line 122-152) or

async_migrate(hass, coordinator.data.address, sensor_type)

on line 185. This code is only relevant for people migrating from old unique id to new one.

fredriklj commented 1 year ago

Thanks, looks like it is working with line 185 commented out. This solves the immediate problems, but will be a pain to maintain as even a restart of the container will reset the code back to its original state.

Obbo99 commented 11 months ago

Since I wasn't able to get this working with the BLE integration, I finally ordered some ESP32 boards and set up ESPHome. I'm not using the bluetooth proxy (couldn't figure out how to set this up) but using the native Airthings support in ESPHome.

I'm running HA in Docker under Ubuntu Server VM under Proxmox. Setting this up wasn't such a big deal had to install ESPHome in a container. There were some bumps in the road:

  1. Initially flashing the ESP32 device using a web browser instead of the HA server: Had to download and install a chipset driver so that my Windows 11 system could recognize and talk to the chip onboard the ESP32 board. I wasted a fair amount of time on this as I didn't understand that the browser should list the ESP32 device explicitly instead of only a generic COM1 port that I saw. Found this site to be very helpful: Random Nerd Tutorials
  2. After the initial programming, Home Assistant could see the device but I couldn’t manage it over the air from the ESPHome dashboard. I found good advice in this Home Assistant Community Post In short, changes I made was to ensure that local DNS could successfully resolve .localhost and that I could ping it by name from the host running the ESPHome dashboard. I also added the environment variable ESPHOME_DASHBOARD_USE_PING="true" to the ESPHome docker container.
  3. I had to get issue 2 resolved so I could see the logging from the ESP32 device in the ESPHome dashboard to complete the configuration for it to talk to the Airthings device. The steps for making airthings work are at https://esphome.io/components/sensor/airthings_ble.html?highlight=airthings

It's been running for a day, so far, no disconnects.

Remaining issues at this point: The ESPHome airthings integration doesn't seem to currently support the ambient light / illumination reading from the airthings wave plus. I can see it in the sensor log but I can't figure out how to get it sent to Home Assistant. I noticed several stale feature requests for ESPHome to support this, but haven't been able to confirm if this was done and how to use it within the ESP32 board yaml programming.

Obbo99 commented 10 months ago

Since I wasn't able to get this working with the BLE integration, I finally ordered some ESP32 boards and set up ESPHome. I'm not using the bluetooth proxy (couldn't figure out how to set this up) but using the native Airthings support in ESPHome.

[... deleted ...] It's been running for a day, so far, no disconnects.

So far, no stability issues, while, at the same time, the BLE integration had several disconnects. The ESP32 approach certainly seems to be the way to go. :)

jonbosche commented 9 months ago

My BLE seems to be hosed on the latest OS and Core: Core 2024.1.6 Supervisor 2023.12.1 Operating System 11.4 Frontend 20240104.0

I'm getting non-sensical readings in the dashboard for Radon levels and it's really screwing with the mitigation system I have put in place.

Is the general consensus to remove and re-add Airthings to see if that resolves the issue?

LaStrada commented 9 months ago

My BLE seems to be hosed on the latest OS and Core: Core 2024.1.6 Supervisor 2023.12.1 Operating System 11.4 Frontend 20240104.0

I'm getting non-sensical readings in the dashboard for Radon levels and it's really screwing with the mitigation system I have put in place.

Is the general consensus to remove and re-add Airthings to see if that resolves the issue?

That's an unrelated issue, and is fixed in the latest 2024.2.0b2 beta: https://github.com/home-assistant/core/releases/tag/2024.2.0b2

Edit: I recommend rolling back to 2024.1.5 and wait for 2024.2.0 (or of course test out the beta)

jonbosche commented 9 months ago

hey that's great! appreciate the airthings team continuing to support their product.

On Thu, Feb 1, 2024 at 4:51 PM Ståle Storø Hauknes @.***> wrote:

My BLE seems to be hosed on the latest OS and Core: Core 2024.1.6 Supervisor 2023.12.1 Operating System 11.4 Frontend 20240104.0

I'm getting non-sensical readings in the dashboard for Radon levels and it's really screwing with the mitigation system I have put in place.

Is the general consensus to remove and re-add Airthings to see if that resolves the issue?

That's an unrelated issue, and is fixed in the latest 2024.2.0b2 beta: https://github.com/home-assistant/core/releases/tag/2024.2.0b2

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/94623#issuecomment-1922429820, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7TXC7JQ44XW26V7GJ2UK2LYRQMAJAVCNFSM6AAAAAAZHGVUF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRSGQZDSOBSGA . You are receiving this because you commented.Message ID: @.***>

ndehling commented 9 months ago

Hi, I experience the same issue as @jonbosche. Any pointers on how to roll back the 2024.1.5 version? Thanks,

issue-triage-workflows[bot] commented 6 months ago

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.