Dear community
After hours and hours of trying… I still don’t get my binary_sensor to update? When placing the code inside the template module it runs correctly… but somehow not as binary_sensor? Also when i try to update it with the service “homeassistant.update_entity” - it doesn’t change to on…
I of course played with the conditions to test it… (under template), but binary_sensor.aussenbeleuchtung always stays “off” - any idea?
aussenbeleuchtung:
friendly_name: "Timer Aussenbeleuchtung"
entity_id: sensor.time
value_template: >-
{% set tag = now().weekday() %}
{% set std = now().hour %}
{% set hell_o = states('sensor.wetterstation_helligkeit_o') | int %}
{% set hell_w = states('sensor.wetterstation_helligkeit_w') | int %}
{% if (tag < 4) %}
{% if (std >= 6) and (std < 10) and (hell_o > 1) %}
on
{% elif (hell_w < 1) and (std > 10) and (std <= 22) %}
on
{% else %}
off
{% endif %}
{% elif tag == 4 %}
{% if (std >= 6) and (std < 10) and (hell_o < 1) %}
on
{% elif (hell_w < 1) and (std > 10) and (std <= 24) %}
on
{% else %}
off
{% endif %}
{% elif tag == 5 %}
{% if (std >= 7) and (std < 10) and (hell_o < 1) %}
on
{% elif (hell_w < 1) and (std > 10) and (std <= 24) %}
on
{% else %}
off
{% endif %}
{% elif tag == 6 %}
{% if (std >= 7) and (std < 10) and (hell_o < 1) %}
on
{% elif (hell_w < 1) and (std > 10) and (std <= 22) %}
on
{% else %}
off
{% endif %}
{% endif %}