-
Platform information:
- Hardware: Rapsberry Pi 3 Model B
- OS: OpenHabian 2.4.0 (Raspbian stretch)
- Java Runtime Environment: Zulu Embedded 8.25.0.76
- openHAB version: 2.4.0
-
Issue of the topic:
I have an LED strip controller (Magichome) running the Tasmota firmware. Openhab is configured to interface with it using MQTT v1 binding (I’d already got a number of other Tasmota devices working successfully with the v1 binding so don’t want to switch to the v2 binding if I can avoid it).
Almost everything is working fine with the LED strip through the Basic UI: I can power it on and off from a Switch element, and also from the ^ and v buttons on a Colorpicker element; and I can control color and dimming through the Colorpicker element (on the color wheel and the dimmer slider on the Colorpicker).
The problem is that when I power off, and then on again, the dimming slider on the Colorpicker element is set to 100%. This doesn’t match the setting in the device - the device powers on at the dimmer level it had when it powered off.
How can I get the dimmer slider to match?
Items:
Color Kitchen_UtilLight "Utility" <lightbulb> Switch Kitchen_UtilLightPwr {mqtt=">[mosquitto:tasmota/kitchen/lights/sonoff-ledutil/cmnd/POWER:command:*:default], <[mosquitto:tasmota/kitchen/lights/sonoff-ledutil/stat/POWER:state:default]", autoupdate="false"} Color Kitchen_UtilLightCol {mqtt=">[mosquitto:tasmota/kitchen/lights/sonoff-ledutil/cmnd/HSBCOLOR:command:*:default], <[mosquitto:tasmota/kitchen/lights/sonoff-ledutil/stat/RESULT:state:JSONPATH($.HSBColor):.HSBColor.]", autoupdate="false"}
Sitemap:
Switch item=Kitchen_UtilLightPwr label="Utility" icon="light" Colorpicker item=Kitchen_UtilLight label="Utility" icon="colorwheel"
Rules:
rule "LED command intercept" when Item Kitchen_UtilLight received command then if (receivedCommand instanceof OnOffType) { logInfo("LED intercept", "Received OnOffType") Kitchen_UtilLightPwr.sendCommand(receivedCommand) } else if (receivedCommand instanceof HSBType) { logInfo("LED intercept", "Received HSBType") Kitchen_UtilLightCol.sendCommand(receivedCommand) } end
Tasmota console log (Power on, dim to 50%, power off, power on):
16:24:16 MQT: tasmota/kitchen/lights/sonoff-ledutil/stat/RESULT = {"POWER":"ON"} 16:24:16 MQT: tasmota/kitchen/lights/sonoff-ledutil/stat/POWER = ON 16:24:28 MQT: tasmota/kitchen/lights/sonoff-ledutil/stat/RESULT = {"POWER":"ON","Dimmer":50,"Color":"7F7F7F","HSBColor":"0,0,50","Channel":[49,49,49]} 16:24:28 MQT: tasmota/kitchen/lights/sonoff-ledutil/stat/RESULT = {"POWER":"ON","Dimmer":50,"Color":"7F7F7F","HSBColor":"0,0,50","Channel":[49,49,49]} 16:24:52 MQT: tasmota/kitchen/lights/sonoff-ledutil/stat/RESULT = {"POWER":"OFF"} 16:24:52 MQT: tasmota/kitchen/lights/sonoff-ledutil/stat/POWER = OFF 16:24:57 MQT: tasmota/kitchen/lights/sonoff-ledutil/stat/RESULT = {"POWER":"ON"} 16:24:57 MQT: tasmota/kitchen/lights/sonoff-ledutil/stat/POWER = ON