0.46 state deprecated

I have just upgraded to 0.46.1, and start getting the state is deprecated warning in my logs. SO went to the forum search for state deprecated and read these:

Out of these 3 I could not get any relaxing help. The first one is mentioning trigger conditions, which is rather confusing, because AFAIK somthing is a trigger or a condition. There are no such things as trigger condition.

But leaving that out and having this automation:

# TV lampa le
  alias: 'LIGHT - TV lampa le'

  trigger:
    platform: state
    entity_id: device_tracker.tv
    to: 'not_home'

  condition:
    condition: state
    entity_id: 'input_boolean.tvnezes'
    state: 'on'

  action:
    - service: homeassistant.turn_off
      entity_id: switch.tv
    - service: homeassistant.turn_off
      entity_id: input_boolean.tvnezes 

(Which was working uptill now)
Now it is generating the warnings, but if change the condition ‘state: on’ to ‘to: on’ gives an error that says:

2017-06-15 14:30:34 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: extra keys not allowed @ data['condition'][0]['to']. Got None
not a valid value for dictionary value @ data['condition'][0]['condition']. Got None. (See /opt/homeassistant/configuration.yaml, line 79). Please check the docs at https://home-assistant.io/components/automation/

I do not wish to start a debate (again) on the lingvistics. Which way is it the more logical, but someone who understands this new way of state definition, please show me the right way, how these kind of automations will work again.

cheers
tom

Condition: should have “state:” instead of “to:”

The deprecated message is only for the trigger.

Fix your condition and then print your config and error message.

Do you mean the trigger should have ‘state:’? As the code posted already has ‘state:’ in the condition.

There should not be ‘’ in the condition entity_id
the valid code is:

# TV lampa le
  alias: 'LIGHT - TV lampa le'
  trigger:
    platform: state
    entity_id: device_tracker.tv
    to: 'not_home'
  condition:
    condition: state
    entity_id: input_boolean.tvnezes
    state: 'on'
  action:
    - service: homeassistant.turn_off
      entity_id: switch.tv
    - service: homeassistant.turn_off
      entity_id: input_boolean.tvnezes

thanks guys for the replies, but as usual this was also a “user error”. i have read the logs wrong. the deprecated warning in the log preceed the automation rule loading that is wrong. (i thought the other way around. ha tries to load the automation and then gives a warning message)
So the quoted automation rule has nothing wrong with it, the following rule was the one that was wrong.

my bad
sorry again
tom

1 Like