-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unavailable with HA 2022.7 #86
Comments
The full error doesn't really add any additional clarity but here it is:
Seems like it was a poor idea to depend on "bluepy==1.3.0" as that release is 4 years old and no new versions of bluepy have come out since. I do see that bluepy has continued to get updates in master without new releases, so maybe it could work with python 3.10??? |
I will probably get to this but I just moved and do not have time to work on this right now, sorry for the issue. |
I rely on the airthings.py code for my Airthings mqtt script and addon (which can be found here and here). While my projects are not affected by the removal of bluepy in Home Assistant, it strikes me as a good idea to move over to bleak and I started on that work last night. I already have a decent amount of it working, but it is a bit quick and dirty at the moment and I only have a single Airthings Plus device to test on. Either way, I will share my changes if I get it working so everyone can benefit. |
Same issue here after the 2022.07 update. :-( |
While it is a bit messy, if you are interested you can see my first attempt at converting over to bleak here. It is working for me and my scripts except that I have not yet tried to figure out commands, so the battery level is not included. This is my first time using asyncio so I am probably doing some of it (or all of it) wrong, and you may have to adjust the other parts of the custom component call in due to that, but hopefully this helps get things started. I welcome any suggestions and constructive criticism and I will continue to update my repository as I get more things figured out. |
I think I have figured out commands, so the newest version here should also work for battery and illuminance. As cautioned before, there may be a more elegant / correct way to convert to bleak but the changes I have made appear to work for my script and addon. As always, suggestions and constructive criticism are welcome, and it would be get if someone could try this out to see if it works for them. |
I am going to test this, and if it works well, will be a welcome update. Thank you for your efforts mjmccans. It appears I just need to overwrite the original airthings.py with your version. Wish me luck 👍 *edit Clearly more changes need to be made for it to work with this integration. I believe the manifest as well to include bleak. |
You are probably right that the manifest would need to be updated and likely the sensors.py file would need to be updated in a few places to be compatible with asyncio (which is the underlying framework bleak is based on). If I have a moment I will take a look, but I may not have time for a few days. The good news is that I have been running the updated version of my addon that uses bleak for over 2 days now and it has been rock solid. While probably not interesting if you use this custom component, I also like the fact that my addon no longer needs host networking or other elevated permissions because bleak communicates with the hosts dbus instance. Sorry I cannot provide more assistant right now, but hopefully the little bit that I did do gets things moving in the right direction. |
Firstly, amazing work and very glad that someone from the community feels that this component is important enough to dedicate his or her time to make it work. Much like @sverrham , I have limited free time for the foreseeable future so any help from you guys goes a long way. I'll be glad to test and approve PRs once you feel your changes are ready. Thanks again!!! |
I think i fixed my branch... I will continue testing and hopefully create a new pull request tomorrow. In the mean time testing and comments are welcome. https://github.com/B1ob/sensor.airthings_wave/tree/convert_to_bleak |
@B1ob, I have made a small change to the code for identifying Airthings devices while scanning because I don't think I was doing it properly before. Can you please check to see if scanning works for you as well? |
This comment was marked as resolved.
This comment was marked as resolved.
@B1ob with the mac address set in the configuration I get:
When I comment out the mac address in the config file I get:
This is all using the ghcr.io/home-assistant/home-assistant/homeassistant:stable docker image (27874d7ff7d9) on 64 bit arm. I am sure I can get this working but I fear for people with less technical knowledge. |
I am running with your changes now, it seems to work just as before. My device is an Airthings Wave Plus. |
For the record I did get it to work. First I mounted /run/dbus/system_bus_socket inside my container. Secondly I also applied the changes from @mjmccans (mjmccans/airthings-mqtt-ha@a11a0a0) to @B1ob 's branch. I now get the data showing in home assistant. |
I now incorporated the changes from @lymanepp and @mjmccans in my branch. Thanks for the feedback here, maybe you can have a look at the updates again (I tried to change the polling to an Event notification). For me it is now working in Home Assistant Operating System on a RPi4. It is also working with and without a mac specified. So, the discovery (at least for me) is also working. @Gnonthgol you are using this custom-components on a Home Assistant Container? Or what is your environment? Do you see something that i can change to make it working out of the box? https://github.com/B1ob/sensor.airthings_wave/tree/convert_to_bleak Edit: I reopend my pull request again. When i get some positive feedback from the community i will put it in "Ready for review" |
@B1ob I am using the setup at https://www.home-assistant.io/installation/raspberrypi#docker-compose I did have a quick look at bleak and it looks like there is a hard dependency on dbus. It might be possible to run dbus inside the container but that does not sound like a good idea. So I am out of ideas. I support your pull request as it is a huge from improvement, as it actualy have a chance of working. But for now it might be required to document the dbus volume mount in the README. |
@Gnonthgol For what it is worth, mounting the /run/dbus in the container is what I have done, as you can see here. I believe that is how Home Assistant does it for addons as well, because there is an option to mount the host dbus service in the addon (see here) and I use that for the addon version of my script. Given that the Home Assistant developers know a lot more than I do I assume that is the correct way to do it and I agree that any documentation should be updated accordingly. |
@B1ob I made a small suggested change in the PR to the event code to avoid blocking indefinitely if something goes wrong while waiting for the command to return data. Also, no need to add my name to the copyright notice, but if you do want to you can pull my name from the copyright notice in my repository. Thank you. |
I now marked the pull request as ready to review. In my case it is now running fine. And if there are new problems in the future, we can fix them from there on. The main goal for now is to get the custom component working again at all. |
Good stuff! I'll test it this evening, first on 2022.6.x for backwards compatibility, and then in 2022.7.3 |
I want to thank @B1ob again and all of you for making this happen. Without you, this component would have become obsolete. Cheers! |
Thank you @B1ob and @MartyTremblay for your work! Has anyone else encountered this? |
This is a warned issue, but I'll post it anyway. Integration is no longer working after the Home Assistant 2022.7 release, due to lack of support with bluepy.
Platform error sensor.airthings_wave - Integration 'airthings_wave' not found. Platform error sensor.airthings_wave - Requirements for airthings_wave not found: ['bluepy==1.3.0'].
The text was updated successfully, but these errors were encountered: