I have an automation set up to do something if certain people unlock a lock. I’m using a state conditional on sensor.lock_operator but it’s consistently pulling the operator of the previous time it was unlocked, not the current one. It’s like the sensor doesn’t get updated before the comparison happens. Is there a good way around this?
The idea is that if John Smith unlocks the gym door (called Big Blue) and the HVAC system isn’t already set to home to go ahead and set it to home.
id: '1642221100465'
alias: Bring the Heat
description: ''
trigger:
- platform: device
device_id: 0293f992da00c7f1626751c446ade353
domain: lock
entity_id: lock.big_blue
type: unlocked
condition:
- condition: or
conditions:
- condition: state
entity_id: sensor.big_blue_operator
state: John Smith
- condition: state
entity_id: sensor.big_blue_operator
state: Tom Smith
- condition: not
conditions:
- condition: state
entity_id: climate.gym
state: Home
attribute: preset_mode
action:
- device_id: e4ae72fde363cd1617b02ecc4157c3bb
domain: climate
entity_id: climate.gym
type: set_preset_mode
preset_mode: Home
mode: single