-
Notifications
You must be signed in to change notification settings - Fork 130
Stateless Toggle Switch
This a guide on how to create a Toggle Switch when you are in "Detached" mode.
In this example we will be creating a Toggle state to turn on & off a light, with the single action.
Enable "Detached" mode. see here you should now see a new tile in HomeKit, like below.
Tap on the tile, and you should now see this.
Tap on "Add" on "Single Press" (or any of the 3 actions you wish to program), and scroll to the bottom of the screen.
You should now see "Convert To Shortcut" like below. Tap on it.
You should now see a screen like below.
Now we can start creating our toggle state, we need to add an IF, so in the search box at bottom of screen type IF.
select the 'If' action from the list.
you should now see something like this:
Tap on the word 'Input' and on the next screen tap on "Select a Home Accessory"
You should now see a screen of your accessories, choose the accessory you wish to control (in this example I select "Front Door Light")
and Tap "Done"
You should now have something like this:
now we, need to move the 1st default action that was added, into the If area, Tap and Hold on this action (shown below),
and drag it into the If area. (shown below)
Now we need to create the action what do if the accessory is ON, in this example we are going to turn the light OFF. Tap on "Scenes and Accessories" in the action, in the next screen choose the same Accessory you did before earlier (in this example it was "Front Door Light"), and Tap on Next.
You should see the chosen accessory like below:
In this screen we make sure the accessory is going to be set to the correct state, when the button is pressed IF the accessory was ON, so in this example we turn it OFF. (which it is already set to OFF here, if it is ON Tap the accessory icon to toggle the state to OFF), and Tap on "DONE"
You should now see something like this:
Now we need to Add a 2nd action to turn the Accessory ON, If the accessory was OFF, In the search box, start typing "Control", and you should see something like below:
What we are looking for is "Control xxxxxx", where the 'xxxxxx' is the name of your HomeKit home, in the example it is "Control Test Home". (see below), Tap on it.
This should add a new action box, see below:
We need to move it into the "Otherwise" area like we did before, so Tap and Hold on it, and drag it into the area.
Now we need to create the action what do if the accessory is OFF, in this example we are going to turn the light ON. Tap on "Scenes and Accessories" in the action, in the next screen choose the same Accessory you did before earlier (in this example it was "Front Door Light"), and Tap on Next.
In this screen we make sure the accessory is going to be set to the correct state, when the button is pressed IF the accessory was OFF, so in this example we turn it ON. As you can see the Accessory is set to OFF state which is wrong we need to turn it ON, so Tap on the accessory icon to toggle the state, and Tap on "DONE"
You should now see something like this:
That the script done, you can now Tap on "NEXT", and you should see something like:
then "DONE"
Thats it, you can close this window by tapping on the X in the top right corner. Test the stateless switch to see if it works as expected.
GitHub.com/mongoose-os-apps/schelly-http://192.168.1.139/ota?url=http:/roger.me/files/schelly/schelly-homekit-schelly1-zip