luup.device_message - How to clear?

When I use the luup.device_message function (Luup Lua extension) to display an error on the vera device, it works fine. However, I am noticing that if you keep calling the device_message function, it will concatenate the messages when you drill into the device details. For instance, if I write the following code:

luup.device_message(deviceId, 3, "Not working", 0, "MYPLUGIN") --- wait a minute or so luup.device_message(deviceId, 3, "Not working", 0, "MYPLUGIN") --- wait a minute or so luup.device_message(deviceId, 3, "Not working", 0, "MYPLUGIN")

The message on the UI’s device list will display “Not Working” within the device’s box with a red background. If you click on the arrow to see the details, you will see:

Not Working.Not Working.Not Working.

Can anyone tell me if there is a way to “clear” the errors set by the device_message function? I have tried various ways, but can’t seem to get it to clear.

Thanks in advance.

Hi,

Have a look at the wiki. [url=http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_device_message]http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_device_message[/url]. You can set a time out. Try to see what happens using an empty string.

Cheers Rene

Thanks for the suggestion. Unfortunately, this doesn’t work. The timeout seems to be required. If I set the timeout to zero, set the message to an empty string, and set the status to either -1 or 0, it still doesn’t work.

Any other ideas? I can’t even seem to find where it is being used in any of the plugins that I have downloaded.

Thanks.

For those of you interested…

I sent a note to Vera Support and here is the response that I got regarding clearing the messages. I haven’t tried it yet.

I have forwarded your question to our development team and they told me there is no way to ?clear? the errors. What you can do is to overwrite the previous error message with a new ?status success? message. Or you can set a timeout interval.

I found a way to clear the message. Do something like thie:

luup.device_message(deviceId, 4, " ", 0, "MYPLUGIN")
luup.device_message(deviceId, 4, "Done", 10, "MYPLUGIN")

This will show “Done” for 10 seconds and then it will go away.
There seems to be a current “timeout” and “permanent” string states. Setting the string to nil or the empty string has no effect. Setting it to a space has the desired visual effect.
However, with the latest firmware, the status code seems to be ignored and all messages are displayed with blue text.