pvvx / ATC_MiThermometer

Custom firmware for the Xiaomi Thermometers and Telink Flasher
https://github.com/pvvx/pvvx.github.io/tree/master/ATC_MiThermometer
Other
3k stars 209 forks source link

LYWSD03MMC, FW 4.7, BTHome v2, HA: What exactly does the "Power" sensor report? #566

Open Moonbase59 opened 2 weeks ago

Moonbase59 commented 2 weeks ago

Thanks for your and atc144's fantastic work on all these temp/humidity sensors!

I have one question I couldn't exactly find out. In Home Assistant, using the BTHome integration, a "Power" sensor shows up and goes on and off for my LYWSD03MMC devices (FW 4.7, set to BTHome v2 and all defaults):

image

What exactly does this sensor report?

It seems to go "on" more often (or permanently) when I place the thermometer in "bad conditions", like into the fridge, or outside. Did I maybe find an "easter egg" and it actually reports being within the set "comfort zone"? Comparing temp/humidity at the times it switches on and off somehow seem to hint at that.

(Having a function like this would actually be useful: One could set the "comfort zone" to something meaningful, like the optimum fridge temperature or the like… and get an alert if something was "outside range". Only the label "power" is a bit misleading should this be the case.)

pvvx commented 2 weeks ago

README: Temperature or humidity trigger (GPIO PA5 LYWSD03MMC label on the "reset" pin)

https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html image

Moonbase59 commented 2 weeks ago

Ah, thanks for the pointer, missed that one. ;-) Let's see if I can use it for something…

Do you think we could advertise something like "within/without comfort zone" easily, as a binary sensor? Like reporting the same as the smiley face? Maybe in a future version?

This could make for a higher "partner acceptance factor"—we could set a "comfort zone" (shown by the smiley + the sensor) and report that back to HA. Thus, the girlfriend/wife/partner wouldn't have to check HA but also see the same info on the smiley, and us "techies" had the same info in HA, easily. That should allow for more possibilities than just the value+hysteresis.

It would also allow for easier "out of range" automation in case of alerts, like for bedroom, plant conditions, fridge, etc. (No need to program templates for each.)

For example, I've set my fridge thermometer to a "comfort zone" of 5–8 °C, and 40–55% humidity, so everyone can see at a glance if "the fridge is happy" (within ranges). Having that reported back to HA could make for easy notification if it gets too cold (wasting energy), too warm (door open, defect), or too wet inside. I currently have to repeat these conditions in the automation, a "within range" sensor would make that easier, especially if one has a lot of these little gadgets. :-)

pvvx commented 2 weeks ago

Transferring additional data requires more energy from the battery.

It is more convenient to describe "comfortable" conditions in "Home Assistant" automation. The "comfort" parameters are presented, and the calculation of the flag in "Home Assistant" will not drain the thermometer battery.

Moonbase59 commented 2 weeks ago

The "comfort" parameters are presented […]

In the BLE advertisements? Or just in the Telink Flasher? Maybe I miss another thing.

But anyway, thanks for the response, that is certainly a valid standpoint—battery life is important. It was just an idea for possible enhancement.

almirus commented 2 weeks ago

@pvvx offtopic: Is this kind of battery capacity sensor behavior normal?

image

The battery just won't die. 😁

pvvx commented 2 weeks ago

This is normal. Over time, many thermometers have noisy graphs like this. You need to tap the thermometer (or clean the battery contacts :) ). image

Due to low current consumption, contacts oxidize. Low current does not break through oxide films...

LYWSD03MMC B1.9 (work outside) image