Get actual state of the smart device programatically from web service smartApp

i am developing a web application which shows the status of the all available smart devices in my hub. and i can also controls the devices from this application.For example if i want to turn on the switch i send “on” commands with appropriate contexts to smartthings api.
In order the send commands, the devices should be active (it should responds to commands) . And i got the state of the device through api call (device.status) but this state found with the device object is not accurate.
For example the Econet valve is actually responding to my commands.but it’s state shows INACTIVE. So I can’t trust on the values get from “device.status” parameter

  1. Subscribe to the Events and/or Attributes of the Devices authorized to the SmartApp. and/or

  2. Read the actual current value of Attribute values by Attribute Name (as listed in the Capability section of http://docs.smartthings.com), not the generic “status”.

1 Like

current value of any attribute can be fetched via above specified method. it is irrespective of state of the device (active or inactive). I wanted to know whether the device is responding to my commands or not

As far as I know, there is no way to tell – read the Documentation, please.

There is a whole section that explains the asynchronous nature of SmartThings … i.e., “eventual consistency”.

When the App or a SmartApp calls a Command, it returns immediately (provided no syntax error). It doesn’t wait for the physical device to respond, for many reasons, but including: Because of mesh networking, or cloud-to-cloud devices, a response can take a long time; and, second, because many different activities could be issuing Commands concurrently, your “on()” command could be cancelled out by some other SmartApp’s “off()” Command.

So the way ActionTiles works, for example, is we issue the Command and usually make no assumption as to what the new State is, or, in some cases like a Garage Door (or like the Tiles in a DTH are programmed to do using the “nextState” parameter…), we change to the interim State and then come back in 30 seconds or so and confirm that we’ve received a State Change Event. If not, we reverse the assumed State of the Tile to reflect the actual current State; we don’t care if the Command “failed” or if the Command was “canceled out” by something else. It doesn’t matter.

In order to know the current value of devices and take actions according to the current value we need to know the device is responding or not. Currently, we cannot rely on the device status like "ACTIVE, ONLINE because even after disconnecting the devices from networks the states doesn’t change.