File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed
Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change 2020print (hexlify (bluetooth_mac , ':' ).decode ().upper ())
2121
2222async def read_sensor ():
23- bthome .temperature = 25
23+ bthome .temperature = 25 # Mocked up data for testing purposes.
2424 bthome .humidity = 50.55
25- print (f"BTHome flags: { bthome ._ADVERT_FLAGS .hex ().upper ()} " )
26- print (f"Device name: { bthome ._pack_device_name ().hex ().upper ()} " )
27- print (f"Temperature data: { bthome ._pack_temperature (bthome .TEMPERATURE_SINT16 ).hex ().upper ()} " )
28- print (f"Humidity data: { bthome ._pack_humidity (bthome .HUMIDITY_UINT16 ).hex ().upper ()} " )
29- print (f"BTHome advertisement: { bthome .pack_advertisement (bthome .TEMPERATURE_SINT16 , bthome .HUMIDITY_UINT16 ).hex ().upper ()} " )
3025 await asyncio .sleep (AWAKE_TIME_SECS )
3126 print ("Going to sleep." )
3227 deepsleep (SLEEP_TIME_SECS * 1000 ) # Helps mitigate sensor self-heating.
3328
3429async def communicate_readings ():
35- print ("Advertising availability of data. " )
30+ print ("Constructing advertising payload " )
3631 while True :
3732 async with await aioble .advertise (
3833 BLE_ADV_INTERVAL_uS ,
You can’t perform that action at this time.
0 commit comments