zewelor / bt-mqtt-gateway

A simple Python script which provides a Bluetooth to MQTT gateway, easily extensible via custom workers. See https://github.com/zewelor/bt-mqtt-gateway/wiki for more information.
MIT License
550 stars 117 forks source link

add passive read for lywsd03mmc with custom firmware #201

Closed lwestenberg closed 3 years ago

lwestenberg commented 3 years ago

Description

The Xiaomi LYWSD03MMC can be flashed over Bluetooth, for more information: https://github.com/atc1441/ATC_MiThermometer

With the custom firmware the temperature, humidity and battery can be read passive. This change adds support for passive readout.

Type of change

zewelor commented 3 years ago

Thanks for PR. I think it would be good to add some readme info that its for this custom FW. As I understand this sensors support passive reading, but encprypted, which won't work with this code. Maybe also add info in config.example, that this option works only in this custom firmware ?

lwestenberg commented 3 years ago

It’s not encrypted. Just flash the hygrometer over bluetooth, select custom type broadcast and the data is sent unencrypted in the advertisement. This change reads it directly.

Op 28 dec. 2020 om 12:37 heeft zewelor notifications@github.com het volgende geschreven:

 Thanks for PR. I think it would be good to add some readme info that its for this custom FW. As I understand this sensors support passive reading, but encprypted, which won't work with this code. Maybe also add info in config.example, that this option works only in this custom firmware ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

zewelor commented 3 years ago

But its unencrypted, only after flashing this custom FW ? Official firmware needs encryption key: https://esphome.io/components/sensor/xiaomi_ble.html#lywsd03mmc . So with passive mode, it requires that custom fw. This should be noted somewhere

lwestenberg commented 3 years ago

Yes that’s true. You should upload the custom firmware over Bluetooth first in order to use passive readout and also set the custom advertisement setting from the Telink flasher (same page that you use for flashing the firmware) the info should be in de wiki. The steps for flashing are on https://github.com/atc1441/ATC_MiThermometer

I will add the info to te wiki this evening.

Op 28 dec. 2020 om 15:48 heeft zewelor notifications@github.com het volgende geschreven:

 But its unencrypted, only after flashing this custom FW ? Official firmware needs encryption key: https://esphome.io/components/sensor/xiaomi_ble.html#lywsd03mmc . So with passive mode, it requires that custom fw. This should be noted somewhere

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

zewelor commented 3 years ago

I think it should be also good to add comment here: https://github.com/zewelor/bt-mqtt-gateway/pull/201/files#diff-8820e266c757e766e9a345e6aa55bcd237f1795744ed124b49c5c50434dcdbecR142 . At least with link to wiki etc

lwestenberg commented 3 years ago

added the comment in the config example. How should I edit the wiki (if still neccessary)?

zewelor commented 3 years ago

Looks good ! Merged it and added short wiki info with link in config.sample. Thanks !