2018-04-19 08:12:43.807 [ome.event.ItemCommandEvent] - Item 'RGBLed' received command 349,66,100
2018-04-19 08:12:43.827 [vent.ItemStateChangedEvent] - RGBLed changed from 227,68,100 to 349,66,100
==> /var/log/openhab2/openhab.log <==
2018-04-19 08:12:43.834 [INFO ] [clipse.smarthome.model.script.RGBLed] - 349,66,100
2018-04-19 08:12:43.842 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Set HSB value of item RGBLed to RGB color value': The name 'hsbvalue' cannot be resolved to an item or type; line 7, column 27, length 8
Change
logInfo("RGBLed", hsbvalue.toString)
to
logInfo("RGBLed", hsbValue.toString)
2018-04-19 09:06:03.162 [ome.event.ItemCommandEvent] - Item 'RGBLedColor' received command 130,107,255
2018-04-19 09:06:03.169 [vent.ItemStateChangedEvent] - RGBLedColor changed from 58,255,56 to 130,107,255
The whole log, please from the moment you change RGBLed in the sitemap, so we can follow the rule being executed step by step. I Think there are no errors anymore but we will see.
==> /var/log/openhab2/events.log <==
2018-04-19 09:15:02.484 [ome.event.ItemCommandEvent] - Item 'RGBLedColor' received command 43,40,255
2018-04-19 09:15:02.490 [vent.ItemStateChangedEvent] - RGBLedColor changed from NULL to 43,40,255
2018-04-19 09:15:20.714 [ome.event.ItemCommandEvent] - Item 'RGBLed' received command 119,97,100
2018-04-19 09:15:20.723 [vent.ItemStateChangedEvent] - RGBLed changed from 241,84,100 to 119,97,100
==> /var/log/openhab2/openhab.log <==
2018-04-19 09:15:20.733 [INFO ] [clipse.smarthome.model.script.RGBLed] - 119,97,100
2018-04-19 09:15:20.740 [INFO ] [clipse.smarthome.model.script.RGBLed] - 119,97,100
2018-04-19 09:15:20.747 [INFO ] [se.smarthome.model.script.BRIGHTNESS] - 100
2018-04-19 09:15:20.766 [INFO ] [ipse.smarthome.model.script.REDVALUE] - 10
2018-04-19 09:15:20.777 [INFO ] [se.smarthome.model.script.GREENVALUE] - 255
2018-04-19 09:15:20.787 [INFO ] [pse.smarthome.model.script.BLUEVALUE] - 7
2018-04-19 09:15:20.792 [INFO ] [eclipse.smarthome.model.script.COLOR] - 10,255,7
==> /var/log/openhab2/events.log <==
2018-04-19 09:15:20.800 [ome.event.ItemCommandEvent] - Item 'RGBLedColor' received command 10,255,7
2018-04-19 09:15:20.806 [vent.ItemStateChangedEvent] - RGBLedColor changed from 43,40,255 to 10,255,7
2018-04-19 09:16:00.699 [vent.ItemStateChangedEvent] - Date changed from 2018-04-19T09:15:00.664+0300 to 2018-04-19T09:16:00.668+0300
No more errors,
Now the values are in the wrong format for your ESP
It wants values in Hex and we are sending Decimals
Letās change thatā¦
Change you rules to
rule "Set HSB value of item RGBLed to RGB color value"
when
Item RGBLed changed
then
//logInfo("RGBLed", RGBLed.state.toString)
val hsbValue = RGBLed.state as HSBType
//logInfo("RGBLed", hsbValue.toString)
val brightness = hsbValue.brightness.intValue
logInfo("BRIGHTNESS", brightness.toString)
val redValue = String.format("%02X", (hsbValue.red.floatValue * 2.55) as int)
logInfo("REDVALUE", redValue.toString)
val greenValue = String.format("%02X", (hsbValue.green.floatValue * 2.55) as int)
logInfo("GREENVALUE", greenValue.toString)
val blueValue = String.format("%02X", (hsbValue.blue.floatValue * 2.55) as int)
logInfo("BLUEVALUE", blueValue.toString)
val color = redValue + greenValue + blueValue
logInfo("COLOR", color)
RGBLedColor.sendCommand(color)
end
2018-04-19 09:31:56.733 [ome.event.ItemCommandEvent] - Item 'RGBLedColor' received command 63FE6D
2018-04-19 09:31:56.740 [vent.ItemStateChangedEvent] - RGBLedColor changed from NULL to 63FE6D
Is you light working?
If not then change:
val color = redValue + greenValue + blueValue
to
val color = "#" + redValue + greenValue + blueValue
you are the hero--------but i change -----esp/1/out to esp/1/inā¦i have no words to sayā¦thank u 10000 times
Sorry it took a like while, too many typos, my fault
Please like and mark the thread as solved,
We can finally close this one
Donāt forget to tidy up your rule, you donāt need the debug info anymore
and you donāt need the brightness variable either.
rule "Set HSB value of item RGBLed to RGB color value"
when
Item RGBLed changed
then
val hsbValue = RGBLed.state as HSBType
val redValue = String.format("%02X", (hsbValue.red.floatValue * 2.55) as int)
val greenValue = String.format("%02X", (hsbValue.green.floatValue * 2.55) as int)
val blueValue = String.format("%02X", (hsbValue.blue.floatValue * 2.55) as int)
val color = "#" + redValue + greenValue + blueValue
RGBLedColor.sendCommand(color)
end
i have this code working on a wemos mini board working with my broker through my phone however my leds are not working could you possible post your wiring setup