I’ve been struggling with a problem of how to access other devices attributes in my version of the MQTT plugin,
I have some heating devices that as well as the DisplayName field also have custom attributes - eg EditedName and NodeRedThingId. The attributes work as expected in the various controls.
I now have timer devices that control a variable list of heating zones. They have a custom attribute called ThingList. If I populate this in the plugin directly everything works as expected and I display the end result using gridview.
To do this programmatically - Node red sends ThingList as a comma separated set of thing numbers. Because I already have the user edited zone names in HR it should be easy to pick up the EditedName attribute to populate the Object that gridview uses.
Can’t get it to work.
console.log(plugin.Devices[13+":0"].DisplayName gives me the correct (NON edited) zone name
console.log(plugin.Devices[13+":0"].EditedName gives me null.
It is the same problem with any of the devices attributes - they all come back as null. It is the same problem with any device. I can correctly look up the DisplayName but not the attributes EditedName
As well as the controls correctly showing the edited name I also print it when it is updated in onPoll
console.log(device.EditedName) and it has the correct value.
I think I am missing something obvious - but what?
Thanks for your suggestions.
Coppo