I have some automations that appear to have been built originally in the UI, but I am trying to make them a bit more reliable. I want to re-write them without the Device IDs, but having a little trouble. Anyone mind giving me some pointers here?
- alias: Front Entry Light on when door unlocked
description: ''
trigger:
- platform: device
device_id: 8f42afe329a0f0739acba765f6ddd1f2
domain: lock
entity_id: lock.front_door
type: unlocked
condition:
- condition: device
type: is_on
device_id: c08e0f19918bf4d855c35a74e46416eb
entity_id: light.front_porch_lights
domain: switch
- condition: state
entity_id: light.downstairs_lights
state: 'off'
action:
- type: turn_on
device_id: 4bf2dbcce8d891b846ef60cee5e5328e
entity_id: light.front_entry_lights
domain: switch
mode: single
Here’s how I’d write that. You’ll need to have a look in Developer Tools / States to see what the actual state of the lock is (perhaps 'on' instead of 'unlocked'?).
- alias: Front Entry Light on when door unlocked
id: UUID4_HERE
trigger:
- platform: state
entity_id: lock.front_door
to: 'unlocked'
condition:
- condition: state
entity_id: light.front_porch_lights
state: 'on'
- condition: state
entity_id: light.downstairs_lights
state: 'off'
action:
- service: light.turn_on
entity_id: light.front_entry_lights
I put ids in my automations to allow assigning it to an area.
Hi @Troon - I got this updated, but I am still not getting the front entryway lights to turn on when the conditions are met. Any thoughts as to what might be preventing this from triggering?
alias: Front Entry Light on when door unlocked
id: 265984b7-5651-4bc9-ab05-c9d749052301
trigger:
- platform: state
entity_id: lock.front_door
to: 'unlocked'
condition:
- condition: state
entity_id: light.front_porch_lights
state: 'on'
- condition: state
entity_id: light.downstairs_lights
state: 'off'
action:
- service: light.turn_on
entity_id: light.front_entry_lights
I confirmed that ‘unlocked’ is the correct state of the lock is ‘unlocked’. My front porch lights and entryway lights are switches that I have set as lights in my configuration - they work correctly as lights when controlled from HA, so I don’t think that’s the issue. The light.downstairs_lights is a group, but again, it seems to work correctly when controlled through HA. Not sure where my issue is.
never seen that, where can we find that button?
btw, now we’re on the developer-tools/state, what does the refresh button next to the Set state button do ? Hovering it doesnt show a tooltip, nor does clicking it have an effect…