I have the foyer lights come on when my Schlage FE469NX lock is unlocked. They come on fine when the door unlocks, but the problem is, if the lights are off when one leaves, when the door locks again, the lights come on. How can I stop that from happening?
- id: '1578617159127'
alias: Foyer lights on when front door unlocked
description: ''
trigger:
- entity_id: lock.schlage_allegion_be469_touchscreen_deadbolt_locked
platform: state
condition: []
action:
- device_id: 13b836e5c86b474aa4380535337b0d58
domain: switch
entity_id: switch.leviton_dz15s_1bz_decora_smart_switch_switch
type: turn_on
What is the state of lock.schlage_allegion_be469_touchscreen_deadbolt_locked when it’s unlocked? I need to know the value you see on the STATES tab of the Developer Tools page.
Thanks for the quick reply Phil. Unfortunately, this did not work. The state definitely says “Locked” and “Unlocked” accordingly, but the light is still going back on after the door re-locks. Can you think of something else I missed? Thanks again!
You need to look at the state on the STATES tab of the Developer Tools page. The state as shown elsewhere is not the “real” state as automations use. This is Home Assistant Automation 101.
Did you reload the automations after making the change? I’m 99.44% sure what I suggested is what you need.
Phil, I found the reload state section in Dev and reloaded. Now it looks like it works, so you’re closer to 100% than 99.44%! Thanks again! This stuff is pretty cool.
I didn’t reload the automations. I didn’t know you needed to do that and after Phil recommended it, I poked around and found it in the Dev Services tab. I forgot that most times computers can’t assume.
I just thought it may help others but you had already cleared up the problem.
You’ll know better for next time, don’t worry, we’ve all been there and sometimes just because I’m not sure if I’ve done it I’ll do it again.
Cheers
Any time you need to try something new or find out stuff in general you should always consult the docs.
My snippet was meant as a clue for a template condition but if you got to the docs on conditions then one of the examples they give you is : -
condition:
condition: state # 'day' condition: from sunrise until sunset
entity_id: sun.sun
state: 'above_horizon'
You need the opposite so just invert the state, but check the states as they are not always transparent.
This one is ‘below_horizon’
Ah, perfect. I keep trying to do searches before posting, but sometimes I still can’t find the stuff. I have a lot of reading to do, but thanks again to you and @pnbruckner for the help!
Mutt, sorry for revisiting this, but I have a quick question:
The sun.sun above_horizon entity is working great. Is there a way to set an offset on the sunset side of that of, say, an hour? I’d like this to work an hour before sunset all the way through sunrise.
not trying to be rude, but 4 posts up is a link that has EXACTLY what you asking for…
condition:
condition: sun
after: sunset
# Optional offset value - in this case it must from -1 hours relative to sunset, or after
after_offset: "-01:00:00"