Is_state () or is_state()? both work?

HI,

just the other day I thought to have made a typo in my conditions by using

{{ is_state ('sensor.activity_selection', 'Opstaan')}} in stead of
{{ is_state('sensor.activity_selection', 'Opstaan')}}

but both seem to work, in the dev-template, but also in real HA life. Is this following jinja syntax, or a bug.

That’s normal. You can do either. Whatever you prefer is what you should do. Typically, coders don’t like the space.

good to know, seems a bit odd indeed the space.

let me quickly ask this:

this works:

  - alias: Uit thuis
    id: 'Uit thuis'
#    hide_entity: True
    initial_state: 'on'
    trigger:
      platform: state
      entity_id: input_select.uit_thuis
    action:
      service_template: >
        script.{{states('input_select.uit_thuis') | lower | replace(' ','_')}}

but this doesn’t…

  - alias: Uit thuis
    id: 'Uit thuis'
#    hide_entity: True
    initial_state: 'on'
    trigger:
      platform: state
      entity_id: input_select.uit_thuis
    action:
      service_template: >
        script.{{trigger.to_state.state | lower | replace(' ','_')}}

options are ‘Thuis’ and ‘Uit huis’

what is wrong in the trigger version?

what doesn’t work about it?

it doesn’t lead to action, nothing happens

You need to verify that to_state.state returns the state option, not something else.

duh, found it…

service: switch.turn_on
entity_id: scene.uit_huis ......