[RELEASE] Rumba for Roomba

@fieldsjm

I can debug why it is showing offline each time, but that doesn’t explain why the device is not updating to offline when I do sendEvent(name: ‘healthStatus’, value: ‘offline’ )
in any case, I’ve uploaded a version to the GitHub with everything commented out so you can switch to that and it should work for now while I debug this issue further.

@orangebucket does manual setting of the health check status not work?

It used to, and it is still documented to do so for cloud integrations, but I guess they may have moved the goalposts with the recent changes. Unfortunately information about device Health is hard to come by. I’d have though ST would like us to know how to use it properly but there you go …

@orangebucket
If this doesn’t work there is no way for me to set the device offline, since I imagine even the hub event for my ping routine will keep it online if using auto tracking

@nayelyz please tell me why
sendEvent(name: ‘healthStatus’, value: ‘offline’ )
Does not mark the device as offline in the ST app
I have health check included in capabilities.

@nayelyz @Brad_ST @jody.albritton

to debug this I created a button that sends the following command:
sendEvent(name: ‘healthStatus’, value: ‘offline’ )

It did not work, the device was not marked as offline.
I have included the capability “Health Check” in the metadata
Please advise of the solution or if this is a known issue.
Is there no way to manually set the online state?

Hi @mvevitsis,
You should send the DeviceWatch-DeviceStatus event instead. For example:

sendEvent(name: "DeviceWatch-DeviceStatus", value: "offline")

Make sure to initialize this HealthCheck attribute when the device is installed. In the picture below you can see how the device appears once I send the event.

1 Like

@nayelyz thank you so much and for actually testing it with my dth

2 Likes

Anytime! Also, you need to enroll to the DeviceWatch as “untracked” , if you enroll as “tracked”, the DeviceWatch would be the owner to set the online/offline status and the manual event could be ignored. Here is an example to initialize correctly the HealthCheck for this case:

sendEvent(name: "DeviceWatch-DeviceStatus", value: "online")
sendEvent(name: "healthStatus", value: "online") //can be omitted
sendEvent(name: "DeviceWatch-Enroll", value: [protocol: "cloud", scheme:"untracked"].encodeAsJson(), displayed: false)

@nayelyz

When I want to set the device as offline, do I need to send both of these or only the DeviceWatch? I noticed you put the healthStatus in the initialize events.

sendEvent(name: "DeviceWatch-DeviceStatus", value: "offline")
sendEvent(name: "healthStatus", value: "offline")

Sorry for the confusion. The healthStatus event can be omitted, it is optional.

Thanks for that Nayely. Improbable as it might seem, us punters have never actually been given any useful information whatsoever on how to use the various iterations of device health. We’ve spent a couple of years just guessing and hoping that if we were actually cocking it up someone might be minded to let us know. So it is refreshing to actually see a confirmation that we’ve been doing some bits right, even if it remains a mystery why something that has created so much confusion and disruption isn’t better documented so we can use it properly.

1 Like

Playing around with it a bit. Seems to be working (at least with local API) based solely on hubResponse. Status in IDE is often inconsistent but representation in the App is correct online/offline. Tested by manually killing the node server and with a robot that is not connected to wifi (low battery). Not a perfect system but at least I can confirm that manually setting status works.

private local_get(path, cbk) {
    def host = "$roomba_host:$roomba_port"

	sendHubCommand(new physicalgraph.device.HubAction("""GET $path HTTP/1.1\r\nHOST: $host\r\n\r\n""", physicalgraph.device.Protocol.LAN, null, [callback: cbk]))
    if(hubResponse == null) {
		state.online = "offline"
        } else {
        state.online = "online"
        }
    sendEvent(name: "DeviceWatch-DeviceStatus", value: state.online)
}

Thanks, that’s a lot simpler than what I was trying to do.

I will merge this into the main branch.

@fieldsjm I’ve uploaded version 1.5 which in addition to fixing the health check also fixes the state so that it shows “returning to dock” when docking and only returns “charging” in the status area once it’s actually in the dock.

@fieldsjm have you tried version 1.5?

Yes and that is a nice touch, worked like a charm.

I have not had time to test out the health check but otherwise it is working well.

Just a heads up, probably a ST issue but health check is not currently working. I just happened to notice this morning, my node server did not restart correctly after a power outage so I would have expected rooomba to show offline, but it is not. I will test over the next few days and see if anything changes.

logging hubResponse is showing null even after restarting my node server
state.connection is being evaluated to offline yet the device is online

Pulling status from the REST API, appears offline but enroll is null, could that be the issue?

"healthCheck": {

                "checkInterval": {

                    "value": 16270,

                    "unit": "s",

                    "data": {

                        "deviceScheme": "untracked",

                        "protocol": "cloud"

                    },

                    "timestamp": "2020-11-05T03:04:01.041+0000"

                },

                "healthStatus": {

                    "value": "offline",

                    "data": {},

                    "timestamp": "2020-10-27T16:02:01.933+0000"

                },

                "DeviceWatch-Enroll": {

                    "value": null,

                    "timestamp": "2020-10-21T15:01:12.468+0000"

                },

                "DeviceWatch-DeviceStatus": {

                    "value": "offline",

                    "data": {},

                    "timestamp": "2020-11-05T03:48:02.572+0000"

                }

            }

@nayelyz did something change regarding health check capability that I am not aware of? See @fieldsjm post above. The device is showing as offline even when it is online. And why is device watch enroll null?

@fieldsjm it only runs the device enroll when you update the settings,have you tried reinputting the ip address of the server or something?

The DeviceWatch-Enroll is null because you took control over the DeviceWatch status using the “Untracked” enrollment type.
If the device has the “offline” status in the API, then the “online” event is not being sent from the handler.

Thank You, This makes sense.

I believe the issue is with the hubResponse now returning null despite actually receiving information. We may have to come up with a new method to determine status.

Despite that, there is still inconsistency in the Apps representation of online vs offline.
In the example above, device is functional (online), App shows online, yet API states offline. If API states offline should the App also show offline?

@nayelyz

So what you are saying is as long as the state is offline the hubcommand is not being sent?
Because the DTH marks the device as offline if the hubresponse returns null, else it marks it as online.
If the hub command is never sent though this if else statement would never run.