Improve of Automation


i finally have done a simple SINGLE On/Of Automation based on Sun.

alias: Nachtbeleuchtung v2.1
description: ''
  - platform: sun
    event: sunset
    offset: '-00:30:00'
  - platform: sun
    event: sunrise
    offset: '+00:30:00'
condition: []
  - if:
      - condition: template
        value_template: '{{states(''input_number.nachtbeleuchtung_status'') | float >0}}'
      - service: script.nachtbeleuchtung_aus
        data: {}
      - service: script.nachtbeleuchtung_ein
        data: {}
mode: single

What i would to get rid of (better readable): The value_template part. Is there no way to directy check for value of an input field?


The script for turning the lights off, which is called by the automation, is setting the nubmer 0 to a input field. The other one for tunring on the lights is setting the number 1 into the field.

Maybe there is a complete different way to make scripts like that, because i do not want to maintain 2 scripts for the same thing (One for turning lights on and one for turning lights off)

I just want to get better by time :slight_smile:

- condition: numeric_state
  entity_id: input_number.nachtbeleuchtung_status
  above: 0
1 Like

For whatever reason, its not working

(its turning it on, but never off)

Okay, might be my fault. I tried that out before, but it looks like, my script is just running for 14 seconds and i was not waiting long enough (because setting the number is the LAST step of the script).

Thanks, now its much better readable :slight_smile:

1 Like

not sure what that means. What isn’t working?