When you setup the smart outlet in Apple HomeKit, you can access it in Shortcuts and use itsaSNAP to access an Adafruit IO feed to turn the outlet on or off. You can download the Shortcut via the link below or build it out yourself using the steps below.
For this Shortcut, you'll be receiving data from itsaSNAP. 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 link into the outlet in Apple Homekit. Values of 0 and 1 are used to toggle the outlet on or off.
In the Control My Home action, you'll be able to choose your smart outlet and select whether you want the action to turn the outlet on or off.
Hack the Automation
To add some automation to this process, you'll use Adafruit IO Actions. Actions let you create tasks similar to the Shortcuts 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 lights 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 lights feed.
You can test this Action by sending a 0 or 1 to your feed with the CircuitPython code on the Feather, the itsaSNAP app or in a browser with Adafruit IO directly. When you change the 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 with the button attached to the Feather, the feed updates and sends a text to your iOS device. When the text is received, the Shortcut runs and you'll see your outlet turn on or off.
Text editor powered by tinymce.