Thanks, this has given me a lot to think about and try to implement. I did come up with a different solution to the same code entered multiple times in a row.
I came across this post for changing the state of an entity, and implemented the python script written by @rodpayne. Then I created the following two automations - basically making alarm_level and alarm_type momentary rather than fixed.
- alias: Front Door Alarm Level
hide_entity: false
initial_state: true
trigger:
platform: state
entity_id: sensor.schlage_front_door_lock_alarm_level
from: '0'
action:
- delay: '00:00:05'
- service: python_script.set_state
data_template:
entity_id: sensor.schlage_front_door_lock_alarm_level
state: '0'
- alias: Front Door Alarm Type
hide_entity: false
initial_state: true
trigger:
platform: state
entity_id: sensor.schlage_front_door_lock_alarm_type
from: '0'
action:
- delay: '00:00:05'
- service: python_script.set_state
data_template:
entity_id: sensor.schlage_front_door_lock_alarm_type
state: '0'