- Platform information:
- Hardware: Raspberry Pi with OpenHABian
- OS: Raspbian GNU/Linux 10 (buster)
- Java Runtime Environment: openjdk version “1.8.0_222”
- openHAB version: 2.4.0
Hi,
I’m using a RGB LED-Controller flashed with Tasmota 6.6.0 controlled through a MQTT broker.
Here’s my current config:
Things:
Bridge mqtt:broker:LED_Control [ host="localhost", secure=false, username="openhabian", password="99Br0k3r!", clientID="LED_Control" ] {
Thing topic LED_01 "LEDs Fernseher" @ "EG_Wohnzimmer" {
Channels:
Type switch : PowerSwitch [stateTopic="stat/led_01/RESULT" , commandTopic="cmnd/led_01/POWER", transformationPattern="JSONPATH:$.POWER", on="ON", off="OFF" ]
Type string : ColorValue [stateTopic="stat/led_01/RESULT", commandTopic="cmnd/led_01/Color", transformationPattern="JSONPATH:$.Color"]
}
}
Items:
Color LED_01Color "Wohnzimmer LED TV" <colorpicker> (EG_Wohnzimmer, g_Licht, S_TV_Abend, g_Abwesenheit) ["Lighting", "Switchable"]
String LED_01String {channel="mqtt:topic:LED_Control:LED_01:ColorValue"}
Rules:
rule "LED_01"
when
Item LED_01Color changed
then
var HSBType hsbValue_01
var int redValue_01
var int greenValue_01
var int blueValue_01
var String RGBvalues_01
hsbValue_01 = LED_01Color.state as HSBType
redValue_01 = (hsbValue_01.red * 2.55).intValue
greenValue_01 = (hsbValue_01.green * 2.55).intValue
blueValue_01 = (hsbValue_01.blue * 2.55).intValue
RGBvalues_01= redValue_01.toString + "," + greenValue_01.toString + "," + blueValue_01.toString
sendCommand(LED_01String, RGBvalues_01)
logInfo("LED_01Color", RGBvalues_01)
end
Sitemap:
sitemap test label="Test" {
Colorpicker item=LED_01Color
}
So currently the color picker works like a charm. Turning off an on also works without a problem. Also changing the brightness below the color picker is working. But if I then turn the LED off and on again with the down and up arrows, the brightness is set to maximum again.
For example if I change the color to full blue, these values are send: RGB=0,0,255
If I set the brightness lower it changes to: RGB=0,0,173
But after turning off and on it changes again to: RGB=0,0,255
Is there any easy way to save the brightness? Or are there better ways to implement RGB controllers with Tasmota?
Thanks,
Sebastian