Switch states report via IFTTT and Automation

I need a simple (or complex, i don’t know) automation for check all switch ON status every hour and send me an IFTTT message.

Like:
“Main Entry, Toilet, Balcony switches are ON…”

any advice?

Thanks,

belek

Check the dev-template, it’ll give you a good start point with a for loop:

Thank you for your assistance.

Here is my “Switch Status Check” automation. It’s running every hours and send switch states to IFTTT notifier.

- alias: Switch Status Check
  trigger:
    platform: time
    hours: "/1"
    minutes: "00"
    seconds: "00"
  condition:
   condition: time
   after: '09:00:00'
   before: '18:00:00'
   weekday:
     - mon
     - tue
     - wed
     - thu
     - fri
  action:
    - service: ifttt.trigger
      data_template:
        event: HA-START
        value1: >
         {% for entity in states. group.all_switches.attributes.entity_id if is_state(entity, 'on') %}
           {%- if loop.first and loop.last %}
             {{ states[entity.split('.')[0]][entity.split('.')[1]].name }} açık
           {% elif loop.length == states. group.all_switches.attributes.entity_id|length %}
             {{ "Tüm lambalar açık" if loop.last }}
           {% else %}
             {%- if loop.first %}{% elif loop.last %} & {% else %}, {% endif -%}
             {{ states[entity.split('.')[0]][entity.split('.')[1]].name }}{{ " açık" if loop.last }}
           {%- endif -%}
         {% else %}
           Tüm lambalar kapalı
         {% endfor %}
1 Like