FanGuy
February 26, 2023, 5:43pm
1
switch:
- name: fanswitch2
platform: rest
resource: https://xxx.xxx.net/api/xxx/SetFanState2
body_on: '{"active": true}'
body_off: '{"active": false}'
is_on_template: "{{ value_json.active }}"
headers:
Content-Type: application/json
Authorization: Bearer xxx
this config produces no errors, but also no entities in the HA interface.
it also does not call the API at all.
so what’s going on here???
WallyR
(Wally)
February 26, 2023, 5:57pm
2
The xxx you have after api in the URL is typically a token and a token is linked to a specific device, so you can not just copy it from another device.
FanGuy
February 26, 2023, 6:05pm
4
just to be clear xxx is something I have taken out to post here,
these are filled in on my yaml file
WallyR
(Wally)
February 26, 2023, 6:06pm
5
Ok, then test the URL in a browser to see if it shows correctly
FanGuy
February 26, 2023, 6:12pm
6
all the endpoints I want to use work fine in postman. all valid returns and such.
the main issue is the API is not getting called from HA full stop
when I try with postman I can see the API getting hit
I don’t understand with HA won’t even hit it
tom_l
February 26, 2023, 6:27pm
7
It looks like you have just copied the example from the documentation without adjusting the payloads or templates to match your resource.
FanGuy
February 26, 2023, 6:29pm
8
i built a resource to match it in C#,
I made my own API for it to use
it just won’t call them at all
tom_l
February 26, 2023, 6:36pm
9
I know nothing about C but I see nothing there that sends the json payload {"active": true}
FanGuy
February 26, 2023, 7:18pm
10
so you’re looking at an endpoint, you are right in that it returns nothing,
the problem is that I’m not even getting that far to needing a return.
the API endpoint is not getting called at all from HA.
which is my main problem