Home Assistant Energy with rtl_433

Submitted by todd on Mon, 09/06/2021 - 5:00pm

I struggled following a great guide to get Home assistant's energy to work as I already have an SDR at 915M and rtl_433 running to capture weather station data without Cloud API delay. The solution there is great and purpose built. I'm just difficult. These are my notes. 

Below is my rtl_433.conf:

device        :00000857
frequency     915M
output mqtt://homeassistant.local:1883,user=USERNAME,pass=PASSWORD
convert si
  protocol 149 # ERT Standard Consumption Message (SCM)

Then in homeassistant I had:

  - platform: mqtt
    name: "Power Meter"
    state_topic: rtl_433/tr/devices/ERT-SCM/METERID/consumption_data
    last_reset_topic: rtl_433/tr/devices/ERT-SCM/METERID/consumption_data
    unit_of_measurement: kWh
    last_reset_value_template: 1970-01-01T00:00:00+00:00
    value_template: >
      {% set myval = value | float %}
      {{ (myval/100) }}
    state_class: total_increasing
    device_class: energy

This required me to upgrade to 2021.9.3 as 2021.8.8 didn't support the state_class: total_increasing