Automation: input_select in condition not working?

Hi,

I’m struggeling with this one for a while - hope someone can push me the right way.
My automation works - I’m trying to add a condition that verifies an input_select state.
However, none of the options I tried seems to be right…?

        - condition: template
          value_template: "{% if states.input_select.rolladenstatus.state != 'down' %} true {% else %} false {% endif %} "
#          value_template: "{% if is_states('input_select.rolladenstatus', 'down') %} 1 {% else %} 0 {% endif %}"
#          value_template: "{{ states('input_select.rolladenstatus') != 'down' }}"
#          value_template: "{{ states('input_select.rolladenstatus') not in ['down'] }}"

Same with a bit more context:

  - alias: 'RolladenNew-Sun-Down'
    initial_state: 'on'
    trigger:
      platform: sun
      event: sunset
    #    offset: "00:45:00"
    condition:
      condition: or
      conditions:
        - condition: template
          value_template: "{% if states.input_select.rolladenstatus.state != 'down' %} true {% else %} false {% endif %} "
#          value_template: "{% if is_states('input_select.rolladenstatus', 'down') %} 1 {% else %} 0 {% endif %}"
#          value_template: "{{ states('input_select.rolladenstatus') != 'down' }}"
#          value_template: "{{ states('input_select.rolladenstatus') not in ['down'] }}"
        - condition: time
          after: '17:00:00'
          before: '22:00:00'
          weekday:
            - sat
            - sun
        - condition: time
          after: '17:00:00'
          before: '22:00:00'
          weekday:
            - mon
[..]

Thanks!
ItsMee

value_template: "{{ not is_state('input_select.rolladenstatus', 'down') }}" 

Your template is using an evaluation syntax not a print syntax so it’s not going to produce anything.
Your value expression is also sub optimal as it could cause errors during initialisation
Try the above instead.

Though your 3rd should have worked ???

Taras is coming !

Most of the templates you created are valid. However you say nothing “seems to be right”.

The way it is currently written, at sunset (when the automation is triggered), if the time is before 17:00 and the input_select is not down, the action should be executed. Are you saying it fails to do this?

Hi Guys,

thanks a lot - sorry for not beeing precise. Potentially there is a conceptual understanding issue on my end. For testing purposes I ‘triggered’ the automation via WebUi - maybe the conditions are not evaluated then? I’m saying that because the automation always kicked off, also the state was down. But also i tested way beyond 22pm - and it still triggered.

I’ll put the following & see what happens tonight. I’ll also put it in my todo to understand evaluation vs. print syntax - seems I’m missing some basics there.

Cheers,
ItsMee

Correct. When you manually execute an automation, it skips the trigger and condition sections and just executes the action.

From the documentation: Testing your automation

Please note that if you click on Trigger of an automation in the frontend, only the action part will be executed by Home Assistant. That means you can’t test your trigger or condition part that way. It also means that if your automation uses some data from triggers, it won’t work properly as well just because trigger is not defined in this scenario.

The below ‘debug’ automation is not triggering - telegram itself works for other automations. Sun is also showing in the WebUI, so I’m a bit at loss.

  - alias: 'Test-Sun-Up'
    initial_state: 'on'
    trigger:
      platform: sun
      event: sunrise
    action:
      - service: notify.telegram_edelfull
        data:
          title: 'Test-Sun-Up'

Btw - the topic earlier in the thread works meanwhile, also found some or/and combination that required rework.

ItsMee

You need a message, you can’t just send a title.