Hi,
based on an idea by Klaus Urban on Facebook (Home Assistant Tipps und Tricks | Facebook) , I wanted to get a notification for the total power change or the power change of only one phase. The automation can be activated by a boolean input variable in my frontend.
For ‘total power’ it works fine, but as soon as I do add some single phase measurements, the final statistics variable remains ‘unavailable’.
My configuration. yaml includes
sensor:
- platform: statistics
name: "Verbrauchsanderung"
entity_id: sensor.power_total
state_characteristic: change
max_age:
seconds: 15
- platform: statistics
name: "Verbrauchsanderung_Phase1"
entity_id: sensor.power_phase1
state_characteristic: change
max_age:
seconds: 15
- platform: statistics
name: "Verbrauchsanderung_Phase2"
entity_id: sensor.power_phase2
state_characteristic: change
max_age:
seconds: 15
- platform: statistics
name: "Verbrauchsanderung_Phase3"
entity_id: sensor.power_phase3
state_characteristic: change
max_age:
seconds: 15
my ‘template.yaml’ includes:
- sensor:
- name: "Energy Total"
unique_id: energy_total
state: >-
{{ states('sensor.shellyem3_e89f6d852b3a_channel_a_energy')|float +
states('sensor.shellyem3_e89f6d852b3a_channel_b_energy')|float +
states('sensor.shellyem3_e89f6d852b3a_channel_c_energy')|float }}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
availability: >
{{ not 'unavailable' in
[ states('sensor.shellyem3_e89f6d852b3a_channel_a_energy'),
states('sensor.shellyem3_e89f6d852b3a_channel_b_energy'),
states('sensor.shellyem3_e89f6d852b3a_channel_c_energy') ] }}
- name: "Power Total"
unique_id: power_total
state: >-
{{ states('sensor.shellyem3_e89f6d852b3a_channel_a_power')|float + states('sensor.shellyem3_e89f6d852b3a_channel_b_power')|float + states('sensor.shellyem3_e89f6d852b3a_channel_c_power')|float }}
unit_of_measurement: W
device_class: power
state_class: measurement
- name: "Power Phase 1"
unique_id: power_phase1
state: >-
{{ states('sensor.shellyem3_e89f6d852b3a_channel_a_power')|float }}
unit_of_measurement: W
device_class: power
state_class: measurement
- name: "Power Phase 2"
unique_id: power_phase2
state: >-
{{ states('sensor.shellyem3_e89f6d852b3a_channel_b_power')|float }}
unit_of_measurement: W
device_class: power
state_class: measurement
- name: "Power Phase 3"
unique_id: power_phase3
state: >-
{{ states('sensor.shellyem3_e89f6d852b3a_channel_c_power')|float }}
unit_of_measurement: W
device_class: power
state_class: measurement
Any ideas?
I did copy the source code identical to the total power…
Regards
Joerg