How to evaluate a Rest response only once a day?

If I want to evaluate the response of a GET rest call, I have to create a sensor with platform: rest, correct?

If so: how can I evaluate that rest call only once a day?
In may case, I want to fetch the battery status of a device in my home from its rest endpoint. But it would be sufficient to fetch it only once every 24h (and not every 30s which is the default for a sensor).

Is the solution to add a scan_interval: 86400 to the sensor config?
And then create an automation on that sensor to check the state (of the response)?

Yes. Possibly… see below.

Yes. Noting that it will only update once per day. And you have no control over when. It could be at 3am it could be at 7pm. I think it would depend on when you last restarted home assistant. Which could be a problem. If you restart home assistant every day the sensor wont update as the update timer keeps resetting.

If that is indeed a problem. You could set a really long update interval (e.g. a week) and have an automation trigger once per per day (time trigger) at a time you would like then in the actions use the update entity service to update the sensor.

Your other automation could then be triggered depending on the sensor state.

Or use the 86400 thing and add a homeassistant event to trigger on start… either would work.

1 Like

@tom_l ok great idea. But then I’d better go for checking the state every 12h, so I can ensure it is checked at least once during the day.

Can I somehow enabled editing of the rest-sensor in the ui? I did only find the way of adding it in the configuration.yaml, and then it is shown read-only in Entities Overview.