Open carsonb opened 2 years ago
Nice!
Tried the instruction above: ERROR (MainThread) [custom_components.airthings_ble.config_flow] Unknown error occurred from B0:91:xx:xx:xx:xx: 'date_time'
Logger: custom_components.airthings_ble.config_flow Source: custom_components/airthings_ble/config_flow.py:92 Integration: airthings_ble First occurred: 21:40:03 (2 occurrences) Last logged: 21:40:25
Was it added to 2022.9 ? Is there a HACS module ?
It looks like it didn't make it into 2022.9.
No it didn't. It was very close, but some of the HA developers wanted to wait until we had better UX for the case where there are 2 integrations for the same devices. We pushed for an approach that shouldn't cause @vincegio too much extra hassle, so I hope this is only a minor blip and we can get it in next month.
RE HACS - Personally, I would try and get code review done before publishing anything standalone, in case we do end up needing to make breaking changes to the unique identifiers or the config entry data. When those things go wrong it can make a bit of a mess (i've had to hand edit JSON to repair this sort of thing before). If people want to take that risk for themselves, they can grab the code from the branch. Its still fairly easy, but they will be more aware that if it breaks they get to keep the pieces.
bummer. I decided to wait for it to get 2022.9 but now I am seriously considering grabbing the code. Thanks for the update
I am currently getting this error after updating to 2022.9
Logger: homeassistant.util.package Source: util/package.py:98 First occurred: 23.05.03 (3 occurrences) Last logged: 23.05.17
Unable to install package airthings-ble==0.5.0: ERROR: Cannot install airthings-ble==0.5.0 because these package versions have conflicting dependencies. ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
Just updated HA to v2022.9.0
and experienced the same error in logs for the airthings_ble
component (latest version from master).
@vincegio any idea on what this could be? I see that airthings-ble module is available from pypi.
022-09-08 13:26:11.503 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration airthings_ble: Requirements for airthings_ble not found: ['airthings-ble==0.5.0'].
homeassistant.requirements.RequirementsNotFound: Requirements for airthings_ble not found: ['airthings-ble==0.5.0']
It might be bleak again, new ha version seems to use 0.16
Sort of. airthings-ble
follows the other HA bluetooth projects in using poetry
instead of pip
. And when you add a dependency to your project in comes out looking like this in pyproject.toml
:
bleak = "^0.15.1"
bleak-retry-connector = "^1.8.0"
The ^
is signficant. If memory serves, this says airthings-ble works with 0.15.1, 0.15.2, 0.15.whatever, but NOT 0.16. Same applies to bleak-retry-connector
.
@vincegio could swap the ^
for a >=
which means "or any later version". Thats what I do in xiaomi_ble and homekit_controller.
I'll try to do some updates asap. As well with getting the PR reviews completed.
I'll think about making a hacs component, but could also include some kind of warning about it.
I have temporarily solved it, by merging the airthings-ble files from https://github.com/vincegio/airthings-ble into the custom_components/airthings_ble folder and removed the dependency on airthings-ble in the manifest.json file.
For those who have copied the component manually, head on over to the manifest and update:
"requirements": ["airthings-ble==0.5.1"],
Thanks @vincegio! Just of curiosity, why did you extract parser
and constants
in separate python module, in stead of keeping it together with the airthings_ble
component in HA core?
It's a hard HA rule.
I had to do it for one of my integrations where I made like one HTTP get and decode JSON to a dict.
Although tedious in more extreme cases, the point is that integrations are meant to be about data mapping/translation, and your library is meant to do all the hard stuff talking to the device.
Alright, that makes sense!
Is there any progress with this?
I'm still getting same error in
Home Assistant 2022.9.6 Supervisor 2022.09.1 Operating System 9.0 Frontend 20220907.2 - latest
@vincegio's PR was merged. It looks like it just missed the beta cut off. I'd ask for a backport but there are a few more tweaks requested on it. So as it stands it'll be in 2022.11.
I just updated HA to 2022.10.3, and I can't get HA to start with airthings_wave. That is because HA comes with bleak==0.18.1
If I change airthings_wave/manifest.txt to make bleak that version, it reports an error:
Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: 8:33:59 PM (1 occurrences)
Last logged: 8:33:59 PM
Detected integration that attempted to call BleakClient with an address instead of a BLEDevice.
Please report issue to the custom integration author for airthings_wave using this method at
custom_components/airthings_wave/airthings.py, line 238: self._dev = BleakClient(mac.lower())
I think it is an API change in bleak, and HA has the new call, while airthings_wave is using an old call.
What can one do now?
@kbahey a "new"/ported airthings integration is on path of getting released as part of 2022.11. until that happens you need to roll back to a HA version that supports this component.
Thanks for the reply.
In the meantime, for others who can't wait ... I found a standalone solution that works provided that you have MQTT running (which I do).
It is airthings-mqtt-ha.
Install paho-mqtt and bleak using pip3, run the above Python script once to generate a configuration file, edit the file to your liking, then run it again as a daemon.
Add MQTT sensors for each item that is returned by the AirThings Wave Plus, and you are done.
@kbahey a "new"/ported airthings integration is on path of getting released as part of 2022.11. until that happens you need to roll back to a HA version that supports this component.
@DavidS What is the estimated release date for 2022.11?
The new built-in integration is working great in 2022.11!
Thanks for all the hard work!
I have moved from my addon to the new integration and it is working well. The auto-discovery is also fantastic from a user experience perspective. Thank you for all the work getting this into Core.
The only minor gripe that I have is rounding (or lack thereof) of the sensor values. Given the sensors in the device my personal preference from a significant digits perspective (and what my addon did) is to round all of the values to not include any decimals except for the temperature that I would round to one decimal point. I am not sure if anyone else agrees, but for now I have just added some template sensors that do the rounding in my configuration file.
Thanks for new improved integration. However, I still have some issues...
The new Airthing BLE intergrations finds my Airthings wave plus immediately and starts showing values from the device. After a few minutes, Home Assistant stops showing any values and and connection is lost. "Entity is unavailable" placeholder remains until I reboot the server os reinstall the integration.
I checked from the terminal using bluetootctl scan that device is broadcasting information all the time. For some reason (unknown to me) it just does not work.
Log entry:
Unable to fetch data: [MAC address]. Failed to connect, device was not found, It may have been removed from BlueZ when scanning stopped.
Error fetching airthings_ble data: Unable to fetch data: 'NoneType' object has no attribute 'address'
Any ideas whats going wrong here?
The right place to get help with integrations in HA Core is the HA GitHub. But that error suggests to me that it's actually outside the range of your bluetooth. Range in bluetooth is asymmetric - you can have enough signal to see some advertisements, but it be too weak for 2-way communication, which makes using bluetoothctl to debug this challenging. What sort of RSSI can you see in the bluetoothctl output you mention?
@Jc2k
I need to investigate more thoroughly when I get home and check the RSSI levels. The direct distance is very short between RPI and Airthings wave but they are located in different floors. I have ESP32s scattered around the building also, maybe I can use one of them to communicate with AirThings?
It looks like 2022.8 has updated to bleak 0.15.0 https://github.com/home-assistant/core/pull/75941
When trying to use 4.0.0 of sensor.airthings_wave I get the following error in the logs: