Set up consisite of
. item file
.sitemap file
and few Map & JS scripts
coloreeffectjson.map
colour.js
scale transformation - 100-255.js & 255-100.js
Items:
Switch Clrlight01power “Temple light” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:CLRLIGHT01/in:command:ON:/0],>[mqtt:CLRLIGHT01/in:command:OFF:=off],<[mqtt:CLRLIGHT01/out:state:ON:OK /0],<[mqtt:CLRLIGHT01/out:state:OFF:OK =off]"}
Dimmer CLRlight01Dim “Temple light Brightness [%d]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:CLRLIGHT01/in:command::JS(scale100-255.js)], <[mqtt:CLRLIGHT01/out:state:JS(scale255-100.js)]"}
Dimmer CLRlight01Speed “Temple light Speed [%.0f]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:CLRLIGHT01/in:command::JS(speedscale100-255.js)], <[mqtt:CLRLIGHT01/out:state:JS(speedscale255-100.js)]", autoupdate=“true”}
Color Clrlight01 “Temple light color” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:CLRLIGHT01/in:command::JS(colour.js)]"}
Number Coloreffects “Temple Effects” (gLedstrip) {mqtt=">[mqtt:CLRLIGHT01/in:command::MAP(ColoreffectsJSON.map)]"}
Number Colorname “Temple Color” (gLedstrip) {mqtt=">[mqtt:CLRLIGHT01/in:command:*:MAP(ColoreffectsJSON.map)]"}
//GXRINGa
Switch GXRINGpower “Ganesh” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:GXRING/in:command:ON:/0],>[mqtt:GXRING/in:command:OFF:=off],<[mqtt:GXRING/out:state:ON:OK /0],<[mqtt:GXRING/out:state:OFF:OK =off]"}
Dimmer GXRINGDim “Ganesh Brightness [%d]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:GXRING/in:command:*:JS(scale100-255.js)], <[mqtt:GXRING/out:state:JS(scale255-100.js)]"}
Dimmer GXRINGSpeed “Ganesh Speed [%.0f]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:GXRING/in:command:*:JS(speedscale100-255.js)], <[mqtt:GXRING/out:state:JS(speedscale255-100.js)]", autoupdate=“true”}
Color GXRING “Ganesh color” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:GXRING/in:command:*:JS(colour.js)]"}
Number GXRINGeffects “Ganesh Effect” (gLedstrip) {mqtt=">[mqtt:GXRING/in:command:*:MAP(ColoreffectsJSON.map)]"}
Number GXRINGname “Ganesh Col” (gLedstrip) {mqtt=">[mqtt:GXRING/in:command:*:MAP(ColoreffectsJSON.map)]"}
// XRING01
Switch XRING01power “Ganesh One” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING01/in:command:ON:/0],>[mqtt:XRING01/in:command:OFF:=off],<[mqtt:XRING01/out:state:ON:OK /0],<[mqtt:XRING01/out:state:OFF:OK =off]"}
Dimmer XRING01Dim “Ganesh One Brightness [%d]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING01/in:command::JS(scale100-255.js)], <[mqtt:XRING01/out:state:JS(scale255-100.js)]"}
Dimmer XRING01Speed “Ganesh One Speed [%.0f]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING01/in:command::JS(speedscale100-255.js)], <[mqtt:XRING01/out:state:JS(speedscale255-100.js)]", autoupdate=“true”}
Color XRING01 “Ganesh One color” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING01/in:command::JS(colour.js)]"}
Number XRING01effects “Ganesh One Effect” (gLedstrip) {mqtt=">[mqtt:XRING01/in:command::MAP(ColoreffectsJSON.map)]"}
Number XRING01name “Ganesh One Color” (gLedstrip) {mqtt=">[mqtt:XRING01/in:command:*:MAP(ColoreffectsJSON.map)]"}
//XRING02
Switch XRING02power “Ganesh two” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING02/in:command:ON:/0],>[mqtt:XRING02/in:command:OFF:=off],<[mqtt:XRING02/out:state:ON:OK /0],<[mqtt:XRING02/out:state:OFF:OK =off]"}
Dimmer XRING02Dim “Ganesh two Brightness [%d]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING02/in:command::JS(scale100-255.js)], <[mqtt:XRING02/out:state:JS(scale255-100.js)]"}
Dimmer XRING02Speed “Ganesh two Speed [%.0f]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING02/in:command::JS(speedscale100-255.js)], <[mqtt:XRING02/out:state:JS(speedscale255-100.js)]", autoupdate=“true”}
Color XRING02 “Ganesh two color” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING02/in:command::JS(colour.js)]"}
Number XRING02effects “Ganesh two Effect” (gLedstrip) {mqtt=">[mqtt:XRING02/in:command::MAP(ColoreffectsJSON.map)]"}
Number XRING02name “Ganesh two Color” (gLedstrip) {mqtt=">[mqtt:XRING02/in:command:*:MAP(ColoreffectsJSON.map)]"}
//XRING03
Switch XRING03power “Ganesh three” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING03/in:command:ON:/0],>[mqtt:XRING03/in:command:OFF:=off],<[mqtt:XRING03/out:state:ON:OK /0],<[mqtt:XRING03/out:state:OFF:OK =off]"}
Dimmer XRING03Dim “Ganesh three Brightness [%d]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING03/in:command::JS(scale100-255.js)], <[mqtt:XRING03/out:state:JS(scale255-100.js)]"}
Dimmer XRING03Speed “Ganesh three Speed [%.0f]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING03/in:command::JS(speedscale100-255.js)], <[mqtt:XRING03/out:state:JS(speedscale255-100.js)]", autoupdate=“true”}
Color XRING03 “Ganesh three color” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING03/in:command::JS(colour.js)]"}
Number XRING03effects “Ganesh three Effect” (gLedstrip) {mqtt=">[mqtt:XRING03/in:command::MAP(ColoreffectsJSON.map)]"}
Number XRING03name “Ganesh three Color” (gLedstrip) {mqtt=">[mqtt:XRING03/in:command:*:MAP(ColoreffectsJSON.map)]"}
//XRING04
Switch XRING04power “Ganesh four” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING04/in:command:ON:/0],>[mqtt:XRING04/in:command:OFF:=off],<[mqtt:XRING04/out:state:ON:OK /0],<[mqtt:XRING04/out:state:OFF:OK =off]"}
Dimmer XRING04Dim “Ganesh four Brightness [%d]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING04/in:command::JS(scale100-255.js)], <[mqtt:XRING04/out:state:JS(scale255-100.js)]"}
Dimmer XRING04Speed “Ganesh four Speed [%.0f]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING04/in:command::JS(speedscale100-255.js)], <[mqtt:XRING04/out:state:JS(speedscale255-100.js)]", autoupdate=“true”}
Color XRING04 “Ganesh four color” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XRING04/in:command::JS(colour.js)]"}
Number XRING04effects “Ganesh four Effects” (gLedstrip) {mqtt=">[mqtt:XRING04/in:command::MAP(ColoreffectsJSON.map)]"}
Number XRING04name “Ganesh four Color” (gLedstrip) {mqtt=">[mqtt:XRING04/in:command:*:MAP(ColoreffectsJSON.map)]"}
//XSTRIP01
Switch XSTRIP01power “Ganesh line” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XSTRIP01/in:command:ON:/0],>[mqtt:XSTRIP01/in:command:OFF:=off],<[mqtt:XSTRIP01/out:state:ON:OK /0],<[mqtt:XSTRIP01/out:state:OFF:OK =off]"}
Dimmer XSTRIP01Dim “Ganesh line Brightness [%d]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XSTRIP01/in:command::JS(scale100-255.js)], <[mqtt:XSTRIP01/out:state:JS(scale255-100.js)]"}
Dimmer XSTRIP01Speed “Ganesh line Speed [%.0f]” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XSTRIP01/in:command::JS(speedscale100-255.js)], <[mqtt:XSTRIP01/out:state:JS(speedscale255-100.js)]", autoupdate=“true”}
Color XSTRIP01 “Ganesh line color” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XSTRIP01/in:command::JS(colour.js)]"}
Number XSTRIP01effects “Ganesh line Effects” (gLedstrip) [“Lighting”] {mqtt=">[mqtt:XSTRIP01/in:command::MAP(ColoreffectsJSON.map)]"}
Number XSTRIP01name “Ganesh line Color” (gLedstrip) {mqtt=">[mqtt:XSTRIP01/in:command:*:MAP(ColoreffectsJSON.map)]"}
Sitemap:
sitemap Ganesh label=“Ganesh My Home” {
Frame {
Text item=Date label=“Now Date & Time”
}
Frame {
Text label="Temple" icon=hindutemple {
// Default item=LivingDining_Ledstrip label="Living & Dining Room"
Colorpicker item=Clrlight01 label="Temple Color" icon="colorwheel"
Selection item=Coloreffects mappings=[201='TV' ,3='Static',4='Blink',5='Breath',6='ColorWipe',7='ColorWipeInverse',8='ColorWipeReverse',9='ColorWipeReverseInverse',10='ColorWipeRandom',11='RandomColor',12='SingleDynamic',13='MultiDynamic',14='Rainbow',15='RainbowCycle',16='Scan',17='DualScan',18='Fade',19='TheaterChase',20='TheaterChaseRainbow',21='RunningLights',22='Twinkle',23='TwinkleRandom',24='TwinkleFade',25='TwinkleFadeRandom',26='Sparkle',27='FlashSparkle',28='HyperSparkle',29='Strobe',30='StrobeRainbow',31='MultiStrobe',32='BlinkRainbow',33='ChaseWhite',34='ChaseColor',35='ChaseRandom',36='ChaseRainbow',37='ChaseFlash',38='ChaseFlashRandom',39='ChaseRainbowWhite',40='ChaseBlackout',41='ChaseBlackoutRainbow',42='ColorSweepRandom',43='RunningColor',44='RunningRedBlue',45='RunningRandom',46='LarsonScanner',47='Comet',48='Fireworks',49='FireworksRandom',50='MerryChristmas',51='FireFlicker',52='FireFlicker(soft)',53='FireFlicker(intense)',54='CircusCombustus',55='Halloween',56='BicolorChase',57='TricolorChase',58='ICU' ]
Selection item=Colorname mappings=[ 60='WHITE',61='SILVER',62='GRAY',63='BLACK',64='RED',65='MAROON',66='YELLOW',67='OLIVE',68='LIME',69='GREEN',70='AQUA',71='TEAL',72='BLUE',73='NAVY',74='FUCHSIA',75='PURPLE' ]
Slider item=CLRlight01Dim
Switch item=Clrlight01power mappings=[ 'OFF'='off','ON'='Cont..' ]
Slider item=CLRlight01Speed
//Webview url="http://192.168.1.25/index2.htm" height=57 visibility=[Clrlight01power!="=off"]
}
}
Frame {
// Default item=LivingDining_Ledstrip label="Living & Dining Room"
Colorpicker item=GXRING icon="colorwheel"
Selection item=GXRINGeffects mappings=[201='TV' ,3='Static',4='Blink',5='Breath',6='ColorWipe',7='ColorWipeInverse',8='ColorWipeReverse',9='ColorWipeReverseInverse',10='ColorWipeRandom',11='RandomColor',12='SingleDynamic',13='MultiDynamic',14='Rainbow',15='RainbowCycle',16='Scan',17='DualScan',18='Fade',19='TheaterChase',20='TheaterChaseRainbow',21='RunningLights',22='Twinkle',23='TwinkleRandom',24='TwinkleFade',25='TwinkleFadeRandom',26='Sparkle',27='FlashSparkle',28='HyperSparkle',29='Strobe',30='StrobeRainbow',31='MultiStrobe',32='BlinkRainbow',33='ChaseWhite',34='ChaseColor',35='ChaseRandom',36='ChaseRainbow',37='ChaseFlash',38='ChaseFlashRandom',39='ChaseRainbowWhite',40='ChaseBlackout',41='ChaseBlackoutRainbow',42='ColorSweepRandom',43='RunningColor',44='RunningRedBlue',45='RunningRandom',46='LarsonScanner',47='Comet',48='Fireworks',49='FireworksRandom',50='MerryChristmas',51='FireFlicker',52='FireFlicker(soft)',53='FireFlicker(intense)',54='CircusCombustus',55='Halloween',56='BicolorChase',57='TricolorChase',58='ICU' ]
Selection item=GXRINGname mappings=[ 60='WHITE',61='SILVER',62='GRAY',63='BLACK',64='RED',65='MAROON',66='YELLOW',67='OLIVE',68='LIME',69='GREEN',70='AQUA',71='TEAL',72='BLUE',73='NAVY',74='FUCHSIA',75='PURPLE' ]
Slider item=GXRINGDim
Switch item=GXRINGpower mappings=[ 'OFF'='off','ON'='Cont..' ]
Slider item=GXRINGSpeed
//Webview url="http://192.168.1.25/index2.htm" height=57 visibility=[Clrlight01power!="=off"]
}
Text label="Ganapti One" icon=hindutemple {
// Default item=LivingDining_Ledstrip label="Living & Dining Room"
Colorpicker item=XRING01 icon="colorwheel"
Selection item=XRING01effects mappings=[201='TV' ,3='Static',4='Blink',5='Breath',6='ColorWipe',7='ColorWipeInverse',8='ColorWipeReverse',9='ColorWipeReverseInverse',10='ColorWipeRandom',11='RandomColor',12='SingleDynamic',13='MultiDynamic',14='Rainbow',15='RainbowCycle',16='Scan',17='DualScan',18='Fade',19='TheaterChase',20='TheaterChaseRainbow',21='RunningLights',22='Twinkle',23='TwinkleRandom',24='TwinkleFade',25='TwinkleFadeRandom',26='Sparkle',27='FlashSparkle',28='HyperSparkle',29='Strobe',30='StrobeRainbow',31='MultiStrobe',32='BlinkRainbow',33='ChaseWhite',34='ChaseColor',35='ChaseRandom',36='ChaseRainbow',37='ChaseFlash',38='ChaseFlashRandom',39='ChaseRainbowWhite',40='ChaseBlackout',41='ChaseBlackoutRainbow',42='ColorSweepRandom',43='RunningColor',44='RunningRedBlue',45='RunningRandom',46='LarsonScanner',47='Comet',48='Fireworks',49='FireworksRandom',50='MerryChristmas',51='FireFlicker',52='FireFlicker(soft)',53='FireFlicker(intense)',54='CircusCombustus',55='Halloween',56='BicolorChase',57='TricolorChase',58='ICU' ]
Selection item=XRING01name mappings=[ 60='WHITE',61='SILVER',62='GRAY',63='BLACK',64='RED',65='MAROON',66='YELLOW',67='OLIVE',68='LIME',69='GREEN',70='AQUA',71='TEAL',72='BLUE',73='NAVY',74='FUCHSIA',75='PURPLE' ]
Slider item=XRING01Dim
Switch item=XRING01power mappings=[ 'OFF'='off','ON'='Cont..' ]
Slider item=XRING01Speed
//Webview url="http://192.168.1.25/index2.htm" height=57 visibility=[Clrlight01power!="=off"]
}
Text label="Ganapti Two" icon=hindutemple {
// Default item=LivingDining_Ledstrip label="Living & Dining Room"
Colorpicker item=XRING02 icon="colorwheel"
Selection item=XRING02effects mappings=[201='TV' ,3='Static',4='Blink',5='Breath',6='ColorWipe',7='ColorWipeInverse',8='ColorWipeReverse',9='ColorWipeReverseInverse',10='ColorWipeRandom',11='RandomColor',12='SingleDynamic',13='MultiDynamic',14='Rainbow',15='RainbowCycle',16='Scan',17='DualScan',18='Fade',19='TheaterChase',20='TheaterChaseRainbow',21='RunningLights',22='Twinkle',23='TwinkleRandom',24='TwinkleFade',25='TwinkleFadeRandom',26='Sparkle',27='FlashSparkle',28='HyperSparkle',29='Strobe',30='StrobeRainbow',31='MultiStrobe',32='BlinkRainbow',33='ChaseWhite',34='ChaseColor',35='ChaseRandom',36='ChaseRainbow',37='ChaseFlash',38='ChaseFlashRandom',39='ChaseRainbowWhite',40='ChaseBlackout',41='ChaseBlackoutRainbow',42='ColorSweepRandom',43='RunningColor',44='RunningRedBlue',45='RunningRandom',46='LarsonScanner',47='Comet',48='Fireworks',49='FireworksRandom',50='MerryChristmas',51='FireFlicker',52='FireFlicker(soft)',53='FireFlicker(intense)',54='CircusCombustus',55='Halloween',56='BicolorChase',57='TricolorChase',58='ICU' ]
Selection item=XRING02name mappings=[ 60='WHITE',61='SILVER',62='GRAY',63='BLACK',64='RED',65='MAROON',66='YELLOW',67='OLIVE',68='LIME',69='GREEN',70='AQUA',71='TEAL',72='BLUE',73='NAVY',74='FUCHSIA',75='PURPLE' ]
Slider item=XRING02Dim
Switch item=XRING02power mappings=[ 'OFF'='off','ON'='Cont..' ]
Slider item=XRING02Speed
//Webview url="http://192.168.1.25/index2.htm" height=57 visibility=[Clrlight01power!="=off"]
}
Text label="Ganapti Three" icon=hindutemple {
// Default item=LivingDining_Ledstrip label="Living & Dining Room"
Colorpicker item=XRING03 icon="colorwheel"
Selection item=XRING03effects mappings=[201='TV' ,3='Static',4='Blink',5='Breath',6='ColorWipe',7='ColorWipeInverse',8='ColorWipeReverse',9='ColorWipeReverseInverse',10='ColorWipeRandom',11='RandomColor',12='SingleDynamic',13='MultiDynamic',14='Rainbow',15='RainbowCycle',16='Scan',17='DualScan',18='Fade',19='TheaterChase',20='TheaterChaseRainbow',21='RunningLights',22='Twinkle',23='TwinkleRandom',24='TwinkleFade',25='TwinkleFadeRandom',26='Sparkle',27='FlashSparkle',28='HyperSparkle',29='Strobe',30='StrobeRainbow',31='MultiStrobe',32='BlinkRainbow',33='ChaseWhite',34='ChaseColor',35='ChaseRandom',36='ChaseRainbow',37='ChaseFlash',38='ChaseFlashRandom',39='ChaseRainbowWhite',40='ChaseBlackout',41='ChaseBlackoutRainbow',42='ColorSweepRandom',43='RunningColor',44='RunningRedBlue',45='RunningRandom',46='LarsonScanner',47='Comet',48='Fireworks',49='FireworksRandom',50='MerryChristmas',51='FireFlicker',52='FireFlicker(soft)',53='FireFlicker(intense)',54='CircusCombustus',55='Halloween',56='BicolorChase',57='TricolorChase',58='ICU' ]
Selection item=XRING03name mappings=[ 60='WHITE',61='SILVER',62='GRAY',63='BLACK',64='RED',65='MAROON',66='YELLOW',67='OLIVE',68='LIME',69='GREEN',70='AQUA',71='TEAL',72='BLUE',73='NAVY',74='FUCHSIA',75='PURPLE' ]
Slider item=XRING03Dim
Switch item=XRING03power mappings=[ 'OFF'='off','ON'='Cont..' ]
Slider item=XRING03Speed
//Webview url="http://192.168.1.25/index2.htm" height=57 visibility=[Clrlight01power!="=off"]
}
Text label="Ganapti Four" icon=hindutemple {
// Default item=LivingDining_Ledstrip label="Living & Dining Room"
Colorpicker item=XRING04 icon="colorwheel"
Selection item=XRING04effects mappings=[201='TV' ,3='Static',4='Blink',5='Breath',6='ColorWipe',7='ColorWipeInverse',8='ColorWipeReverse',9='ColorWipeReverseInverse',10='ColorWipeRandom',11='RandomColor',12='SingleDynamic',13='MultiDynamic',14='Rainbow',15='RainbowCycle',16='Scan',17='DualScan',18='Fade',19='TheaterChase',20='TheaterChaseRainbow',21='RunningLights',22='Twinkle',23='TwinkleRandom',24='TwinkleFade',25='TwinkleFadeRandom',26='Sparkle',27='FlashSparkle',28='HyperSparkle',29='Strobe',30='StrobeRainbow',31='MultiStrobe',32='BlinkRainbow',33='ChaseWhite',34='ChaseColor',35='ChaseRandom',36='ChaseRainbow',37='ChaseFlash',38='ChaseFlashRandom',39='ChaseRainbowWhite',40='ChaseBlackout',41='ChaseBlackoutRainbow',42='ColorSweepRandom',43='RunningColor',44='RunningRedBlue',45='RunningRandom',46='LarsonScanner',47='Comet',48='Fireworks',49='FireworksRandom',50='MerryChristmas',51='FireFlicker',52='FireFlicker(soft)',53='FireFlicker(intense)',54='CircusCombustus',55='Halloween',56='BicolorChase',57='TricolorChase',58='ICU' ]
Selection item=XRING04name mappings=[ 60='WHITE',61='SILVER',62='GRAY',63='BLACK',64='RED',65='MAROON',66='YELLOW',67='OLIVE',68='LIME',69='GREEN',70='AQUA',71='TEAL',72='BLUE',73='NAVY',74='FUCHSIA',75='PURPLE' ]
Slider item=XRING04Dim
Switch item=XRING04power mappings=[ 'OFF'='off','ON'='Cont..' ]
Slider item=XRING04Speed
//Webview url="http://192.168.1.25/index2.htm" height=57 visibility=[Clrlight01power!="=off"]
}
}
rules:
//colorlight rule
rule “colorserver restart”
when
Time cron " 0 0/30 * 1/1 * ? *"
then
sendHttpGetRequest(“http://192.168.1.41:80/restart”)
sendHttpGetRequest(“http://192.168.1.42:80/restart”)
sendHttpGetRequest(“http://192.168.1.43:80/restart”)
sendHttpGetRequest(“http://192.168.1.44:80/restart”)
sendHttpGetRequest(“http://192.168.1.45:80/restart”)
end
rule PublishOnGXRINGChangeOnly
when
Item GXRING changed
/* Item GXRINGpower changed or
Item GXRINGDim changed or
Item GXRINGSpeed changed or
Item GXRINGname changed or
Item GXRINGeffects changed*/
then
Thread::sleep(100)
publish(“mqtt”,“XRING01/in”, transform(“JS”, “colour.js”, GXRING.state.toString))
publish(“mqtt”,“XRING02/in”, transform(“JS”, “colour.js”, GXRING.state.toString))
publish(“mqtt”,“XRING03/in”, transform(“JS”, “colour.js”, GXRING.state.toString))
publish(“mqtt”,“XRING04/in”, transform(“JS”, “colour.js”, GXRING.state.toString))
postUpdate(XRING01, GXRING.state.toString)
postUpdate(XRING02, GXRING.state.toString)
postUpdate(XRING03, GXRING.state.toString)
postUpdate(XRING04, GXRING.state.toString)
end
//transform(“JS”, “colour.js”, GXRING)
//transform(“MAP”, “ColoreffectsJSON.map”, GXRINGpower.state.toString)
rule PublishOnGXRINGpowerChangeOnly
when
Item GXRINGpower changed
then
Thread::sleep(100)
publish(“mqtt”,“XRING01/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGpower.state.toString))
publish(“mqtt”,“XRING02/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGpower.state.toString))
publish(“mqtt”,“XRING03/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGpower.state.toString))
publish(“mqtt”,“XRING04/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGpower.state.toString))
postUpdate(XRING01power, GXRINGpower.state.toString)
postUpdate(XRING02power, GXRINGpower.state.toString)
postUpdate(XRING03power, GXRINGpower.state.toString)
postUpdate(XRING04power, GXRINGpower.state.toString)
end
rule PublishOnGXRINGDimChangeOnly
when
Item GXRINGDim changed
then
Thread::sleep(100)
publish(“mqtt”,“XRING01/in”, transform(“JS”, “scale100-255.js”, GXRINGDim.state.toString))
publish(“mqtt”,“XRING02/in”, transform(“JS”, “scale100-255.js”, GXRINGDim.state.toString))
publish(“mqtt”,“XRING03/in”, transform(“JS”, “scale100-255.js”, GXRINGDim.state.toString))
publish(“mqtt”,“XRING04/in”, transform(“JS”, “scale100-255.js”, GXRINGDim.state.toString))
postUpdate(XRING01Dim, GXRINGDim.state.toString)
postUpdate(XRING02Dim, GXRINGDim.state.toString)
postUpdate(XRING03Dim, GXRINGDim.state.toString)
postUpdate(XRING04Dim, GXRINGDim.state.toString)
end
rule PublishOnGXRINGSpeedChangeOnly
when
Item GXRINGSpeed changed
then
Thread::sleep(100)
publish(“mqtt”,“XRING01/in”, transform(“JS”, “speedscale100-255.js”, GXRINGSpeed.state.toString))
publish(“mqtt”,“XRING02/in”, transform(“JS”, “speedscale100-255.js”, GXRINGSpeed.state.toString))
publish(“mqtt”,“XRING03/in”, transform(“JS”, “speedscale100-255.js”, GXRINGSpeed.state.toString))
publish(“mqtt”,“XRING04/in”, transform(“JS”, “speedscale100-255.js”, GXRINGSpeed.state.toString))
postUpdate(XRING01Speed, GXRINGSpeed.state.toString)
postUpdate(XRING02Speed, GXRINGSpeed.state.toString)
postUpdate(XRING03Speed, GXRINGSpeed.state.toString)
postUpdate(XRING04Speed, GXRINGSpeed.state.toString)
end
rule PublishOnGXRINGNameChangeOnly
when
Item GXRINGname changed
then
Thread::sleep(100)
publish(“mqtt”,“XRING01/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGname.state.toString))
publish(“mqtt”,“XRING02/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGname.state.toString))
publish(“mqtt”,“XRING03/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGname.state.toString))
publish(“mqtt”,“XRING04/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGname.state.toString))
postUpdate(XRING01name, GXRINGname.state.toString)
postUpdate(XRING02name, GXRINGname.state.toString)
postUpdate(XRING03name, GXRINGname.state.toString)
postUpdate(XRING04name, GXRINGname.state.toString)
end
rule PublishOnGXRINGeffectChangeOnly
when
Item GXRINGeffects changed
then
Thread::sleep(100)
publish(“mqtt”,“XRING01/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGeffects.state.toString))
publish(“mqtt”,“XRING02/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGeffects.state.toString))
publish(“mqtt”,“XRING03/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGeffects.state.toString))
publish(“mqtt”,“XRING04/in”, transform(“MAP”, “ColoreffectsJSON.map”, GXRINGeffects.state.toString))
postUpdate(XRING01effects, GXRINGeffects.state.toString)
postUpdate(XRING02effects, GXRINGeffects.state.toString)
postUpdate(XRING03effects, GXRINGeffects.state.toString)
postUpdate(XRING04effects, GXRINGeffects.state.toString)
end
coloreffectJason.map
1==off
2==all
OFF==off
ON=/0
3=/0
4=/1
5=/2
6=/3
7=/4
8=/5
9=/6
10=/7
11=/8
12=/9
13=/10
14=/11
15=/12
16=/13
17=/14
18=/15
19=/16
20=/17
21=/18
22=/19
23=/20
24=/21
25=/22
26=/23
27=/24
28=/25
29=/26
30=/27
31=/28
32=/29
33=/30
34=/31
35=/32
36=/33
37=/34
38=/35
39=/36
40=/37
41=/38
42=/39
43=/40
44=/41
45=/42
46=/43
47=/44
48=/45
49=/46
50=/47
51=/48
52=/49
53=/50
54=/51
55=/52
56=/53
57=/54
58=/55
159=/56
160=/57
161=/58
162=/59
163=/60
201==tv
60=#FFFFFF
61=#C0C0C0
62=#808080
63=#000000
64=#FF0000
65=#800000
66=#FFFF00
67=#808000
68=#00FF00
69=#008000
70=#00FFFF
71=#008080
72=#0000FF
73=#000080
74=#FF00FF
75=#800080
Colour.js
(function (i) {
var res = i.split(",");
var out = HSVtoRGB((res[0]), (res[1]), (res[2]));
out2 = rgbToHex((out.r), (out.g), (out.b))
return out2;
})(input)
function componentToHex© {
var hex = c.toString(16);
return hex.length == 1 ? “0” + hex : hex;
}
function rgbToHex(r, g, b) {
return “#” + componentToHex® + componentToHex(g) + componentToHex(b);
}
//https://stackoverflow.com/questions/17242144/javascript-convert-hsb-hsv-color-to-rgb-accurately
function HSVtoRGB(h, s, v) {
var r, g, b, i, f, p, q, t;
if (arguments.length === 1) {
s = h.s, v = h.v, h = h.h;
}
h = h / 360;
s = s / 100;
v = v / 100;
i = Math.floor(h * 6);
f = h * 6 - i;
p = v * (1 - s);
q = v * (1 - f * s);
t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
return {
r: Math.round(r * 255),
g: Math.round(g * 255),
b: Math.round(b * 255)
};
};
DimScale100-255.js
##scale100-255.js for tranforming value from 0 -255 scale to 0 -100 scale for maclightining project
(function(i) {
var value = parseInt(i);
return “%”+Math.floor((value * 255) / 100);
})(input)
Speedscale100to255.js
(function(i) {
var value = parseInt(i);
return “?”+Math.floor((value * 255) / 100);
})(input)
Speedscale255-100.js
(function(i) {
var value = i.slice(4);
return “?”+Math.floor((value * 100) / 255);
})(input)
Dimscale255-100.js
(function(i) {
var value = i.slice(4);
return +Math.floor((value * 100) / 255);
})(input)