I have to send over HTTP hex values to a Digital RGB LED.
My Rule:
import org.openhab.core.library.types.HSBType
import java.awt.Color
rule "Set NeoPixel_RGB value"
when
Item NeoPixel_RGB changed
then
httpRGB= "http://192.168.0.23/all?rgb="Integer::toHexString((NeoPixel_RGB.state as HSBType).toColor().getRGB())
sendHttpGetRequest(httpRGB)
end
The URL is called by
http://192.168.0.23/all?rgb=3082fe
and gives a JSON result with
{"mode":2, "delay_ms":20, "brightness":41, "color":[48, 130, 254]}
events.log has some entries but the color is not changing.
2017-01-11 01:05:19.025 [ItemStateChangedEvent ] - NeoPixel_RGB changed from 246,49,100 to 163,62,100
2017-01-11 01:05:19.600 [ItemCommandEvent ] - Item 'NeoPixel_RGB' received command 70,51,100
2017-01-11 01:05:19.606 [ItemStateChangedEvent ] - NeoPixel_RGB changed from 163,62,100 to 70,51,100
2017-01-11 01:05:22.223 [ItemStateChangedEvent ] - Indoor_Hum changed from 45.20 to 45.40
2017-01-11 01:05:29.549 [ItemCommandEvent ] - Item 'NeoPixel_RGB' received command 70,51,0
2017-01-11 01:05:29.560 [ItemStateChangedEvent ] - NeoPixel_RGB changed from 70,51,100 to 70,51,0
2017-01-11 01:05:30.494 [ItemCommandEvent ] - Item 'NeoPixel_RGB' received command 70,51,0
2017-01-11 01:05:32.791 [ItemCommandEvent ] - Item 'NeoPixel_RGB' received command 70,51,100
2017-01-11 01:05:32.800 [ItemStateChangedEvent ] - NeoPixel_RGB changed from 70,51,0 to 70,51,100
HTTP Binding is installed and I am using already for dimming but color wont work.