Automation Issue 0.51.1

Hi all,

Just updated to 0.51.1 and its now flagging up an issue with my automations that it didnt before.

I have run hass --script check_config but it doesnt show me what line has the issue in my automation code. It just says

2017-08-15 08:57:43 ERROR (MainThread) [homeassistant.config] Invalid config for                                                            
[automation]: [state] is an invalid option for [automation]. Check: automation-                                                           
>trigger->0->state. (See ?, line ?). Please check the docs at https://home-assis                                                           
tant.io/components/automation/
2017-08-15 08:57:43 ERROR (MainThread) [homeassistant.config] Invalid config for                                                            
[automation]: [state] is an invalid option for [automation]. Check: automation-                                                           
>trigger->0->state. (See ?, line ?). Please check the docs at https://home-assis                                                           
tant.io/components/automation/

Im having trouble working out which one is the problem.

The full output is here, can any one assist?

https://drive.google.com/open?id=1kzalI8VHDPtqoEbgdQLRmNMnWmtBXb8w87eUUpP8-xQ

Ive attached it as a google word doc as all my automation’s are just above the character count for the post.

Hi @Ross_Davey, there’s a breaking change with the state trigger since 0.50.

1 Like

Thanks, any chance you can link me to where this is explained? I couldn’t find what you are referring to…maybe I didnt look hard enough.


Thanks,

Ive looked at this already, the link I want is the one explain above by VDRainer explaining what the break is from version 0.50 and above.

0.50 Breaking Changes

Automations: The state trigger keyword state and the time trigger keyword after were deprecated in 0.46. They have now been removed. (@amelchio - #8510) (automation.state docs) (automation.time docs) (breaking change)

1 Like

Thanks

So to check I’ve got this right, Im guessing this is an offending automation? Because in the condition im using state:‘on’. Which if im reading correctly is now depreciated?

How would I go about changing this then? I have an input_boolean that this automation checks if its on or not. This determines if the automation runs. On occasion I might not want to track motion so will turn off the inputboolean to stop motion alerts. How would I go about achieving this now then if “State” is now depreciated? I cant use “from” “to” as i dont want to track a state change. I want to determine if the input_boolean is on or off, hence me using “state” previously.

##//Detect Motion and Pushover Alert//##

alias: mqtt motion detected
trigger:
  platform: mqtt
  topic: motion/motion
  payload: 'Motion Detected'
condition:
  condition: state
  entity_id: input_boolean.motion_tracker
  state: 'on'
action:
  service: notify.pushover
  data:
    title: ""
    message: "Motion Detected"

Try changing “state” to “to”

I’m not sure this is the issue as I understood that the change is only applicable where ‘state’ is used as a trigger not as a condition.

It looks like you may have ‘state’ in some of your triggers like:

platform: state
entity_id: switch.mqtt_switch
state: off

So in this case I think you need to look at changing “state: off” to “to: off”

Hope this is right and that this helps?

:+1: I was trying to avoid the obvious, and allowing him room for some homework :grin:

Fair enough. It’s rare that I have an answer instead of a problem so was keen to help!

That said, there’s definitely satisfaction to be gained working things out the hard way :slight_smile:

1 Like

or RTFB :smiley:

Thanks,

This solved my problem!

I got the same while testing a new Pi, I understand the problem of breking changes for the new versions (long time ago for this I keep an old version of HA…). But the error log does not help to much:

2017-08-17 17:27:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /home/pi/.homeassistant/configuration.yaml, line 1532). Please check the docs at https://home-assistant.io/components/automation/
2017-08-17 17:27:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /home/pi/.homeassistant/configuration.yaml, line 1532). Please check the docs at https://home-assistant.io/components/automation/
2017-08-17 17:27:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /home/pi/.homeassistant/configuration.yaml, line 1532). Please check the docs at https://home-assistant.io/components/automation/
2017-08-17 17:27:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /home/pi/.homeassistant/configuration.yaml, line 1532). Please check the docs at https://home-assistant.io/components/automation/
2017-08-17 17:27:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /home/pi/.homeassistant/configuration.yaml, line 1532). Please check the docs at https://home-assistant.io/components/automation/
2017-08-17 17:27:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /home/pi/.homeassistant/configuration.yaml, line 1532). Please check the docs at https://home-assistant.io/components/automation/
2017-08-17 17:27:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /home/pi/.homeassistant/configuration.yaml, line 1532). Please check the docs at https://home-assistant.io/components/automation/
2017-08-17 17:27:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /home/pi/.homeassistant/configuration.yaml, line 1532). Please check the docs at https://home-assistant.io/components/automation/
2017-08-17 17:27:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /home/pi/.homeassistant/configuration.yaml, line 1532). Please check the docs at https://home-assistant.io/components/automation/

The line 1532 is:

automation:

So id does not help at all and this is only part of the log, my configuration.yaml is much bigger and this message repeats a lot. As far as I remember in the past the HA log point the right line with the error. I strongly suggest to show in the log the error line instead of the generic one.
Thank you

Post your automation.

The error is referring to “automation->trigger->0->state” and not the word automation itself.

Probably the ‘state’ to ‘to’ breaking change.

Didn’t think it applied, but you never know.

Without seeing the automations we’ll never know :stuck_out_tongue:

Of course this is the error cause, but what I would like to bring into attention is that the error log mention the yaml line of automation start for all such errors and not the line where the problem encountered.
My automation area last until line 2645, so it will be nicer to find and go to the right line for replace “state” with “to”.
I can’t do just Ctrl+H because “state” is also used in the “platform state”.

I do agree with what you are saying, HA used to give the line number of the error, why it doesn’t anymore I don’t know. The way to bring it to the dev’s attention is flagging it as a error in git I suppose.

1 Like