Page 1 of 1

HTTP Device with auth Bearer Token

Posted: 18 Jan 2024 23:17
by MadMAX
Hello,
i am trying to create a device which get its values from Home Assistant.

So I tried to use the HTTP Device and Virtual Device (Javascript) but i just not skilled enough to get the value via the RESTful API of Home Assistant.

The URL i like to read is

Code: Select all

http://192.168.111.17:8123/api/states/sensor.temperature
but it need the Bearer token in the header of the request to access.

Code: Select all

headers: {
      'Authorization': 'Bearer <token>'
   }
Who would the URL or the code (Javascript) would look like to get access?

Thanks in advance.
Regards Max

Re: HTTP Device with auth Bearer Token

Posted: 19 Jan 2024 19:41
by PoltoS
You can use Code Device with http.request.

Please check this manual: https://z-wave.me/manual/z-way/JavaScri ... 0000000000

Re: HTTP Device with auth Bearer Token

Posted: 19 Jan 2024 23:18
by MadMAX
Do you mean virtual device (JS)? i dont have an applikation with the name code device!

Re: HTTP Device with auth Bearer Token

Posted: 20 Jan 2024 03:06
by PoltoS
Yes, Virtual Device. As I remember, it is called CodeDevice internally

Re: HTTP Device with auth Bearer Token

Posted: 11 Apr 2024 11:59
by flabbyburnish
Many codes used. Is there any method to differentiate?

Re: HTTP Device with auth Bearer Token

Posted: 12 Apr 2024 01:17
by PoltoS
Please clarify your question

Re: HTTP Device with auth Bearer Token

Posted: 08 May 2024 11:20
by cashewsslate
What happens happy wheelsif you use the token of all?

Re: HTTP Device with auth Bearer Token

Posted: 10 May 2024 01:30
by PoltoS
Do you mean not at all? You will get no data. If you add an anonymous user or enable the Z-Wave/Zigbee API with no authentication, you can connect without the token. But this is not recommended for production unless you know what you are doing