I have a zigbee switch that I use with a script as a garage door remote. The script turns the switch on for 400ms then off simulating the button push.
I also have a Zwave door lock and I am trying to figure out how to disable the switch when the door is locked and re-enable when the door is unlocked without triggering the open command
The below “Locked” automation does not prevent the script from running if locked and the “Unlock” automation fires the script to open the door
Maybe I need to disable the script when locked and re-enable when unlocked or add a condition to the script so it only fires if the door is unlocked?
I’m not sure if these would be as secure as disabling the switch and I DEFINATLY not sure what that automation might look like
#Script to simulate button press
alias: Garage Remote
sequence:
- service: homeassistant.turn_on
entity_id: switch.garage_remote
- delay:
milliseconds: 400
- service: homeassistant.turn_off
entity_id: switch.garage_remote
mode: single
alias: Garage Night Locked
description: ''
trigger:
- platform: state
entity_id: lock.key_free_push_button_deadbolt_current_lock_mode
to: locked
condition: []
action:
- type: turn_off
device_id: f53020810e4ab48ce4d4f8e335683d23
entity_id: switch.garage_remote
domain: switch
mode: single
alias: Garage Night Unlocked
description: ''
trigger:
- platform: state
entity_id: lock.key_free_push_button_deadbolt_current_lock_mode
to: unlocked
condition: []
action:
- type: turn_on
device_id: f53020810e4ab48ce4d4f8e335683d23
entity_id: switch.garage_remote
domain: switch
mode: single