IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.58k stars 490 forks source link

getting temperature data #493

Open WSPluta opened 1 year ago

WSPluta commented 1 year ago

I been trying to modify the code as I dont seem to have the temp being captured when I run things52.py --temperature

if I run with

        if args.temperature:
            thingy.environment.enable()
            thingy.environment.configure(temp_int=1000)
            thingy.environment.set_temperature_notification(True)

all i get is

Connected...
LED set to breathe mode...
Enabling selected sensors...
All requested sensors and notifications are enabled...

as a test I modified it to:

        if args.temperature:
            thingy.environment.enable()
            thingy.battery.enable()
            thingy.environment.configure(temp_int=1000)
            thingy.environment.set_temperature_notification(True)
            print("Battery: ", thingy.battery.read())

and now Im getting

Connected...
LED set to breathe mode...
Enabling selected sensors...
Notification: Temp received:  33.5 degCelsius
Battery:  40
All requested sensors and notifications are enabled...

why is that?