Hi there,
My solar inverter returns very awkward values when the inverter doesn’t get enough DC power to function normally. I want to overcome that with an extra condition in my value template but I’m not that good at syntaxes so need some help here.
I tried adding a and states(‘sun.sun’) is ‘above_horizon’ %} condition but that doesn’t seem to work.
solar_live_acvoltage:
value_template: >
{% set root = state_attr('sensor.solar_inverter', 'root') %}
{% if root.Device.Measurements.Measurement[0]["@Value"] is defined and states('sun.sun') is 'above_horizon' %}
{{ root.Device.Measurements.Measurement[0]["@Value"] }}
{% else %}
225.0
{% endif %}
device_class: power
unit_of_measurement: 'V'
friendly_name: Netspanning omvormer
Any help would we greatly appreciated!
Regards,
René