Why Offline Device takes ON/Off Command Via SmartThings Control API

I have created Web App to control SmartThings Devices via webpage.
I have done OAuth implementation and control devices via my webpage.
All devices I get using device - https://api.smartthings.com/v1/devices
And show all devices in my webpage, from here i can send command to devices.

One of my device is offline state.
But if I send ON command then that command is accepted by SmartThings Server.
But device will not on, as it is offline status.
So this command should not be accepted but i get -

Why is this so ? It should not be accepted
how do i check status and give user notification that device is offline.

You can try this

1 Like

I believe the API returns ACCEPTED for commands if they are valid. The commands get queued up to run.

OFFLINE means that SmartThings has been unable to confirm the device is online, perhaps because it isn’t doesn’t know, or there isn’t, a reliable way to find out. The mobile apps assume a device is actually unusable when it is marked offline, but automations and things don’t care and will attempt to send commands anyway.

You can subscribe to the health status in a similar way to device events, or request it when querying the device state.