#How to create a notification when any smoke detector detects smoke or carbon monoxide?

1 messages · Page 1 of 1 (latest)

glass yew
#

I have three smoke detectors and I'd like to send a notification when any of them detect smoke or carbon monoxide.

However, I also want to include the device name (ie. "Upstairs Smoke Detector") in the message.

How can I do this?

#

How to create automation when any smoke detector detects smoke or carbon monoxide?

#

How to create a notification when any smoke detector detects smoke or carbon monoxide?

obsidian sage
#

If the smoke detectors are in a group you could do something like:
{{ expand(['group.smoke_detector']) | selectattr("attributes.friendly_name", 'defined') | join(', ', attribute="attributes.friendly_name") }}

surreal kestrel
#

Add all smoke detectors as triggers. Then in your notification use trigger.entity_id to get name.

#

Well, it'll get ID, but next step is getting friendly_name attribute 🙂

obsidian sage
#

Yeah, depends if you want individual smoke detectors listed or all of them listed in the notification

#

Also change the automation mode to parallel or queued to ensure you don't miss any if 2 smoke detectors trigger close to each other

opal spruce
#

The nice thing about HA is there are multiple ways to skin this cat. You can use @obsidian sages idea of a group of them and use the query in a template to grab them, but you have to remember to add new detectors to that group. You can do the trigger method that @surreal kestrel suggested, but you have to remember to add them to the automation (this is how I do it because I have a finite number of them ever), or you can use a twist on @obsidian sages idea to find all smoke detectors in your home, even if it was added 2 seconds ago and use that as your template:

{{  
  states.binary_sensor |
  selectattr('attributes.device_class', 'defined') |
  selectattr('attributes.device_class', 'eq', 'smoke') |
  rejectattr('state', 'in', ['unavailable', 'unknown', 'off'])
  | list
}}