Hey,
I have created a custom sensor to estimate the savings that solar panels generate.
It’s just a sensor that tracks and converts the kwh from the solar panels to GBP to provide a daily value.
- sensor:
- name: "Todays Solar Value"
unit_of_measurement: "£"
state: >
{% set today_generated_kwh = states('sensor.pv_energy') | float %}
{% set import_rate = 0.2305 | float %}
{% set savings = (today_generated_kwh * import_rate) %}
{{ savings | round(2) }}
The “sensor.pv_energy” is a 24 hour value which means it has data from the previous day.
Does anyone know how I can make the below “today_generated_kwh” have only have todays value?
I tried the below but didnt have any success.
{% set today_generated_kwh = state_attr('sensor.pv_energy', 'today_energy') | float %}
