I'll keep it dead simple ...
My understanding is that if I have a CT clamp showing "for example" the amount of power my house is kicking out right now, then I can do something like this ...
- platform: template
sensors:
feed_in:
friendly_name: "Export"
unit_of_measurement: "kW"
device_class: power
value_template: >
{% if (states('sensor.ct_grid') | float(default=0) ) < 0 %}
{{ states('sensor.ct_grid') | float(default=0) * -1 / 1000 | round(3) }}
{% else %}
0
{% endif %}
grid_consumption:
friendly_name: "Import"
unit_of_measurement: "kW"
device_class: power
value_template: >
{% if (states('sensor.ct_grid') | float(default=0) ) > 0 %}
{{ states('sensor.ct_grid') | float(default=0) * 1 / 1000 | round(3) }}
{% else %}
0
{% endif %}
... so this takes the raw value in watts and gives me a kW value I can then chart like so ...
... I then "in order to use utility meter" am required to get a value in kWh so I need to use an integral like this ...
- platform: integration
name: feed_in_sum
source: sensor.feed_in
unit_time: h
method: trapezoidal
max_sub_interval:
minutes: 5
- platform: integration
name: grid_consumption_sum
source: sensor.grid_consumption
unit_time: h
method: trapezoidal
max_sub_interval:
minutes: 5
... ok so my understanding is that this provides me with an hourly "cycled" value, but I have an hours worth of data there and it hasn't reset ... odd!
Moving along ...
Next I need to configure by daily "utility meter" like this ...
utility_meter:
feed_in_daily:
name: "Export Today"
source: "sensor.feed_in_sum"
cycle: daily
state_class: total_increasing
device_class: energy
grid_consumption_daily:
name: "Import Today"
source: "sensor.grid_consumption_sum"
cycle: daily
state_class: total_increasing
device_class: energy
... for some reason though it's not drawing any line at all when I chart these.
Does anyone know why?