Smartapp to check if device received command


(Jack) #1

Hi,
I have this issue where my device may not always receive an on/off command from my phone. So I want a smartapp that can tell me whether or not the device has received the on/off command. Is there any smartapp that can already do that?


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

Most (not all) Device Type Handler GUIs will indicate on the Tile whether or not the device (Switch…) has changed State.

It’s possible to write a SmartApp for this, but I’ve never heard of anyone attempting or bothering…

It’s solving a problem that you hope doesn’t exist. :confused:


(Jack) #3

Do you know how I might be able to write a smartapp for this?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #4

Do you have a specific simple use case example?

Conceptually the SmartApp is not complicated, but it is not going to work in SmartThings’s native architecture.

The only “practical” way I can think of would require a Virtual Device for each Physical one!


(Jack) #5

Yes. For example, if I send an “on” command to a switch - and the switch doesn’t receive command - phone shows error message.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #6

A well written DTH for a Switch will have it’s on/off Tile temporarily read “Turning On” or “Turning Off” (using the nextState Tile option…) until it receives the act new State message from the physical Switch.

Regardless, you could use a Virtual Switch for every Physical Switch and have a SmartApp relay your taps to the Physical Switch, set a timer, and then check current State.

It might work, but it would be a very cumbersome bandaid that SmartThings would not process efficiently.


(Jack) #7

How exactly would the smartapp check if a device received the command? What exactly does a smartapp look for to check if a command has been received?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #8

currentState … and/or subscribing to the Physical Device and seeing which state is received in the Event and somehow deciding if that is related to the last use of the Virtual Device and reacting accordingly.


(Jack) #9

In smartapp code, how can I check “which state is received in the Event”?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #10

https://docs.SmartThings.com


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #11

Your task is really a very, very complex SmartApp. I would recommend having much more experience with simple SmartApps before attempting this. Or hire a consultant to custom develop.

or…

BTW: There is a chance that something like this can be coded using WebCoRE. Visit their Forum for assistance.