When you setup an output device in Apple HomeKit (lights, motorized blinds, etc) you can create Scenes that act as presets for the device. For example, you can have a scene that changes your RGB lights to green. When you create these Scenes, you can access them in Shortcuts and use itsaSNAP to access an Adafruit IO feed to select a Scene based on a value in the feed.
The device used for this demo is a Nanoleaf RGB lightstrip, but you should be able to adapt these Shortcuts for different devices.
When you view a Room in the Apple Home app, you'll see a section called Scenes where all of your preset Scenes are. If you aren't sure how to use Scenes, you can reference Apple's documentation for them.
For this Shortcut, you'll be receiving data from itsaSNAP rather than sending data to it. You'll start with the itsaSNAP Fetch Feed action to read the most recent data from your feed.
You'll use the Match Text action to check for a value from the incoming feed. Use an If action to check if the values match. If they do match, a Control My Home action is used to run a scene. In the demo, values of 0, 1 and 2 are used to set three different scenes for the RGB lightstrip.
Dashboard Control
You can use a Slider block on an Adafruit IO Dashboard to control the Scene control feed.
Point the block at the feed and set the minimum value to 0 and the maximum value to 2. Set the step size to 1. This gives you a 3 position switch to control your Scenes.
You will notice this is a little clunky though. You need to set the slider to a position on the Dashboard and then run the Shortcut on your iOS device to actually set the Scene. There is a way to automate this process though using Adafruit IO Actions and Shortcut Automations.
Hack the Automations
To add some automation to this process, you'll use Adafruit IO Actions. Actions let you create tasks similar to the Shortcuts you've been using in iOS to have feeds trigger a series of events. In this case, you'll send an SMS message anytime a new value is added to the feed you're monitoring.
The SMS messaging Action is only available for IO+ users. However, if you do not have an IO+ account you can setup the Action to use email instead.

The SMS messaging Action is only available for IO+ users. However, if you do not have an IO+ account you can setup the Action to use email instead.
Create an Action that uses a Reactive trigger. For the Feed, select your lightstrip feed. For Operator, select any. Leave the Feed or Value section blank. This alerts for any new value on the feed. For the Action select SMS (or Email). You can leave the body as the default entry. For ...using select the same lightstrip feed.
You can test this Action by going to your Dashboard and moving the Slider block. When you change the Slider value, you should receive a text.
If you don't want to be notified every time a text comes in, you can toggle Hide Alerts. This lets the process run in the background.
Now comes the hack! Head over to the Shortcuts app and create a new Automation. Select a Message automation if you have an SMS action setup. If you setup an email action, select Email.
Under Sender select the Adafruit IO number. Under Message Contains, enter the name of your feed since it will be in every text from the Action. Check off Run Immediately.
Now when you change the value on the Slider, the feed updates and sends a text to your iOS device. When the text is received, the Shortcut runs and you'll see your device change to the chosen Scene.
Page last edited October 02, 2024
Text editor powered by tinymce.