HTTP switch that allows both ON and OFF because it doesn't know state?


So I’m starting to learn more. I jumped in a little early, before I understood ST much. Now I have a HTTP switch, but the tile section shows the state and lets me toggle it. This doesn’t work for me because the state can be manually switched outside of ST, so I’m just admitting I don’t know the state. So, what I’m looking for is how to get a DTH that shows a tile for ON and OFF and just doesn’t pretend to know the state. And, if possible, can I get 2 options for main(), since what would it be since I don’t know state?

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

If you don’t put in the effort to have the switch report its manual change in Switch state to SmartThings, then you have to be content that standard switch Tile (i.e., which operates as Toggle) won’t work… Unless the user can physically see the result and is willing to press it twice whenever necessary.

Instead, you should use two sub-Tiles (one for on, one for off).

The cleanest replacement for the Main Tile is likely a Momentary Tile which does not show the current state but instead issues a Toggle command which you could program into the receiving device as an http endpoint.

BTW: The ZigBee definition for Switch firmware actually supports offering a Toggle command in addition to on and off.

(Justin Wurth) #3

If the switch is an http switch does it have some mechanism to send json? If so you have a means to check status. I would have to think a device that can accept a command can also send one. Parsing Json is not simple, but not overly complex. I did something similar for the particle photon both for the window blinds and now for the RGB lights. You can look in my profile for those for an example.