Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95419

Can't get if/else to work in automations.yaml

$
0
0

@dantist wrote:

Hi there, I can’t seem to get any if/else condition working in the automations.yaml. All I’m trying to do is to switch a Fibaro Wall Plug on if it’s off and vice versa. Here is what I tried:

- id: '1573505971844'
  alias: 'Schalter #1 - Aus [kurz]'
  trigger:
  - event_data:
      channel: 2
      name: MEQ1850393
      param: PRESS_SHORT
    event_type: homematic.keypress
    platform: event
  action:
  - device_id: 8d939318d6374dafa825c29dcb711978
    domain: switch
    entity_id: switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch
    type: '{%if is_state("switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch", "on")%}turn_off{%else%}turn_on{%endif%}'

I found this syntax many times in the forums, why is it not working?

The logfile says

Invalid config for [automation]: value is not allowed for dictionary value @ data['type']. Got None.

Posts: 13

Participants: 6

Read full topic


Viewing all articles
Browse latest Browse all 95419

Trending Articles