I bought this device hoping to use it with my hobby project, a programmable home thermostat based on a Raspberry Pi board.
Using Python and the BLEAK library, I can find it on a BLE scan quite easily:
import asyncio
from bleak import BleakScanner
def detection_callback(device, advertisement_data):
print(device.address, "RSSI:", device.rssi, advertisement_data)
async def main():
scanner = BleakScanner()
scanner.register_detection_callback(detection_callback)
await scanner.start()
await asyncio.sleep(5.0)
await scanner.stop()
for d in scanner.discovered_devices:
print(d)
asyncio.run(main())
resulting in this, including RSSI of -72, which seems a reasonable value:
A4:C1:38:0F:C4:95 RSSI: -72 AdvertisementData(local_name='LYWSD03MMC', service_data={'0000fe95-0000-1000-8000-00805f9b34fb': b'0X[\x05\xa8\x95\xc4\x0f8\xc1\xa4\x08'})
But any attempt to follow this up by connecting to the device at this MAC address, times out. I would appreciate suggestions on how to correctly connect to this device to read the temperature.