Lua / Luup : How can I list all devices reporting an error on the dashboard UI?


I have a number of hue lights that report “Can’t Detect Device’ in the Vera UI.

How can I identify them with some Luup / Lua code, as I can’t seem to see anything in the standard devices variables ?

Hello @parkerc,
On the Vera WebUI, you can go to “Devices” and hit “List” under “View by”, then select the option to list only failed devices. See the image below:

Kind regards!

Hi @Oscar.Morales

Thanks - I really need something at the lower Lua/Luup level so I can check for it and update a variable ?

For example if a hue bulb is turned off at the mains (the wall switch) then the device in Vera retains the previous state.

What I want to do is check to see when it’s a hue device that can’t be found, and automatically set the status variable to 0 (off)

Hope that makes sense ?

Maybe you can watch the status of the devices with the two following variables:

  • CommFailure: It shows “1” when the controller failed to reach the device.
  • Configured: It shows a different number depending on the status of the device configuration.
    These variables are present in most Z-Wave devices. You can get them with this Luup code (remember to replace the variables in the argument):
    local value = luup.variable_get("service ", "variable" , deviceID )
    I hope it helps.

Thanks, that did many thanks - I did wonder about the CommFailure variable, but I wasn’t sure how that was used exactly,. or if it was a perhaps count or something (like polling).

Looking at the Variables for a hue bulb on Vera (below), there no LastUpdate, plus what’s the difference between the CommFailureTime and CommFailureAlarm time as there is a gap between them.

Does the ‘Alarm’ relate to an amount of time Vera waits before updating the UI and logging an event/alert ?

**Device: 111 Hue Strip 4**
"urn:micasaverde-com:serviceId:PhilipsHue1","BulbModelID" value = "RS 125"
"urn:upnp-org:serviceId:SwitchPower1","Status" value = "1"
"urn:upnp-org:serviceId:Dimming1","TurnOnBeforeDim" value = "0"
"urn:upnp-org:serviceId:Dimming1","LoadLevelLast" value = "100"
"urn:upnp-org:serviceId:Dimming1","LoadLevelStatus" value = "100"
"urn:upnp-org:serviceId:Dimming1","LoadLevelTarget" value = "100"
"urn:micasaverde-com:serviceId:HaDevice1","ModeSetting" value = "1:;2:;3:;4:"
"urn:micasaverde-com:serviceId:HaDevice1","CommFailure" value = "1"
"urn:micasaverde-com:serviceId:HaDevice1","CommFailureTime" value = "1631824465"
"urn:micasaverde-com:serviceId:HaDevice1","CommFailureAlarm" value = "1631828065,1”
"urn:micasaverde-com:serviceId:HaDevice1","Configured" value = "0"

Check the image below:

You can find more information here.

Thanks again and also for that link, sorry I should have checked there first.

That said; I couldn’t see CommFailureTime listed anywhere under "urn:micasaverde-com:serviceId:HaDevice1" so I assume it must have been created just for the Hue Plug-in…

Quick update to share my resulting code, that turns off disconnected lights.

local HA_SER = "urn:micasaverde-com:serviceId:HaDevice1"
local SP_SER = "urn:upnp-org:serviceId:SwitchPower1"

for lul_device in pairs(luup.devices) do
	local failure = luup.variable_get(HA_SER, "CommFailure", lul_device)
	local failuretime = luup.variable_get(HA_SER, "CommFailureTime", lul_device)
	local status = luup.variable_get(SP_SER, "Status", lul_device)
	local name = luup.attr_get ('name', lul_device)
	if failure == "1" and status == "1" then
		print(lul_device, tonumber(failure), failuretime, name, status)
		luup.call_action(SP_SER,"SetTarget",{ newTargetValue="0" },lul_device)

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules