citruz / beacontools

A Python beacon scanning library.
MIT License
158 stars 59 forks source link

Question - EddystoneTLMFrame Temperature #29

Closed MaximGo closed 5 years ago

MaximGo commented 5 years ago

Hi,

I use beacontools for the Eddystone TLM protocol. During a test with an Estimote-Beacon I noticed the following output:

That's my code to scan the beacons:

import time
from beacontools import BeaconScanner, EddystoneTLMFrame, EddystoneFilter, EddystoneUIDFrame, parse_packet

def callback(bt_addr, rssi, packet, additional_info):    
    print(packet)

# scan for all TLM frames of beacons
scanner = BeaconScanner(callback, 
    device_filter=EddystoneFilter(namespace="edd1ebeac04e5defa123"),
    packet_filter=[EddystoneTLMFrame]
)

scanner.start()

time.sleep(10)
scanner.stop()

And this is the output:

EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855911, seconds since boot: 430306518>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 49174 Celsius, advertising count: 14855912, seconds since boot: 430306521>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855913, seconds since boot: 430306524>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855915, seconds since boot: 430306530>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855916, seconds since boot: 430306533>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 23 Celsius, advertising count: 14855918, seconds since boot: 430306539>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855920, seconds since boot: 430306545>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855921, seconds since boot: 430306549>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855922, seconds since boot: 430306552>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855925, seconds since boot: 430306561>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 49174 Celsius, advertising count: 14855928, seconds since boot: 430306570>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855929, seconds since boot: 430306573>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855930, seconds since boot: 430306576>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855931, seconds since boot: 430306579>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855932, seconds since boot: 430306582>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855933, seconds since boot: 430306585>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 49174 Celsius, advertising count: 14855934, seconds since boot: 430306588>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 49174 Celsius, advertising count: 14855935, seconds since boot: 430306592>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 49174 Celsius, advertising count: 14855936, seconds since boot: 430306595>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855937, seconds since boot: 430306598>
EddystoneTLMFrame<voltage: 2956 mV, temperature: 32790 Celsius, advertising count: 14855938, seconds since boot: 430306601>

What's the value of temperature? It varies very much and once I have got my room temperature of 23 degrees.

Thank you for your help!

citruz commented 5 years ago

Some beacons use a non-standard format for the temperature. You can try packet.temperature_fixed_point. If that gives you invalid values as well, maybe check the specification of your beacons for a description of the encoding.