The HTTPviaSD feature allows you configure scene buttons on Rithum Switch to send an arbitrary HTTP request when pressed. You can also set the standby screen hold gesture to trigger sending a request, and finally you can also use HTTPviaSD with Rithum Stat.
The configured HTTP requests can also be selected as the 'heat on' or 'heat off' actions for Rithum Stat.
The Requests Configuration File
The configured requests are loaded onto the switch via a YAML file named requests.yml
present on an inserted SD card. The format of the file is as shown in the following example:
---
version: 1.0
scenes:
id1:
label: Scene 1
label2: Subtitle 1
request:
uri: https://reqbin.com/echo/post/json
method: POST
headers:
Content-Type: application/json
body: '{ "key": "value" }'
id2:
label: 'Off'
request:
uri: https://reqbin.com/echo
If you’re new to YAML then please read this first: YAML - Basics
Note that the SD card must be formatted as FAT32.
A description of the fields are as follows:
version
- must be present and set to 1.0
scenes
- dictionary of scene objects keyed on a unique string ID
A description of the scene object fields are as follows:
label
- mandatory, string for the label to be shown on the scene button
label2
- optional, string for a subtitle label to show on the scene button
Note that On and Off are valid YAML values for boolean true/false and therefore will not be interpreted as being strings. If either label needs to show On or Off alone as a single word then they will need to be enclosed in quotes to make them strings.
To avoid any similar issues, we recommend that all label strings be enclosed in quotes.
request
- mandatory, object with fields as follows:
uri
- mandatory, string specifying the request destination URI
method
- optional, string specifying the HTTP method (GET, POST, PUT, PATCH, DELETE) - GET by default if not specified
headers
- optional, dictionary of key/value pairs to send in the request
body
- optional, string data to be sent in the body of the request. Note that this must be a string and therefore it may be necessary to enclose it within single quotes as shown in the example
Loading the Requests File
In the settings menu, navigate to Integrations > Add Integration > HTTPviaSD > Import from SD card
With the SD card inserted, press Load File. The requests file will then be loaded with any errors being notified. When successfully loaded there will be an option to be taken to the Scenes Screen configuration menu where the loaded scenes may then be selected for inclusion on the Scenes Screen.
If a “Failed to parse requests.yml” error is encountered then upload the file to the online YAML validator tool at Best YAML Validator Online which will check it for any syntax or formatting errors.
The SD card can be removed after the requests have been loaded.
Modifying Requests
To add, modify, or remove the requests, modify the requests file and re-insert it. Existing requests to be modified will be identified by their unique ID.
In the settings menu, navigate to Integrations > HTTPviaSD then press Edit followed by Load File.
A simple working example of a requests.yml file is attached to this article which can be used as a starting template or for testing.
Comments
4 comments
Dear Support,
I've created a requests.yml file and put it on the root of a FAT32 formated 2GB microSD card
When I try to add it (Integrations > Add Integration > HTTPviaSD > Import from SD card) I get the message: request.yml not found
Tried to format I from an other PC of Mac but no succes.
What can I do?
Hi Ernst,
We have created a ticket for this and requested more information from you through there. We will report back to this thread once we have resolved with you directly.
Hi Support,
I experience the same issue. What was the solution? How can I load my requests.yml file onto my Violet Switch?
BR Tobias
Hi Tobias - We have created a ticket for this and will request more information from you through there.
Please sign in to leave a comment.