How to Create a Sitemap Label with a value of another item than itself

Hello !

I created a sitemap with a Volume control slider element in it in order to control my Surround Receiver Over an RS-232 binding.
Here is the my items :

String Amp_Command "Amplifier Info "  { serial="COM4" }
Dimmer Amp_Volume  "Amplifier Volume " <soundvolume>

\\ Here is my rule;
rule "Volume Change"
Item Amp_Volume received update

var Value = Amp_Volume.state as Number
var KitVol = ( Value / 2 ) - 50
var String MyOutput = KitVol.toString
        logInfo ("MyLog", "MyOutput{}", MyOutput)
if ( KitVol < 0 )
    sendCommand(Amp_Command, "@VOL:0" + KitVol.intValue + "\r")
else {
if ( KitVol == 0 )
    sendCommand(Amp_Command, "@VOL:0-" + KitVol.intValue + "0\r")
else if ( KitVol > 0 && KitVol < 10 )
    sendCommand(Amp_Command, "@VOL:0+0" + KitVol.intValue + "\r")
else {
    sendCommand(Amp_Command, "@VOL:0+" + KitVol.intValue + "\r")

\\ and finally my Slider item in the sitemap

Slider item=Amp_Volume label="Ses Seviyesi [%.1f dB]"

Although the slider values change from 0 to 100, my amplifier requires level of Volume between -50 to 0 dB , so my rule is created in order to scale the slider value and convert it to a serial code

This is the visual of my slider item;

Here, what the slider displays is labels own Value which varies from 0 to 100.
I can control the Volume perfectly but,
My question is how can I make it show the actual dB value which ranges from -50 dB to 0 dB in the sitemap? Is there any method for assigning the value of label from other items?


Perhaps a SCALE transform in your Item’s label

1 Like

If Scale won’t work, you could use a JS transform in your label. It’d be really simple, just subtract 50 from the value.

1 Like

You could use a Number item, and

Slider item=Amp_Volume label="Ses Seviyesi [%.1f dB]" minValue=-50 maxValue=0
1 Like

Solved it through Scale transform. However, it would be faster with a JS Transform. will try it . Thanks !



Faster how? It won’t run faster. I doubt it would be faster to write.

Sure)) That’s what i meant.