MoreHue.com

For everything you need to know about smart homes, home automation, Philip Hue and much more.

GuidesNews

Sending HTTP Requests with the Violet SmartSwitch Lite

Sending HTTP Requests with the Violet SmartSwitch Lite

HTTP Requests with the Violet SmartSwitch Lite (by @casparrubin on Unsplash)

Last year, Violet did build a SmartSwitch Lite and brought it to the market in the summer. But as it was still quite new there were lots of ways to improve the product. Initially, the SmartSwitch could only set a scene in your selected room and turn on the Sonos. But since then they kept improving their device. With version 1.6.0 the largest update up until now came out, the HTTPviaSD plugin.

What is HTTPviaSD

The HTTPviaSD plugin allows users to load their custom configuration file onto the SmartSwitch Lite via an SD card in the SD card slot to load an HTTP request onto a scene button. With this option, you can link up to IFTTT, any control system imaginable, or even Home Assistant.

The configuration file is a well-designed YAML file. It’s a simple process of adding any scene labels and sub-labels you want to the file along with the HTTP request. Once you have loaded the file onto a SmartSwitch Lite through the SD card slot, you can add, edit reorder or remove the scenes as necessary.

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

With this YAML file, you can add all the buttons you want. But remember that the Violet SmartSwitch Lite can only show up to 8 buttons. The version in the YAML file must be present and set to 1.0. The scenes field within the YAML file is a dictionary object with unique string IDs. Each scene has a label, subtext (label2), and request. The label and subtext are shown as buttons. The request needs a request destination URI and HTTP method (GET, POST, PUT, PATCH, DELETE) where GET is the default. You also have the option to supply headers as key-value pairs and a body as JSON.

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 configuration file and re-insert the SD card. Modified existing requests will be identified by their unique ID.

In the settings menu, navigate to Integrations > HTTPviaSD then press Edit followed by Load File.

Share this post

About the author

Leave a Reply

Your email address will not be published.

Hey, wait!Join our community

Join our community and subscribe to the newsletter to receive the latest and greatest updates about smartening up your home.