Airthings / waveplus-reader

MIT License
133 stars 61 forks source link

Seems to die while trying to get Characteristics #9

Closed cthierman closed 5 years ago

cthierman commented 5 years ago

I figure I must be doing something wrong here, as I would expect most people to have had this problem if it was a problem with the code....

I'm running this on a raspberry Pi 3, running

Linux hallway-pannel 4.14.71-v7+ #1145 SMP Fri Sep 21 15:38:35 BST 2018 armv7l GNU/Linux

with blupy-v-1.2.0. tableprint 0.8.0 python 2.7.13

And yet despite being about 5 feet from the airthings wave Plus, I get the following evertime I run.

python2 read_waveplus.py xxxxxxxxxx 60

Press ctrl+C to exit program

Device serial number: xxxxxxxxxx ╭──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────────╮ │ Humidity │ Radon ST avg │ Radon LT avg │ Temperature │ Pressure │ CO2 level │ VOC level │ ├──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┼──────────────┤ Traceback (most recent call last): File "read_waveplus.py", line 221, in waveplus.connect() File "read_waveplus.py", line 139, in connect self.curr_val_char = self.periph.getCharacteristics(uuid=self.uuid)[0] File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 475, in getCharacteristics rsp = self._getResp('find') File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 377, in _getResp resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout) File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 340, in _waitResp raise BTLEException(BTLEException.COMM_ERROR, "Error from Bluetooth stack (%s)" % errcode) bluepy.btle.BTLEException: Error from Bluetooth stack (comerr) root@hallway-pannel:/home/pi/waveplus-reader#

steoj commented 5 years ago

Looks to me that you have an issue with the Bluetooth LE stack. Sure it is working for you? As the instructions on installation says: In the terminal window on your Raspberry Pi: pi@raspberrypi:~$ bluetoothctl [bluetooth]# power on [bluetooth]# show

What does that give you?

orjangj commented 5 years ago

Hi cthierman,

Since you are failing on getting the characteristic:

self.curr_val_char = self.periph.getCharacteristics(uuid=self.uuid)[0]

and not on the peripheral connection part:

self.periph = Peripheral(self.MacAddr)

I assume that you are at least able to connect to the device. Else, you would fail on self.periph = Peripheral(self.MacAddr).

This might be a dumb question since you've already stated that you are using a Wave Plus device, but are you sure you're not using a Wave instead of a Wave Plus?

I'm not able to reproduce your problem when connecting to Wave Plus devices, but if you're actually using a Wave, then this kind of error would be expected since the uuid's are different on the Wave.

Let me know if this helps.

cthierman commented 5 years ago

Yes, I suspect that is the case, I hadn’t assumed that there would be that difference. I’ll verify once back at home... thanks. Guess if that’s the case screen scraping the dashboard is my only option.

Sent from my iPad

On Feb 26, 2019, at 7:24 AM, orjangj notifications@github.com wrote:

Hi cthierman,

Since you are failing on getting the characteristic:

self.curr_val_char = self.periph.getCharacteristics(uuid=self.uuid)[0]

and not on the peripheral connection part:

self.periph = Peripheral(self.MacAddr)

I assume that you are at least able to connect to the device. Else, you would fail on self.periph = Peripheral(self.MacAddr).

This might be a dumb question since you've already stated that you are using a Wave Plus device, but are you sure you're not using a Wave instead of a Wave Plus?

I'm not able to reproduce your problem when connecting to Wave Plus devices, but if you're actually using a Wave, then this kind of error would be expected since the uuid's are different on the Wave.

Let me know if this helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

orjangj commented 5 years ago

If you haven't noticed already, we have a similar script for interfacing Wave:

https://github.com/Airthings/wave-reader

Also, if your device has a silver/grey lining around the edge, then that would indicate that you have a Wave.

Anyway, let me know if this helps, and I'll mark this issue as solved.

cthierman commented 5 years ago

Thanks, I missed that second version. It works like a charm. Thanks again.

On Tue, Feb 26, 2019 at 1:31 PM orjangj notifications@github.com wrote:

If you haven't noticed already, we have a similar script for interfacing Wave:

https://github.com/Airthings/wave-reader

Also, if your device has a silver/grey lining around the edge, then that would indicate that you have a Wave.

Anyway, let me know if this helps, and I'll mark this issue as solved.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Airthings/waveplus-reader/issues/9#issuecomment-467601553, or mute the thread https://github.com/notifications/unsubscribe-auth/AY-dHOrbnuOdEb0e-h8qKygdX39pIXjjks5vRZmjgaJpZM4bNvL7 .

cthierman commented 5 years ago

Yeah, I actually missed that. It works great thanks.

Sent from my iPad

On Feb 26, 2019, at 1:31 PM, orjangj notifications@github.com wrote:

If you haven't noticed already, we have a similar script for interfacing Wave:

https://github.com/Airthings/wave-reader

Also, if your device has a silver/grey lining around the edge, then that would indicate that you have a Wave.

Anyway, let me know if this helps, and I'll mark this issue as solved.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.