homeassistant/template.yaml
2022-09-17 22:46:32 +02:00

32 lines
1.5 KiB
YAML

- sensor:
- name: "Energy Total"
unique_id: energy_total
state: >-
{{ states('sensor.shelly3em_channel_a_energy')|float +
states('sensor.shelly3em_channel_b_energy')|float +
states('sensor.shelly3em_channel_c_energy')|float }}
unit_of_measurement: kWh
device_class: energy
state_class: measurement
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
- name: "Power Total"
unique_id: power_total
state: >-
{{ (states('sensor.shelly3em_channel_a_power')|float +
states('sensor.shelly3em_channel_b_power')|float +
states('sensor.shelly3em_channel_c_power')|float) }}
unit_of_measurement: W
device_class: power
state_class: measurement
- name: "Power Factor Total"
unique_id: power_factor_total
state: >-
{{ (((states('sensor.shelly3em_channel_a_power')|float) * (states('sensor.shelly3em_channel_a_power_factor')|float) +
(states('sensor.shelly3em_channel_b_power')|float) * (states('sensor.shelly3em_channel_b_power_factor')|float) +
(states('sensor.shelly3em_channel_c_power')|float) * (states('sensor.shelly3em_channel_c_power_factor')|float)) /
(states('sensor.shelly3em_channel_a_power')|float + states('sensor.shelly3em_channel_b_power')|float + states('sensor.shelly3em_channel_c_power')|float))
|int }}
unit_of_measurement: "%"
device_class: power_factor
state_class: measurement