Hi guys,
I’m actually using openHAB 3.3.0 with MainUI configuration
I’m trying to integrate an ws2812b led strip driven by an ESP32 with an ESPHome firmware…
I’ve read a lot of threads about rgb conversion, but I’m struggeling with my integration.
from the ESP’s MQTT i get this string:
{"effect":"None","color_mode":"rgb","state":"OFF","brightness":85,"color":{"r":75,"g":55,"b":255}}
I already managed to bind:
-
effect
→ text channel -
state
→ switch channel -
brightness
→ dimmer channel
this is working so far… but now it get’s a little complicated
I want to get brightness
and color
to work with a colorwheel.
so I added:
-
color
→ RGB color channel
and used this JSONPATH:
JSONPATH:$.color
but this returns the whole unformatted json string
{"r":75,"g":55,"b":255}
which is not usable in this format…
or should I split the color
to three different channels?
-
colorR
→ number channel -
colorG
→ number channel -
colorB
→ number channel
anyway… I think I have to create a rule to convert RGB to HSB after all, but I’m unsure what’s the best way to go from here. But before writing a rule there are some conversions possible on channel side or am I mistaking?? I’m not good in using REGEX at all but maybe there a way to convert the color
string without splitting it to R,G,B first.
Maybe someone done something similar before and saves me from reinventing the wheel
I hope to get some help where and how I should convert the values.
After that my plan is to bring the values to a rule which send the converted data to a dummy color item and additionally converts the HSB values from the color item to return it to the channels.
I’m unsure which way is the most uncomplicated in OH3 to reach my goal