I am currently having some issue with the RESTful sensor and maybe need someone to point out any obvious misconfiguration.
I am trying to create a sensor to refresh an access token for home connect but only every x hours since there is a rate limit (max. 100 / day) and the access token is valid for 24 hours.
The sensor keeps polling every 30 seconds regardless of the configured scan_interval. I have already restarted HA
Do you have any ideas on this?
Why is my “scan_interval” not working as intended - I have viewed the code of the component and as far as I can see it should work this way.
Thanks!
I’m not so sure. This may have worked at some point, but the rest platform is now using a shared coordinator that appears to take its configuration from the rest integration, and otherwise falls back to DEFAULT_SCAN_INTERVAL which is defined as 15 (seconds). Unfortunately that does not explain the behaviour you observe.
Neither of those docs even mention a scan interval, other than in one random, unrelated example each. Am I missing something, or is this just a “hidden” attribute?
The jinja template in the header doesn’t seem to evaluate - I can’t really prove it but I get an “access token malformed” error. And even with log_level debug for the rest component the curl isn’t visible.
Anyone have noticed the same?
Or has someone a different idea to get the refreshed access_tokens into the header dynamically?
— edit —
Ok I have seen somebody has already worked on the templating for headers and the change was merged into homeassistant-dev 3 weeks ago. Hopefully it will arrive in the next (minor) release
Ok, I am very confused (but I must confess to not even realising that there was a new REST integration (although it isn’t that new)
But anyway…
I am using the old format and use scan_interval which I am pretty sure must be working else I think I would have been blocked on a few endpoints by now for over using them.
And…
I wish someone would update it to allow !secrets in a templated resource / resource_template
Sorry for my post, is a bit offtopic but related with those access tokens we get from Home Connect.
Im using the official Home Connect integration, everything works like i want, till the token expires ( didnt noticed if thats 12 hours or 24hours ). But after that, all my automations stops working.
You speek about a scan_interval and a rate limit of 100/day … but it looks like you using a different approuch to connect to your devices, right ?
For this particular use case I have switched to the „Home Connect Alt“ Integration installed through HACS and never looked back - it works absolut flawless!