Hi,
I hope someone can help me with this.
I have a AC unit which only reports current.
With this value and the voltage I extract from the grid I was able to make a sensor which reports the live energy value:
sensor:
- platform: template
sensors:
stroomverbruik_airco_babykamer:
friendly_name: 'Stroomverbruik Airco Babykamer'
unit_of_measurement: W
value_template: "{{ ((states.sensor.voltage_phase_l1.state | float) * (states.sensor.airco_babykamer_current_power_usage.state | float)) | round(0) }}"
I would like to create a sensor that measures total energy used over a week and also a total energy sensor overall.
Hope someone can help me how to create these sensors.
Thanks in advance!
tom_l
March 21, 2024, 11:55am
2
You need to use the new sensor format so the sensor can be given the correct state_class. This option is not supported for the legacy template sensor you have used.
An availability template option will prevent odd readings.
Also please heed this warning:
https://www.home-assistant.io/docs/configuration/templating/#states
So taking all that into account:
configuration.yaml
template:
sensor:
- name: 'Stroomverbruik Airco Babykamer'
unit_of_measurement: W
device_class: power
state_class: measurement
state: "{{ ( states('sensor.voltage_phase_l1') | float * states('sensor.airco_babykamer_current_power_usage') | float ) | round(0) }}"
availability: "{{ has_value('sensor.voltage_phase_l1') and has_value('sensor.airco_babykamer_current_power_usage') }}"
You can then feed this to the Riemann Sum helper to get energy.
You can then feed that ever increasing energy sensor to utility meters to get any reset cycles you want:
1 Like