Hi
Sorry for the probable newbie question. Still learning here with everything. So I have a template that currently takes away the value of an AC Battery that is connected to a consumer unit that has a CT Clamp.
The script below works fine when the battery is in a charging state as the battery CT reports a minus number
What I was looking for is the same as I have but when the battery reports a positive value it minuses it from the consumer unit reading.
This is what I currently have.
template:
- sensor:
- name: Our House minus battery
unit_of_measurement: “W”
state: >-
{% set TARGET = states(‘sensor.myenergi_harvi_14931930_none_ct1’)|float %}
{% set SOURCE = states(‘sensor.myenergi_harvi_14931930_power_ct_ac_battery’)|float %}
{{ (SOURCE + TARGET) | round(2) }}
attributes:
target: “{{ states(‘sensor.myenergi_harvi_14931930_none_ct1’) }}”
source: “{{ states(‘sensor.myenergi_harvi_14931930_power_ct_ac_battery’) }}”
- name: Our House minus battery