So I have had this automation working in the past, and the on a recent update and restart, it just stopped. I do not see anything in the logs stating there is an issue with the markup, so I am at a loss of what is going on.
- id: turn_office_light_on_night_motion
alias: Office light on when motion at night
trigger:
platform: state
entity_id: sensor.office_motion
to: 'detected'
condition:
condition: sun
after: sunset
after_offset: "-00:45:00"
action:
service: light.turn_on
entity_id: light.office_light_level
(note: sensor.office_motion does change to âdetectedâ properly)
Can you trigger it manually from the automation card, if you can the problem is either in the condition or the trigger, if you canât the problem could be in any part but most likely the action. Has the office_light_level changed itâs name? You can check in dev-tools-> states.
I have a similar setup thatâs working on 0.59 but mine looks a little different to yours;
- action:
- alias: Turn the lounge lamp on
data:
entity_id: light.lounge_lamp
service: light.turn_on
alias: Turn on Lights Before Sunset
condition:
- condition: state
entity_id: group.all_devices
state: home
- after: '14:30:00'
before: '23:59:00'
condition: time
id: '1506081676552'
trigger:
- entity_id: group.all_devices
platform: state
to: home
- event: sunset
offset: -01:00:00
platform: sun
Obviously youâre looking for sunset as a condition rather than an event. I wonder if there has been a change where sunset is not being recognised as a condition. Could you try rewriting the condition using a template as in the example here? By which I mean using the elevation of the sun as a condition, rather than the sunset event with an offset.
I thought about the sensor. vs binary_sensor. and that didnât change. The light.office_light_level manual function for turning it on and off works fine.
I am beginning to think it has something to do with the sunset offset. I didnât see any depreciated/breaking changes about that, so I may have to go the template route like @reclusivemonkey suggested. It is more heavy handed then what I had working previously though. Seems odd though that it works on one version with supported docs and then a few version after, still same supported docs and is broken.