I am using rest api to retrieve time for 5 different instances. Then using trigger template to set automation for the same time retrieved from the api. Automation not triggering when the time comes.
Well of course it’s false. It will only be true when the current time is exactly the same as today’s Asr Time. That’s the purpose of using it in a Template Trigger.
If you’re interested, here’s a completely different, and more efficient, way to do it.
The following configuration defines six RESTful Sensors. The first five sensors show each of the five prayer times as timestamps (meaning they look like this: 2022-01-21T20:31:00+00:00). This is important because it means they can be used in a Time Trigger. The sixth sensor is included for convenience and it shows the five prayer times (as attributes) in the traditional HH:MM format.
Now if you want an automation to trigger at all five prayer times you can simply use a single Time Trigger:
alias: example
trigger:
- platform: time
at:
- sensor.fajr
- sensor.dhuhr
- sensor.asr
- sensor.maghrib
- sensor.isha
condition: []
action:
... whatever it is you want to do ...
If you want to display the prayer times in an Entities Card, here’s the required configuration: