Offline Edge Device not Switching State

I am testing some disconnect logic in a LAN driver. The device is being put offline on purpose and the driver is calling device:offline(). The device is not being updated in the ST UI. It is also still showing as online in the https://my.smartthings.com/ site. I have verified that the code is running. Just not sure why it isn’t updating the UI.

When you query the device’s health through the API, does it have the “offline” state?

It is ONLINE. I checked via the IDE but didn’t call the API directly. I believe that IDE uses the API though.

I’ve seen it didn’t show the info in the API every time, even for DTH-backed devices, it wasn’t helpful sometimes to verify the value of a capability.
Also, remember that Edge devices aren’t fully supported there.
So, in this case, it is weird that despite sending device:offline(), the device is still online, is this still happening?

Yes. It is happening for all of my LAN drivers. I can’t get anything to show offline.

I have no issue with device:online() or device:offiline() for LAN driver.

Does the mobile app show offline (broken cloud) for the offline device?

No. That is the issue I am reporting. I mark the device offline and the UI doesn’t update reflecting that.

Did the problem go away for you? I recently tested a couple of my LAN Edge devices and specifically tested online/offline and they worked for me - fairly quick update in the mobile (android) and web app.

This has started working. No specific changes on my end. Just started working one day.

@nayelyz I am seeing this again. Devices that are definitely marked offline are still showing as online in the UI. On occasion it works, but rarely. Most of the time, it renders as online. I also verified the state locally by logging the state when a switch occurs:

device:extend_device('online', function(self)
  local status, error = Device.online(self)
  if status then
    log.debug(self:pretty_print(), 'online')
  else
    log.error(self:pretty_print(), 'online', error)
  end
end)
device:extend_device('offline', function(self)
  local status, error = Device.offline(self)
  if status then
    log.warn(self:pretty_print(), 'offline')
  else
    log.error(self:pretty_print(), 'offline', error)
  end
end)

I can tell the state in the logs pretty easily now. There are also no errors produced by the online/offline calls

Hi, @blueyetisoftware

Do you also check the health in the API endpoint? There is where the actual health status is shown which should be the same as in the app, so, the status isn’t changing despite you sending device:offline().

I’ll ask the team about that.

Yes. The api still reports it as online

{
  "deviceId": "XXXXXXXXXX",
  "state": "ONLINE",
  "lastUpdatedDate": "2023-02-15T02:05:54.690Z"
}

Notice the date of 2-15. I was updating this yesterday, so it looks like it isn’t being updated at all in the server

If it helps the team, I would also note for them that these devices are EDGE_CHILD type, and have a parent of LAN type. Maybe there is an assumption somewhere that children can’t go offline without their parent.

1 Like

Hi, @blueyetisoftware
Following up on this issue, the team mentioned they need the following info, so, please help us get it:

  1. Confirm the email account registered in the forum is the same one you use for SmartThings. If not, please share it with me over DM
  2. Enable support access to your account:
  1. Go to the SmartThings Web (my.smartthings.com)
  2. Log in to your Samsung Account
  3. Select Menu (⋮) and choose Settings
  4. Toggle on Account Data Access
  5. Select the time period and confirm - In this step, please select “Until turned off”, once the team finishes, we’ll let you know so you can disable it again.
  1. Driver logs when you send the offline event
  2. Hub logs when you send that same event
  1. In the IDE, enter “my hubs”
  2. Enter the corresponding Hub and go to “view utilities”
  3. Click on “send” below "send hub logs
  1. To identify the device easily in the logs, share its ID.

Ok. I guess I’ll pass then and wait for someone else to confirm the issue. I have data privacy concerns and my past log exports never got a response. I’m convinced this only applies to EDGE_CHILD devices, as I can mark other devices offline just fine. I’d be willing to write a demo driver that shows this if that works. Thanks for looking into it.

ok, then, this should be useful for the team. If you have the chance, please share it so they can see how you implemented this and review the issue.

About the other logs, it seems the team hasn’t reviewed them yet but they are stored on a server after you send them so they don’t get lost.

1 Like