Receive notification if a switch stays on too long (after xx minutes)?

How would you solve this issue?

Trigger:
  Platform:state
  Entity_id: 
    - switch.name_of_the_switch
    - switch.name_of_another_switch
    - light.coud_also_be__light
    - media_device.also_possible
  State: 'on'
  For:
    Minutes: 20
action:
  service: notify.NOTIFIER_NAME
  data_template
    message: '{{ trigger.entity_id.friendly_name }} Is ON fo more than 20 minutes'

Not entirely sure about the .friendly_name addition though.

thanks!!

would you do one for each entity_id for more reliability, or it doesn’t matter?

I think this cannot be done,

Looks a bit like that this could be done with the new alert component as well.

https://github.com/home-assistant/home-assistant/pull/5201

1 Like

is it available in 37.1?

No, in 0.38 which will be released in the next couple of hours.

cool!!

For my need, is it better the alert or the automation (or is the same)?

Why do you think that it cannot be done?

See the Automation Trigger page on the HASS website, an example with multiple entity_id’s is given there too.

It is basically a shortcut to avoid that you would need to repeat the same lines for each of the entities.

For triggers, only one of them must be triggered to launch the automation.

For conditions however, if you define multiple, all of them must be True. Unless you use the logical operator OR but that leads us too far from your initial question, which doesn’t require any condition anyway.

my mistake, it gave me an error and though was the multiple entity, but was just a sintax error made by me