Hi everyone,
we recently connected our micro-inverters to HomeAssistant. Unfortunately it doesn’t give constant data output, as it is self-powered. But the integration does return a total-power of 0, shortly before going offline, which results in this graph:
Can anyone please give me a hint, how to write a template, that only updates the value, when the value “sensor.solaranlage_total_production_1” is available and bigger, than the last saved value?
template:
- trigger:
- platform: state
entity_id: sensor.solaranlage_total_production_1
not_to:
- unknown
- unavailable
sensor:
- name: Solar Energy Total
unique_id: total_solar_energy
state: >
{% set x = trigger.to_state.state | float(0) %}
{{ x if x > this.state | float(0) else this.state }}
device_class: energy
unit_of_measurement: kWh
state_class: total