Best way to report status of lights, locks, doors, etc

I’d like the ability to send a notification with details if lights are on, locks are unlocked, etc.

Basically, when I leave I turn off lights, lock doors, close garage. After X minutes, if any of those items are still on, unlocked, open, etc. I’d like a friendly notification telling me what is not as I expected it to be.

Same thing with by good night routine, would like to get a notification if something is not as expected.

I’d like it to be something like this:
The House is set to Away but some devices are not as they should be
Living room fan is on
Back door deadbolt is unlocked
Bathroom outlet is on

I think a list would be easiest, does not have to be a perfectly formatted sentence.

Honestly, right now I would rarely get notficiations, overall my stuff has been working well. This is for the time that its not working well for some reason.

Assuming you have a group of the entities you care about, and they are all binary entities with the states of either ‘on’ or ‘off’ (where ‘on’ is the “bad” state), then you could get a list of these entities with this:

{% set devs = state_attr('group.my_group','entity_id') %}
{{ states|selectattr('entity_id','in',devs)
         |join(', ') }}

If you want a little something different, just let me know.

I get the gist, I like it. I’d need to modifiy to add “unlocked”, and “open”, but I have different groups for my locks, and my garage door, so I could just do three different copies of the above, just with different states.

Pretty cool

Are you sure the actual states of those are ‘unlocked’ and ‘open’, or is that just what it looks like in the frontend? If they really are ‘unlocked’ and ‘open’, then you could do this:

{% set devs = state_attr('group.my_group','entity_id') %}
{{ states|selectattr('entity_id','in',devs)
         |join(', ') }}

Definitely locked/unlocked and open/closed. I have a few automations that trigger based on the state changes.

My open/close sensors are on/off though. but open/closed in the front end.

Super awesome BTW, thanks for the quick turnaround. This should be pretty easy to set up. Thanks again

1 Like

If you have multiple groups already that contain the collection of entities you care about, you could define devs this way (instead of needing to create a new group that contains all the entities):

{% set devs = state_attr('group.group1','entity_id') +
              state_attr('group.group2','entity_id') + ... %}
1 Like