I am trying to pull some information into HA via a RESTful sensor that requires authentication. The process works like this:
First I need to POST login information which returns a token and then I can use GET (including that token as a header) to pull the information I need. The token expires every few hours, so this process will need to be repeated.
I’ve tried to do what I want with the following code in my config:
The first step (POST) works, and when I throw "{{ “Bearer " + states.sensor.myauth.attributes[“data”].access_token }}” in the template editor, it spits out what I want, but my data sensor just shows as “unknown”.
Can HA just not accept a template in one of the headers or am I doing this wrong? And if it is the former, is there another way to get the information I want?
I too am also looking to do this. I have an Inner Range Inception security system with a REST API, but it requires the authentication to be sent, then a session ID received and used to as part of the body of POST requests.
If anyone knows how to do it, please let us all know.
I did solve this, but you aren’t going to like the answer haha. The only way I found to do it was to write a custom component / platform in Python. Happy to help you through my process - though full disclosure, what I did is definitely not as robust as what the real developers and people with more experience than me do.
I have recently acquired an Inception panel for home, just wondering if you ended up having any luck with home assistant integration? I’ve been playing around with API a little with no success. Can get them to talk over TCP but its a bit dodgy. Any help would be greatly appreciated.