Understanding problems with plugin code and controls

Hello together,

I’ve some general understanding problems with coding or connecting the controls in the plugin. Maybe someone can explain some procedure, because I’m not so good in programming.
I have one device with “Capabilities” ColorControl, ColorTemperature, Switch, (Lock) and SwitchLevel which I can use for my ColorWheel, temperature slider, button and brightness slider. Now I wanted to add three more sliders to manually set the three colors for R,G and B, but there aren’t more capabilities in that device which I can use for the sliders. Now I’m wondering if I have to use one or more other “Devices” (like Switch1, Switch2…) to use other “ColorControl” or “SwitchLevel” attributes for the sliders or if I can use the same device and differ them with different variables?
I mean I have three sliders and make a devicebinding with Switch1.Level but how I can differ them in the code? Maybe like this:
case “Level”:
device.Level = value;
if(sliderOne) tcp.send(value + “x”);
if(sliderTwo) tcp.send(value + “y”);
if(sliderThree) tcp.send(value + “z”);
break;
Maybe someone understands my problem and can help. Would be great!

Thanks and best regards,
Thorsten

test home remote TCP.hrp (2.6 MB)

Use Attributes when a Capability for the thing you need isn’t available. See screenshots.

1 Like

Hello Bill,

thanks for your help so far!
Ok, I see. I attached that to the plugin and in the attributes.
But how I do the device binding for the sliders now? In the dropdown menu I cant select the new attributes.

Best regards,
Thorsten

Set the binding of the sliders to Switch1.Red, Switch1.Green, Switch1.Blue.

I do see that those drop downs are not refreshing properly when entering new Attributes on the device object. You may have to close & reopen your project to see them in the drop downs.

Hello Bill,

yes, I tried that before.
I reopened the projekt and now it works!
A big thanks to you! :slight_smile:

Best regards,
Thorsten