Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 99103

Help with automation for any entity within device_class

$
0
0

@obrienlabs wrote:

I’m trying to get this automation to fire for every entity with device_class of door. When the state changes I want to get notified. I also don’t want to have to list every entity_id manually, looking for an automated way to get this automation to work. Thoughts?

Can’t quite figure out the trigger.

- id: '1590437448747'
  alias: Notify if any door opens
  description: ''
  trigger:
    platform: template
    value_template: '{%- for item in states.binary_sensor -%}{%- if item.attributes.device_class == "door" -%}true{%- endif -%}{%- endfor -%}'
  condition:
    - condition: template
      value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'
  action:
  - data: {}
    service: notify.discord_webhook
    data_template:
        message: '
        {% set option = trigger.to_state.state %}
        {{trigger.to_state.name}} is now {{ "open" if option == "on" else "closed" }}'

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 99103

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>