Skip to content

Instantly share code, notes, and snippets.

@sshimko
Created January 30, 2023 00:53
Show Gist options
  • Save sshimko/f2a064d4d28e7234363d327cb915a572 to your computer and use it in GitHub Desktop.
Save sshimko/f2a064d4d28e7234363d327cb915a572 to your computer and use it in GitHub Desktop.
Home Assistant Script: Check for faulted Ring contact sensors and identify them through a media player
alias: Speak Faulted Alarm Sensors Script
description: ""
sequence:
- service: tts.cloud_say
data:
entity_id: media_player.office_sonos
message: >
{% set lst = states.binary_sensor |
rejectattr('attributes.device_class', 'undefined') |
selectattr('entity_id', 'in', integration_entities('mqtt')) |
selectattr('state', 'eq', 'on') | selectattr('attributes.device_class',
'search', 'window|door') | map(attribute="name") | unique | join(" and
") | regex_replace(find='Sensor', replace='', ignorecase=True) %}
{% if lst %}
The following windows or doors are open
{{ lst }}
{% else %}
All windows and doors are secure
{% endif %}
mode: single
icon: mdi:home-group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment