Hello, I’ve just installed my first hass setup coming from Openhab and have some problems.
I’m trying to trigger an event (push a mqtt-switch) when another is triggered (changed from off to on).
But I have this error:
Invalid config for [automation]: required key not provided @ data[‘action’]. Got None. (See /home/damien/.homeassistant/configuration.yaml, line 148). Please check the docs at https://home-assistant.io/integrations/automation/
MY config is:
- id: garage_up
alias: 'open garage'
initial_state: 'off'
condition:
condition: state
entity_id: switch.funkgarage
state: 'on'
trigger:
- platform: state
entity_id: switch.garage_2
to: 'on'
Hi, welcome to the group.
I experimented with openhab about 2-3 years agon but my memory is hazy so I won’t offer comparisons, just elements of what is wrong here.
yaml is hierarchical (a bit like html, but Yaml Ain’t a Markup Language) and it doesn’t care about the order of children under a parent. The Automation Editor highlights this by ordering everything alphabetically (makes it really hard to read)
What you have done however, is one of the things that the HA interpretation of yaml, does object to. You’ve put the condition before the trigger.
Trigger, Condition. Action see finity post below
You have also specifically stated that the automation should be turned off. Why ?
Then you have no action ? What do you want to happen ?
Wow, although that’s consistent with yaml not caring about children order it makes human reading / logical sequencing a nightmare.
I suppose with the rise of the AE we will all need to get our heads round this.
I think there are ‘some’ conventions that should not be broken and personally would hate to see action, condition, trigger (cause and effect goes out the rectangular orifice in the wall)
Thanks, it works
Actually, I tried to read the documentation, but it isn’t “straight forward” … for someone new to Hass its quite bad to have only parts of the config, it would be much better to have an example config for easy tasks like triggering one action with another .
But … in the end with your help I got it to work ,… at least config wise, it doesn’t trigger, but I look for the solution
Didn’t know that I need to activate the automation …
It works now