Hi,
I have a Shelly 3EM configured in Home Assistant Core with MQTT like this:
sensor:
- platform: mqtt
name: "Shelly 3EM Phase 1 Power"
state_topic: "shellies/shellyem3-DC4F227649A1/emeter/0/power"
unit_of_measurement: "W"
- platform: mqtt
name: "Shelly 3EM Phase 1 Volt"
state_topic: "shellies/shellyem3-DC4F227649A1/emeter/0/voltage"
unit_of_measurement: "V"
- platform: mqtt
name: "Shelly 3EM Phase 2 Power"
state_topic: "shellies/shellyem3-DC4F227649A1/emeter/1/power"
unit_of_measurement: "W"
- platform: mqtt
name: "Shelly 3EM Phase 2 Voltage"
state_topic: "shellies/shellyem3-DC4F227649A1/emeter/1/voltage"
unit_of_measurement: "V"
- platform: mqtt
name: "Shelly 3EM Phase 3 Power"
state_topic: "shellies/shellyem3-DC4F227649A1/emeter/2/power"
unit_of_measurement: "W"
- platform: mqtt
name: "Shelly 3EM Phase 3 Voltage"
state_topic: "shellies/shellyem3-DC4F227649A1/emeter/2/power"
unit_of_measurement: "V"
- platform: template
sensors:
shelly_3em_power_total:
friendly_name: "Total Consumption"
value_template: "{{ (states('sensor.shelly_3em_phase_1_power') | float + states('sensor.shelly_3em_phase_2_power') | float + states('sensor.shelly_3em_phase_3_power') | float) / 1000 }}"
unit_of_measurement: 'kWh'
What do need to do to be able to add this to the new Energy feature in HA?
When I try to add “Grid consumption” I only get "No matching statistics found.
I read in the forums that I needed to add the following to my “Total Consumption” for HA to recognize it as an energy entity:
last_reset: '1970-01-01T00:00:00+00:00'
state_class: measurement
device_class: energy
But when I do I get the following error:
ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.template]: [attributes] is an invalid option for [sensor.template]. Check: sensor.template->sensors->shelly_3em_power_total->attributes. (See /config/configuration.yaml, line 481). Please check the docs at Template - Home Assistant
So does anyone know what I’m doing wrong here?
3 posts - 2 participants