Hello fellow HA enthusiast!
I made an esphome solar immersion device wich calibrated gives me available solar pv power and it’s working fine at the moment. What i’m trying now is create a new template sensor that accounts for usual PV degradation. I need a factor that increases over time so that in 20 years, available solar power is smaller by 20%.
power@install_time*degradation_factor=power_now how?
20% in 20 years is 1% per year, which is 1/365.25% per day.
You need a sensor or helper that adds 0.002738% per day.
You could do it with a triggered template sensor.
template:
- trigger:
- platform: time
at: "01:06:00" # or pick another time of day to increase this
sensor:
- name: "Cumulative PV Degradation"
state: "{{ this.state|float(0) + 0.002738 }}"
unit_of_measurement: "%"
1 Like
- sensor:
- name: "available_pv_power"
unit_of_measurement: "W"
icon: mdi:solar-power
device_class: power
state_class: measurement
state: >
{% set days_after_install = ( ( as_timestamp(now()) - as_timestamp(strptime("24.09.2022", "%d.%m.%Y")) ) / 86400 ) | float | round(4) %}
{% set available_solar_initial = states('sensor.available_pv_power_initial') | float %}
{% if is_number(states('sensor.available_pv_power_initial')) %}
{{ (available_solar_initial-(days_after_install*0.2*available_solar_initial/7300))|round(0) }}
{% else %}
None
{% endif %}
I heavily edited the “days after quit smoking” HA template and I thisk this works too.
Or if you want to do it using dates (which is probably safer), it’s 31.69x10-9 % per second, so, create an input datetime with your install date in it and…
template:
sensor:
- name: "Cumulative PV Degradation"
state: "{{ (state_attr('input_datetime.install_date', 'timestamp')|int - now().timestamp()) * 31.69e-9 }}"
unit_of_measurement: "%"
It’s pretty useless storing the install date in a datetime as it will not change, just put the timestamp of the date in the template. You can work out what it is here https://www.epochconverter.com/
template:
sensor:
- name: "Cumulative PV Degradation"
state: "{{ (1664029275 - now().timestamp()) * 31.69e-9 }}"
unit_of_measurement: "%"
1 Like