Hello everybody,
I’m trying to create an automation, which sends an notification if a device which uses the ping ICMP integration is down. Until now I have put every device explicitly in the automation. Is it possible to use a template or something like that to apply the notification-automation to every entity which is checked via icmp?
The issue with your template trigger is that doesn’t render to a boolean value. Template triggers fire when their rendered value changes from false to true… yours will never do that. The most accurate way to do what you want is to use a State trigger like in your first example, but you can condense it into a single trigger:
Ok, got that. But isn’t there a way to modify the trigger template? My hope was that there is a smarter way than putting all the entities explicit in the trigger.
The next problem after managing the trigger will be the value of the “trigger.*” variables in the actions.
The doc says they are positioned by a template trigger, but I have no clue how that would work.
Not really. The second-best option is to create a template sensor that counts the number of non-“on” ping entities. Set a State trigger for that sensor with a trigger-attached variable to save the state object of all ping entities as the trigger fires. Then use a template that sorts and selects by last_changed of the saved ping entities’ state objects to get the name for your message.