Automation problem after upgrade to 0.50

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

- alias: "Hasee in" 
  trigger:
    platform: state
    entity_id: input_boolean.chen_home
    to: 'on'
    from: 'off'
  condition:
    condition: time
    after: '08:00:00'
    before: '18:00:00'
  action:
    service: light.turn_on   
    entity_id: light.sonoff_gongzuo_2,light.sonoff_hou8

What should I write?

i think i understand.

So is the state: 'below_horizon' under the condition part still ok like I have in my config file here? Is my understanding that it would only be an issue if the to: 'idle' part was state: 'idle' correct?

trigger:
      - platform: state
        entity_id: media_player.playstation_4
        from: 'playing'
        to: 'idle'
    condition:
      - condition: state
        entity_id: sun.sun
        state: 'below_horizon'

The keywords after: and state: are only invalid in the trigger section. They’re still valid in condition: blocks.

1 Like

yes ,only invalid in the trigger section.

From my understanding it’s not necessary to have both (“from” and “to”); you may also only use one of them.

At least in my config it works with only one.

I thought that in the condition is also invalid

State works for me in conditions.

I just meant that in triggers, you don’t need to use both (from and to) as one would be enough.

ok , i try it, thank you!

Nope, only triggers, as mentioned in the release notes under Breaking Changes (emphasis mine):

Yes, I think that’s it.