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?
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.
Do you know how I might be able to write a smartapp for this?
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!
Yes. For example, if I send an “on” command to a switch - and the switch doesn’t receive command - phone shows error message.
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.
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?
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.
In smartapp code, how can I check “which state is received in the Event”?
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.
BTW: There is a chance that something like this can be coded using WebCoRE. Visit their Forum for assistance.