Python App Problems: Computer/Bluetooth Differences?


#1

My simple Python code works on my Orange Pi (with Bluetooth dongle) just fine, but when I try the same code snippet on my Dell Chromebook 11 (user crouton) it does not:

(jessie)darren@localhost:~$ sudo python3
Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ruuvitag_sensor.ruuvi import RuuviTagSensor
>>> import ruuvitag_sensor.log
>>> ruuvitag_sensor.log.enable_console()
>>> timeout_in_sec = 4
>>> macs = ['E4:16:B8:26:17:0B']
>>> datas = RuuviTagSensor.get_data_for_sensors(macs, timeout_in_sec)
Get latest data for sensors. Stop with Ctrl+C.
Stops automatically in 4s
MACs: ['E4:16:B8:26:17:0B']
Start receiving broadcasts (device hci0)
End Of File (EOF). Exception style platform.
Stop receiving broadcasts
>>> print(datas['E4:16:B8:26:17:0B'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'E4:16:B8:26:17:0B'

From what I can tell, the bluetooth H/W on the Chromebook can ‘sense’ my Ruuvitags just fine, but I get that strange ‘EOF’ error while trying to listen to them with Python on the default ‘hci0’ bluetooth device – so no values are read/printed.

Help would be appreciated!


#2

UPDATE: No obvious answer, but it started working on its own – I think increasing the timeout interval helps. Success has now enabled me to build a simple HTML5 DyGraph display panel of the three Ruuvitags that I have i.e. Linux cron calls Python script to extract temp/humi/pres once-per-minute to CSV file, and Dygraph plots those values.