My smart home setup
Now it's really a reality and I've been not only utilising stuff by other people but also adding features to it using my own programming skills. This month I improved ZPE to make it possible to receive webhooks from the IFTTT service and then turn them into commands on my home setup.
Something really annoyed me about both IFTTT and my Samsung Smartthings Hub - there was no toggle option for my desk light! I hate having separate on and off buttons because space is limited on my Apple Watch display. So instead, I came up with an idea. To demonstrate the idea, I've visualised it below and how it works:
The biggest issue here is that Smartthings stores no state information on these devices and they themselves are stateless. I had to devise a way to give them a state and store it appropriately. It involves another step but it works in all cases.
If I press the toggle button on my Apple Watch (stage 1), it sends a request to my home server (stage 2). The server then figures out if the device is on or not by checking the database and then decides whether to send another request to turn that device on or off based on this.
When a device is switched on or off (stage 3) a request to my server is made and it sets the value stored in the database so that on becomes the state of the device (stage 4), Smartthings triggers this appropriately when the device state is changed.
However, my Watch isn't the only way it can be triggered. For example, Alexa can turn on and off those devices too. This is where the problem initially occurred but it was actually an easy fix since Alexa jumps past stage 1 and 2 and just goes straight for stage 3 (hence the second start arrow). Since the toggle adds a new layer of requests it does take slightly longer but it also means I'm not limited to just doing it with it and can do it from my PC. In fact, I've begun to write programs to do it on my Mac too.
All communication is encrypted between end-points and the communication is carried out through secure requests and specialised code.