Cheap sensors and cheaper battery monitoring

A previous post touched on my temperature monitoring setup that uses the wonderfully inexpensive Xiaomi LYWSD03MMC.

Despite sipping its CR2032 battery, the sensors still need their battery replaced every six to eight months.

ESPHome now publishes the battery level for each sensor:

[...]
- platform: xiaomi_lywsd03mmc
  mac_address: "A4:C1:38:30:XX:XX"
  bindkey: "eef418daxxxxxxxxxxxxxxxxxxxxxxxx"
  temperature:
    name: "Bathroom Temperature"
  humidity:
    name: "Bathroom Humidity"
  battery_level:
    name: "Bathroom Battery Level"
[...]

Home Assistant exposes this via its Prometheus endpoint:

[...]
prometheus:
  namespace: hass
  component_config_glob:
    sensor.*_temperature:
      override_metric: temperature_f
    sensor.*_humidity:
      override_metric: humidity_percent
  filter:
    include_entities:
    - sensor.bedroom_temperature
    - sensor.bedroom_humidity
    - sensor.bedroom_battery_level
    - sensor.living_room_temperature
    - sensor.living_room_humidity
    - sensor.living_room_battery_level
    - sensor.bathroom_temperature
    - sensor.bathroom_humidity
    - sensor.bathroom_battery_level
    - sensor.garage_temperature
    - sensor.garage_humidity
    - sensor.garage_battery_level
    - sensor.office_temperature
    - sensor.office_humidity
    - sensor.office_battery_level
    - sensor.refrigerator_temperature
    - sensor.refrigerator_humidity
    - sensor.refrigerator_battery_level
[...]

And, Grafana graphs this new metric and alerts (via Telegram) on any battery level under 15%.

You should buy a bunch on AliExpress!

Apr 2, 2022