Skip to content
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

add support for v2 devices #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

silpertan
Copy link

Your airthingswave-mqtt repo was the perfect fit for my use case:

  • home assistant on a computer (VM) with no bluetooth
  • available raspberry pi
  • airthings wave radon detector getting little attention because I didn't buy their hub and their mobile app is very flaky.

Unfortunately, I have a v2 wave. These tweaks got your code working with my v2 device (I don't have a v1 device to verify I didn't break anything). There were three main changes:

  • Added an optional "version" attribute to each wave device in the config file.
  • The v2 device reads all sensor data in a single bluetooth characteristic (UUID).
  • Since get_readings() only took the BT connection handle, it didn't know which wave it was reading from (and hence didn't know whether it was a v1 or v2 device). So I pulled the BT connection code into get_readings() and instead passed in the device index.

I only made the changes I needed (and I copied my changed files into an existing pip install of your package in a virtual environment), so there may be impacts elsewhere in the repo (e.g. README). If you want to take these changes, and feel like this needs more work, I may be able to invest a little more effort (either dev or v2 testing).

Also, I got this running hourly on my raspberry pi with systemd service and timer units. I could write up a description of how I did that - maybe in the wiki?

@hpeyerl
Copy link
Owner

hpeyerl commented Jul 26, 2021

Thanks for your contribution. I'd like to integrate this but I'll need to check against my V1 first. I'll try to find a few minutes this week to get to it.

@hpeyerl
Copy link
Owner

hpeyerl commented Jul 26, 2021

I just remembered @hirofairlane said they have both a V1 and a V2. Maybe they have a chance to test this merge request on both?

@hirofairlane
Copy link

Hi,
Sure, I could test it in my setup anytime you need it.

nevertheless I've been using this other script since a while https://github.com/mjmccans/airthings-mqtt-ha

@hpeyerl
Copy link
Owner

hpeyerl commented Jul 27, 2021

Sure, I could test it in my setup anytime you need it.

Great! How about now? :)

nevertheless I've been using this other script since a while https://github.com/mjmccans/airthings-mqtt-ha

Traitor!

@silpertan
Copy link
Author

I also gave the airthings-mqtt-ha project a try. I recall that I had a problem with a bluetooth dependency. I'm using archlinuxarm which seems to have left behind some deprecated bluetooth tools or libraries. This one worked with what I already had installed from getting the Airthings wave-reader code running.

@hirofairlane
Copy link

hirofairlane commented Jul 27, 2021 via email

@hpeyerl
Copy link
Owner

hpeyerl commented Jul 29, 2021

sorry for being so dumb, but I'm still trying to find the files to updsate the code with the changes from silpertan

Oh. That's ok. From silpertan:master

https://github.com/silpertan/airthingswave-mqtt

@hirofairlane
Copy link

hirofairlane commented Jul 30, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants