MagicHome with Tasmota and OpenHab2


I’m looking for some hints on how to set up a flashed MagicHome strip running Tasmota into OpenHab.
So I currently only have a bunch of SonOffs running - where I found lots of MQTT examples. But I’m not sure for the MagicHome and PWM RGB stuff. So how to set the channels via MQTT and what item would be correct for OpenHab.
To my understanding I stay with the MQTT binding (because of Tasmota) and ignroe the WiFI LED Strip binding that also exists, correct?

I haven’t found an example I understood - so if anyone has a working config or could point me to one I would greatly appriciate this.



Great tip with MagicHome - just bought one with LEDs but did not recognize that it can be flashed with tasmota

I also have some MagicHome / Arilux LC-01 with Tasmota running.

First you have to enable PWM functions within tasmota. For this I use the built-in command window from tasmota. To set PWM mode just type: SetOption15 1

After that, you can control your LED via Color RRGGBB and Dimmer <VAL>
To Switch the RGB on or off just use Power on and Power off

Put it the right way to your MQTT Topic and everything works like a charm…

At the moment I don’t have access to my openhab configurations, but there are also some samples on the web to have the colorpicker to work with the MagicHome via MQTT.

More information about the commands:


Hi Andreas,

thanks for that. I made some progress so its basically working.
The SetOption15 On command you send via the Console, correct? I’m asking because I’m currently only getting the LEDs either on or off - but no PWM.
So setting the color to 000000 turns everything off, AAAAAA (just as an example) turns on. Seems my PWM is off. But I’m not sure why.

Again thanks a lot for you help

Hi Nico,

these are my items for a Arilux RGB-Controller with Tasmota firmware:

Color  EG_Kitchen_Arilux_Color "Licht EG Küche RGB"         (gRGB)                
String EG_Kitchen_Arilux_RGB   "Licht EG Küche RGB [%s]"    (gRGB)                {mqtt="<[mosquitto:stat/ariluxegkitchen/RESULT:state:JSONPATH($.Color)]"}
Switch EG_Kitchen_Arilux_Power "Licht EG Küche RGB [%s]"    (gRGB, gLightEG)                {mqtt=">[mosquitto:cmnd/ariluxegkitchen/POWER:command:*:default], <[mosquitto:tele/ariluxegkitchen/STATE:state:JSONPATH($.POWER)"}
Dimmer EG_Kitchen_Arilux_Dim   "Licht EG Küche RGB dimm [%.0f %%]" (gEGKitchen, gLightsDim) {mqtt=">[mosquitto:cmnd/ariluxegkitchen/DIMMER:command:*:default], <[mosquitto:stat/ariluxegkitchen/RESULT:state:JSONPATH($.Dimmer)"}
Number EG_Kitchen_Arilux_RSSI  "Arilux EG Küche RSSI [%d %%]"      (gChartRSSI, gRSSI)      {mqtt="<[mosquitto:tele/ariluxegkitchen/STATE:state:JSONPATH($.Wifi.RSSI)"}
String EG_Kitchen_Arilux_VerboseInfo   "Arilux EG Küche Info [%s]"             //   {mqtt="<[mosquitto:tele/ariluxegkitchen/INFO1:state:JSONPATH($)], <[mosquitto:stat/ariluxegkitchen/STATUS2:state:JSONPATH($)], <[mosquitto:stat/ariluxegkitchen/RESULT:state:JSONPATH($)]" }
String EG_Kitchen_Arilux_Firmware_Version "Arilux EG Küche FW Version [%s]"       {mqtt="<[mosquitto:stat/ariluxegkitchen/STATUS2:state:JSONPATH($.StatusFWR.Version)]"}
Number EG_Kitchen_Arilux_Uptime           "Arilux EG Küche Uptime [%d hrs]" (gUptime)       {mqtt="<[mosquitto:tele/ariluxegkitchen/STATE:state:JSONPATH($.Uptime)]"}
Number EG_Kitchen_Arilux_Bootcount        "Arilux EG Küche Bootcount [%d]"  (gBootcount)    {mqtt="<[mosquitto:stat/ariluxegkitchen/STATUS1:state:JSONPATH($.StatusPRM.BootCount)]"}

And this is the rule to set the color via the ColorPicker:

    rule "Set RGB value EG Kitchen"
          Item EG_Kitchen_Arilux_Color changed
          var HSBType hsb = EG_Kitchen_Arilux_Color.state as HSBType
          var Color color = Color::getHSBColor(hsb.hue.floatValue / 360, hsb.saturation.floatValue / 100, hsb.brightness.floatValue / 100)
          var String rgb = String::format("%1$02x%2$02x%3$02x",,,
          publish("mosquitto", "cmnd/ariluxegkitchen/color", rgb)

Then I have some rules to cyclicly get status and color info from Arilux, if the color is changed via direct command without openhab. The commands are:

publish("mosquitto", "cmnd/" + device_id + "/status", "2")
publish("mosquitto", "cmnd/" + device_id + "/status", "1")
publish("mosquitto", "cmnd/" + device_id + "/color", "")
publish("mosquitto", "cmnd/" + device_id + "/dimmer", "")

with device_id as name of the RGB controller within the MQTT topic. It’s like the example from Tasmota wiki to get the information about the firmware versions from all Tasmota-Devices…

Hope this helps…

By the way:
If you set the color to “AAAAAA” then you have a dimmed white color. If you set to “FF0000” you should get a bright red, “800000” should set a dimmed red. “00FF00” should set a green, and so on…
If you set color to “FF8040” (Red bright, green darker, and a little bit of blue) and you set dimmer to 50, the color should recalculated to “804020” (The same color with less brightness).



Hi Andreas,

thats awesome, thanks a lot for the examples. That gives me quite a bit to digest and build on…
Vielen Dank!


Hey @imhofa,

I’m really interested in your solution, but I got the error “The name ‘publish’ cannot be resolved to an item or type” for the Rule.
Do you habe any idea what de Problem is? BTW I’m using openHAB 2.2.0 Release Build.


Hi @lxfrdl,

you have to install MQTT binding to get the publish command…

So just install MQTT binding via PaperUI and configure it in service/mqtt.cfg


Hey @imhofa,

what a fast support :).

I already installed it an configured it under services/mqtt.cfg.
I found trough research that I need

import java.awt.Color

before the rule to Support Color.
Maybe it it something similar?
Anyways thanks for your reply!


I have the following imports at the beginning of the rule file:

import org.openhab.core.library.types.HSBType
import java.awt.Color

Do you get some information in the logs about mqtt at startup?
If the binding is installed you should have the publish command…
So just restart openhab and see what the logs are saying about mqtt binding…


edit: AND you need the MQTT Action Binding as well…

1 Like

This was the missing piece :). After I installed the Action it works like a charm.

import org.openhab.core.library.types.HSBType

resultet for me in the error Configuration model 'alex_rgb_beleuchtung.rules' is either empty or cannot be parsed correctly!

To sum up after installing MQTT Action and MQTT Binding the following rule

import java.awt.Color

rule "Set RGB value Alex RGB"
    Item Alex_RgbStrip_Color changed
    var HSBType hsb = Alex_RgbStrip_Color.state as HSBType
    var Color color = Color::getHSBColor(hsb.hue.floatValue / 360, hsb.saturation.floatValue / 100, hsb.brightness.floatValue / 100)
    var String rgb = String::format("%1$02x%2$02x%3$02x",,,
    publish("broker", "cmnd/alexrgb1/color", rgb)

works perfectly.

@imhofa Thank you so much!

Sorry about the late information about MQTT Action. Most times you install a setup but can’t remember every single step…

Glad that it’s working now…


1 Like

Thanks it works for me also. But one issue encounters. I’ve connected a WS2812 to a Wemos Mini. It’s running well, also color changing works with the rule above. But if I select a scheme (Webconsole command e.g. “scheme 8” ) Than i get the following error in openhab.log:
018-03-21 14:29:51.434 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: Invalid path ‘$.Color’ in ‘{“Scheme”:2}’
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform( [200:org.openhab.core.compat1x:2.2.0]
at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage( [231:org.openhab.binding.mqtt:1.11.0]
at []
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage( []
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage( []
at []
at [?:?]


I think the problem is, that the return value of the mqtt broker is different, depending on what action is started:
stat/sonoffWemosMini/RESULT {“POWER”:“ON”,“Dimmer”:100,“Color”:“00FF00”}
stat/sonoffWemosMini/RESULT {“Scheme”:2}

I think a workaround would be to grab complete Result String and split it up into separate mqtt items manually…

Anybody an idea to proceed?

The problem is that Tasmota answers with different payload within RESULT as you showed.
If you change the dimmer value then the JSON returns just the value for “Dimmer”, if you change the color the answer is just the “Color”-value.

I can live with the error messages in this case…

The only solution I see is getting a Proxy item with the JSON return and split this within a rule. With this solution it is possible to check the payload and update the corresponding item…

For me: too much work…



wrote a mail that “greps” out the JSON Result, so no Logging occurs any longer:

rule “Wemos Mini 1 LED Result Topic”
Item i_mqtt_sonoffWemosMini_1_Result changed

        if (i_mqtt_sonoffWemosMini_1_Result.state.toString.contains("Speed") ) {
            val speed = transform("JSONPATH", "$.Speed", i_mqtt_sonoffWemosMini_1_Result.state.toString)

        if (i_mqtt_sonoffWemosMini_1_Result.state.toString.contains("POWER") ) {
            val power = transform("JSONPATH", "$.POWER", i_mqtt_sonoffWemosMini_1_Result.state.toString)
        if (i_mqtt_sonoffWemosMini_1_Result.state.toString.contains("Color") ) {
            val color = transform("JSONPATH", "$.Color", i_mqtt_sonoffWemosMini_1_Result.state.toString)

            val power = transform("JSONPATH", "$.POWER", i_mqtt_sonoffWemosMini_1_Result.state.toString)

            val dimmer = transform("JSONPATH", "$.Dimmer", i_mqtt_sonoffWemosMini_1_Result.state.toString)

        if (i_mqtt_sonoffWemosMini_1_Result.state.toString.contains("Fade") ) {
            val fade = transform("JSONPATH", "$.Fade", i_mqtt_sonoffWemosMini_1_Result.state.toString)

        if (i_mqtt_sonoffWemosMini_1_Result.state.toString.contains("Pixels") ) {
            val pixels = transform("JSONPATH", "$.Pixels", i_mqtt_sonoffWemosMini_1_Result.state.toString)

         if (i_mqtt_sonoffWemosMini_1_Result.state.toString.contains("Scheme") ) {
            val scheme = transform("JSONPATH", "$.Scheme", i_mqtt_sonoffWemosMini_1_Result.state.toString)


Here are the items:
Switch i_mqtt_sonoffWemosMini_1_Power “Sonoff Wemos Mini 1 LED: [%s]” { mqtt=">[mosquitto:cmnd/sonoffWemosMini_1/POWER:command::default]"}
Color i_mqtt_sonoffWemosMini_1_Color “Sonoff Wemos Mini 1 Color”
String i_mqtt_sonoffWemosMini_1_RGB
String i_mqtt_sonoffWemosMini_1_Result {mqtt="<[mosquitto:stat/sonoffWemosMini_1/RESULT:state:default]"}
Dimmer i_mqtt_sonoffWemosMini_1_Dimmer “Sonoff Wemos Mini 1 Dimmer [%.0f %%]” {mqtt=">[mosquitto:cmnd/sonoffWemosMini_1/DIMMER:command:
Number i_mqtt_sonoffWemosMini_1_Speed “Sonoff Wemos Mini 1 LED Speed: [%d]” {mqtt=">[mosquitto:cmnd/sonoffWemosMini_1/SPEED:command::default]"}
Number i_mqtt_sonoffWemosMini_1_Schema “Sonoff Wemos Mini 1 Schema: [%d]” {mqtt=">[mosquitto:cmnd/sonoffWemosMini_1/SCHEME:command:
Number i_mqtt_sonoffWemosMini_1_Programm “Programm [MAP(]”
Number i_mqtt_sonoffWemosMini_1_Pixels “Sonoff Wemos Mini 1 Pixels [%d]”
Switch i_mqtt_sonoffWemosMini_1_Fade “Sonoff Wemos Mini 1 Fade: [%s]” { mqtt=">[mosquitto:cmnd/sonoffWemosMini_1/FADE:command:*:default]" }

Of course MQTT Topics must fit for you environment…

1 Like

Are there anyone here who use this kind of MagicHome (copy maybe?) with Tasmota and OpenHab:

If yes, does it requires flashing Tasmota? Or it can be used without modifying the firmware? Is this thing reliable?


I just started using this controller with OpenHAB this week. You can use the wifi LED binding, is working fijne.

Yeah I saw this binding before, but I was not sure that Tasmota is needed for this or not.
Do you use some modified firmware or you use the original firmware on this controller?

Nope, no other firmware. So it’s realy simple. Discovery is also working if needed.

Thanks for your help!