MakerAPI - can we tell if device is offline?

Hi,

I've been using the MakerAPI for a few days now and was wondering if we can tell if a device is 'offline'? For an outlet maybe that means it's unplugged.. or a light bulb was turned off at the switch.

As an example, I tried to send a 'OFF' request to this device but never got an update (I'm using a websocket to listen for updates). If I can tell the device is offline I won't send the request.. or, is there some error/timeout message I should be getting?

NOTE: I do see that "power" attribute which is "0". But, I also see that value for another device which is online so not sure it's helpful here

REQUEST: GET http://192.168.0.202/apps/api/38/devices/66/off

RESPONSE:
{
    "id" : "66",
    "name" : "Generic Zigbee Outlet",
    "label" : "Outlet 1",
    "attributes" : 
    [
        
        {
            "name" : "power",
            "currentValue" : 0,
            "dataType" : "NUMBER"
        },
        
        {
            "name" : "switch",
            "currentValue" : "on",
            "dataType" : "ENUM",
            "values" : 
            [
                "on",
                "off"
            ]
        },
        
        {
            "name" : "switch",
            "currentValue" : "on",
            "dataType" : "ENUM",
            "values" : 
            [
                "on",
                "off"
            ]
        }
    ],
    "capabilities" : 
    [
        "Switch",
        
        {
            "attributes" : 
            [
                
                {
                    "name" : "switch",
                    "dataType" : null
                }
            ]
        },
        "Configuration",
        "PowerMeter",
        
        {
            "attributes" : 
            [
                
                {
                    "name" : "power",
                    "dataType" : null
                }
            ]
        },
        "Sensor",
        "Actuator",
        "Outlet",
        
        {
            "attributes" : 
            [
                
                {
                    "name" : "switch",
                    "dataType" : null
                }
            ]
        }
    ],
    "commands" : 
    [
        "configure",
        "off",
        "off",
        "on",
        "on",
        "refresh"
    ]
}

I'd consider this more of a general Hubitat question than a MakerAPI question. The short answer in either case is "no"--this is something many community members have wanted to know for their own sake and is what gave rise to apps like Device Watchdog (one of the things it can do is monitor "Last Activity" data). Some devices will update an attribute if they have good way to tell; for example, Hubitat's Hue Bridge integration (and mine) will set the Bridge Device "status" attribute to "Offline" if it's unable to reach the Bridge.

If you expect a more or less immediate response from a device you're manipulating, I suppose you could do some sort of check in the application (non-hub side) you're actually using MakerAPI for (e..g., assuming you've configured MakerAPI to also publish changes to you, if you don't hear any changes back in whatever time period, then there may be a problem). Otherwise, devices and drivers vary a bit here in terms of how they handle getting status updates back from devices, and often Hubitat itself lacks a good way to know if a device is truly "offline," so most of the above is just the best attempt you can make to guess.

thanks for the quick reply!

I did notice something interesting.. I had unplugged my outlet for the test above. When I plugged it in many minutes later - I got an update for the request I had made here.

So, it seems like Hubitat queues up these requests and will apply them later when the device is back online.. not sure if that's good or bad really.. As long as it won't queue up multiple requests for the same device (ie: off/on/off/on/etc) as the user is hitting the button.