How to send cURL command to Kiosker IOS APP?

Hey all

I hope you can help me.
I run the Kiosker IOS app on an Ipad to show my home assistent Dashboard.

The Kiosker has an what I think is called Rest API option.

I got this working from another ipad with an APP called API tester

as an example I can send the command below

is it possible to send this via an automation in HASS? and if so how? I’m guessing it needs to be set in the configuration.yaml

But Can someone show me HOW to do it? I need the Bearer thing in the commands :slight_smile:
Thank you all in advance!

/Thrawn

curl -X POST ‘http://111.222.33.444:8081/api/v1/screensaver/state’ -H ‘accept:application/json’ -H ‘Content-Type:application/json’ -H ‘Authorization:Bearer token’ -d ‘{
“disabled”: false
}’

I’m guessing a REST switch.
Re the bearer token, “Kiosker” should document how to get it.

1 Like

I Got the token :slight_smile: just removed it for the example

I’ll look at it thank you for your time

I took at a look at it.

I dont have the understanding or knowledge or maybe logic to turn this:

curl -X POST ‘http://111.222.33.444:8081/api/v1/screensaver/state’ -H ‘accept:application/json’ -H ‘Content-Type:application/json’ -H ‘Authorization:Bearer token’ -d ‘{
“disabled”: false
}’

into this:

switch:
  - platform: rest
    resource: http://IP_ADDRESS/led_endpoint
    body_on: '{"active": "true"}'
    body_off: '{"active": "false"}'
    is_on_template: "{{ value_json.is_active }}"
    headers:
      Content-Type: application/json
      X-Custom-Header: '{{ states("input_text.the_custom_header") }}'
    verify_ssl: trueb

I mean I know where to get the URL from but the rest i do not understand :frowning:

switch:
  - platform: rest
    resource: http://111.222.33.444:8081/api/v1/screensaver/state
    body_on: '{"disabled": true}' # guess
    body_off: '{"disabled": false}'
    is_on_template: "{{ value_json.is_active }}" # This is how you get the current state; optional
    headers:
      Content-Type: application/json
      Accept: application/json
      Authorization: Bearer token
1 Like

Thank you that is VERY kind of you.
I have put this in the configuration.yaml and rebooted HASS

how do I find the switch for an automation?
can i name it just by adding
name: some name
?

If you don’t specify a name, the default is “Rest switch”, according to the doc.
As for automations…

1 Like

Thank you :slight_smile:
Yes I know how to make automations in general.

It’s just that this new switch does not show up anywhere. Yes I read about the Rest switch but there is no such device nor entity.

So I can only conclude i did something wrong in my configuration yaml :frowning:

Did you check the HA log?

1 Like
`
Logger: homeassistant.components.rest.switch
Source: components/rest/switch.py:112
integration: RESTful (documentation, issues)
First occurred: 17:01:41 (1 occurrences)
Last logged: 17:01:41

Got non-ok response from resource: 401

`

401 likely mean your bearer token is not correct.

Does it need to be Authorization: Bearer 1234567
or
Authorization: 1234567?

I copied pasted the token directly from the api test app where I can send from…so it should be right…can try again though