Get device name change notifications

For a plugin I am developing, I want to get the name of the device when it is changed in the UI.

This is about a plugin for Ikea Tradfri devices. Each Tradfri devices (lamp, bulb) has a name assigned to it by the Ikea gateway. These names are retrieved and used in the device name that show in Vera. By default these names are not very usefull (Bulb, Bulb 2, and so on). When changing the name to something that makes sense in Vera, I would like to update the name in the gateway as well. Reason for this is that the same name will be used in the Ikea app (in case I would ever use that) and the same name will continue to be used in case the devices are reloaded from the gateway in case of a luup restart.

When the name of a device is changed, the name attribute of a device changes. The seems to be the case both when modifying the device name and when modifying the attribute directly.
Unlike variables, there does not seem to be a way to watch attributes for a change of value.

The plugin is currently developed for openLuup/AltUI due to some technical limitations, but since openLuup implements the behavior of Vera, I am posting the question here, instead of in the openLuup forum.

So, is there any way to be notified of a device name change?

There is no “watch” for attribute changes. No events.

Could one not use a pair of Reactor conditions, AND’ed together, with one a daily time interval, and the other an Expression variable whose value is based on the device name? Seems like an effective “watch” setup.

Well, that’s polling, which is pretty much what you have to do.

1 Like

Thanks for the feedback! I figured polling was the only last resort indeed.