Hello,
My alarm system has several detectors on the same floor, and I want to create “something” for this group of sensors.
“Something” is in my mind a variable, but I struggling with how to best use the HA framework.
The desired functionality is to create a new “variable” floor_active as follows:
- When any of the sensors are “1” I want floor_active to also become “1”
- When all sensors have been “0” for 5 minutes, I want floor_active to become “0”
First I need something to store the floor_active state. Should I go for creating an “input_text” or something else?
Next I need to create the automation. Something similar to below?
configuration.yaml:
input_text:
floor_active:
name: floor_active
initial: Some Text
automation.yaml:
alias: 'Floor idle'
trigger:
- platform: state
entity_id:
- sensor.sensor1
- sensor.sensor2
- sensor.sensor3
to: '0'
for:
Minutes: 5
action:
service: input_text.set_value
data_template:
entity_id: input_text.floor_active
value: '0'
alias: 'Floor active'
trigger:
- platform: state
entity_id:
- sensor.sensor1
- sensor.sensor2
- sensor.sensor3
to: '1'
action:
service: input_text.set_value
data_template:
entity_id: input_text.floor_active
value: '1'
At the moment “floor_active” gets set to “1” when any sensor is active, but never goes back to “0”.
Any help/direction is appreciated. Perhaps there are components which do this kind of functions already.
Thank you