I am now moving my HA experience from just adding devices and and a good switch and status dashboard to automations. Currently I only have one automation that turns some lights on 30 mins before sunset for instance. LOL.
I have a number of doors in my house, all have Zigbee sensors on them. It is easy to look down the list and see if a door is open but it would be better if I had a master status which would be on if all sensors are closed and off if any sensor is open.
Purpose would be to easily see that status before bed to see if we have left a door open.
Can anyone point me to an example or direction on how to start going about doing this?
Use Group as mentioned by tom_l and then use an automation to notify you if some doors/windows are left open. Group state will be ON if at least one of the entities inside the group are OPEN.
(1) Create a group consisting of all the doors and windows that you want to check-
(2) Create an automation to notify you. As an example, routine check will be performed at 22:00. This will also notify you if the group is opened between 22:00 to 05:00 (burglar forced open).
trigger:
- platform: state
entity_id: group.security_breach
to: 'on'
- platform: time
at: '22:01'
condition:
- condition: time
after: '22:00'
before: '05:00'
action:
- repeat:
until:
- condition: state
entity_id: group.security_breach
state: 'off'
sequence:
- service: notify.mobile_app_your_name
data:
message: >-
{% set wd = expand('group.security_breach') | selectattr('state', 'eq', 'on') | map(attribute='name') | list | join(", ") %}
{% set x = ', and ' if wd.split(', ') | count > 2 else ' and ' %}
Alert! {{x.join(wd.rsplit(', ', 1))}} {{'are' if wd.split(', ') | count > 1 else 'is' }} opened in the house.
- delay: '00:00:30'
I’ve got through step one thanks to the great advice.
I setup a group and that works well.
# group config to determine if the house is secure or not
house_is_secure:
name: House is Secure
entities:
# Alfresco Back Door
- binary_sensor.ewelink_ds01_XXXX_ias_zone
# Alfresco Sliding Door
- binary_sensor.ewelink_ds01_XXXX_ias_zone
# Back Sliding Door
- binary_sensor.ewelink_ds01_XXXX_ias_zone
# Front Door
- binary_sensor.ewelink_ds01_XXXX_ias_zone
# Garage Side Door
- binary_sensor.ewelink_ds01_XXXX_ias_zone
# Garage Door
- sensor.garage_door_is_open
I didn’t like the on / off output and wanted it to be a more readable status for Love Lace so I setup a sensor to monitor the group and output text I like.
# config to monitor the status of the house_is_secure group and set a sensor to friendly values
house_is_secure:
unique_id: house_is_secure
friendly_name: House is Secure
value_template: "{% if is_state('group.house_is_secure','off')%}Secure{% elif is_state('group.house_is_secure','on')%}Not Secure{% endif %}"
Would have been perhaps easier to be able to add a device class to the group but after reading the docs it didn’t seem that was an option.
Now to progress and do the notifications and automation bits as exampled above.
I added the above house_is_secure sensor to Love Lace.
Unlike other information on Love Lace this is the only item I have that doesn’t change colour (to yellow) as the status changes. I assume this is because it can’t differentiate between my manual values as to which should be yellow or not.
Is there a way to set the icon colour manually based on the value?
Set up a binary template sensor, instead of a sensor. Only binary entities (switch, input_boolean, binary_sensor) change colour. Add a device class to have the state labels change in the front end.