Automatic device names.

These might be newbie questions but they are doing my head in: -

  1. I would like to automatically name a device, I have tried the following but neither worked. Can someone point me in the right direction?
luup.devices[lul_device].discription = modelName
luup.variable_set("urn:denon-com:serviceId:Receiver1","name",modelName,lul_device)

The second creates a new name field so I think it is just a matter of getting the serviceId right but not sure what urn I should use.

  1. Is it possible to use variables as button names in UI4 and if so can someone point me to some examples?

I have looked at examples and know that no#1 is possible but can’t see how it is done. For no#2 not so sure.

Thanks

John

Look at luup.attr_set. It available in the more recent luup builds.

Oh, and for #2 I’m not sure what you mean. You can custom ID each child device, with names of your choice, but this can only be done while they are being created using luup.chdev.append(…), but not sure if that’s what you’re after.

I have input buttons for a Denon receiver which can have custom names. I want to be able to get the custom names from the receiver and use that on the buttons.

e.g. TV/CBL input has a custom name in the receiver of PVR I would like to display that on the UI button.

@guessed thanks will look at luup.attr_set

Button labels are statically defined in you JSON, so you cannot change them at runtime. The internal label is settable during device creation, but this is only useful to ‘lookup’ devices by name (under a given parent device) instead of using deviceId’s.