Automations with platform sun and time are not working anymore after update to 0.52.1

Hello!

Today I updated my Home Assistant installation from 0.40.1 to 0.52.1. The update was successful except for that it’s now complaining about my automations. My automation.yaml is completely unchanged and worked fine in 0.40.1. In the logs I couldn’t find out what the problem was but after commenting all automations out and reactivating them one by one I was able to narrow it down to these simple automations:

- alias: Aussenbeleuchtung bei Sonnenuntergang einschalten
trigger:
    platform: sun
    event: sunset
    offset: "+00:10:00"
action:
    service: homeassistant.turn_on
    entity_id: group.light_outside

- alias: Aussenbeleuchtung morgens einschalten
trigger:
    platform: time
    after: '04:59:00'
action:
    service: homeassistant.turn_on
    entity_id: group.light_outside

- alias: Aussenbeleuchtung bei Sonnenaufgang ausschalten
trigger:
    platform: sun
    event: sunrise
    offset: "+00:15:00"
action:
    service: homeassistant.turn_off
    entity_id: group.light_outside

- alias: Aussenbeleuchtung nachts ausschalten
trigger:
    platform: time
    after: '01:59:00'
action:
    service: homeassistant.turn_off
    entity_id: group.light_outside

For testing I changed the platform to something else (“state” with an input_boolean in this case) and after that the “Check Config” function in Home Assistant said that the config is valid. So for me it looks like it’s having trouble with the platforms “time” and “sun”.

So I checked the logs again if there’s an error setting up these components but they seem to work well:

017-09-03 17:20:30 DEBUG (MainThread) [homeassistant.components.websocket_api]
WS 1850611600: Sending {'id': 2, 'event': {'time_fired': datetime.datetime(2017, 
9, 3, 15, 20, 30, 32258, tzinfo=<UTC>), 'data': {'entity_id': 'sun.sun', 
'old_state': <state sun.sun=above_horizon; next_rising=2017-09-04T04:43:36+00:00, 
next_midnight=2017-09-03T23:27:55+00:00, next_setting=2017-09-03T18:14:53+00:00, 
azimuth=247.49, next_dawn=2017-09-04T04:07:34+00:00, 
next_dusk=2017-09-03T18:51:03+00:00, elevation=24.56, 
next_noon=2017-09-04T11:28:03+00:00, 
friendly_name=Sun @ 2017-09-03T16:50:44.235306+02:00>, 
'new_state': <state sun.sun=above_horizon; next_rising=2017-09-04T04:43:36+00:00, 
next_midnight=2017-09-03T23:27:55+00:00, next_setting=2017-09-03T18:14:53+00:00, 
azimuth=247.72, next_dawn=2017-09-04T04:07:34+00:00, next_dusk=2017-09-03T18:51:03+00:00, 
elevation=24.42, next_noon=2017-09-04T11:28:03+00:00, friendly_name=Sun @ 
2017-09-03T16:50:44.235306+02:00>}, 'origin': 'LOCAL', 'event_type': 'state_changed'}, 
'type': 'event'}

For “time” I couldn’t find anything in the logs.

Did something change regarding these platforms between 0.40.1 and 0.52.1? I couldn’t find anything. Can anybody help me?

Achim

For the time trigger, after and before have been depreciated. Couple updates back if I’m not mistaken. Change after and before to “to”.

As for the sun triggers I’m not sure… Try changing your time triggers then see if that fixes it.

That was it! Thank you very much!

I had a look at the example maybe about ten times but I didn’t see that there’s an “at” now.

After correcting that Home Assistant also doesn’t complain about my “sun” trigger anymore.

You’re Welcome!