Tasmota flashed MagicHome RGB LED strip controller via MQTT


We were controlling a generic 12V 5050 RGB LED strip with the supplied IR remote, but I wanted to tie it in to OpenHab

Below is what worked for me - hope it helps!



  • 5050 RGB LED strip - I already had this one which came with the IR controller and remote.
  • MagicHome WIFI RGB LED strip controller - I bought this one which also has IR capability (WF113IR).


  • MQTT broker - I use Mosquitto, setup as per its defaults
    • On my setup, Mosquitto and OpenHab are running on the same device, at
  • JSONPath and RegEx Transformation installed in OpenHab
    • PaperUI -> Add-ons -> Transformations -> JSONPath Transformation -> Install
    • PaperUI -> Add-ons -> Transformations -> RegEx Transformation -> Install

Hardware setup

The MagicHome device is ESP8285 based, which means it can be flashed with Tasmota using the instructions here.

Tasmota setup


(http://sonoff-ip-address/mq , or device home -> Configuration -> Configure MQTT )

OpenHab setup


MQTT bridge

I have a separate file which just contains the bridge Thing to my Mosquitto MQTT broker:

Bridge mqtt:broker:MosquittoMqttBroker "Mosquitto MQTT Broker" [


//RGB1 LED strip
Thing mqtt:topic:swRGB1 "RGB1 LED strip" (mqtt:broker:MosquittoMqttBroker) {
		Type switch:switch "Power" [
		Type switch : reachable "Reachable" [
			stateTopic = "tele/swRGB1/LWT",
		Type dimmer:dimmer "Dimmer" [
		Type colorHSB:color "Colour" [

Note: When setting POWER on, Tasmota replies with

stat/swRGB1/RESULT = {"POWER":"ON"}`

This is also picked up by the dimmer and colour channels because they are linked to the same stateTopic (stat/swRGB1/RESULT). The RegEx transformation first tries to find either the Dimmer or HSBColor property in the reply. If it doesn’t exist, nothing is passed onto the JSONPath transformation - i.e. the event is ignored, as neither the dimmer nor colour was altered.

Items file

Switch sRGB1 "RGB1 LED Strip" (gLights, gIndoorLights, gUpstairsLights) {channel="mqtt:topic:swRGB1:switch"}
Switch sRGB1Reachable "RGB1 LED Strip" (gReachable) { channel="mqtt:topic:swRGB1:reachable" }
Dimmer dRGB1 "RGB1 LED Strip" {channel="mqtt:topic:swRGB1:dimmer"}
Color cRGB1 "RGB1 LED Strip" {channel="mqtt:topic:swRGB1:color"}

Sitemap file

Switch item=sRGB1 label="RGB strip" icon="light"
Slider item=dRGB1 label="RGB strip [%d %%]" sendFrequency=500
Colorpicker item=cRGB1 label="RGB strip colour"

Advanced sitemap file

This sitemap file is very similar to the one above, but when the MagicHome device goes offline the controls will be hidden and replaced with an error icon

Switch item=sRGB1 label="Sebs bed" icon="light" visibility=[sRGB1Reachable==ON]
Slider item=dRGB1 label="Sebs bed [%d %%]" icon="slider" sendFrequency=500 visibility=[sRGB1Reachable==ON]
Colorpicker item=cRGB1 label="Sebs bed colour" visibility=[sRGB1Reachable==ON]
Text item=sRGB1Reachable label="Sebs bed [%s]" icon="error" visibility=[sRGB1Reachable==OFF]

Rule snippets

//Turn RGB strip on

//Turn RGB strip off

//Dim RGB strip to 50%

//Set RGB strip colour to red (and also turn it on if off)
//Colour value in quote marks is a HSB/HSV value
//First number is Hue, second is Saturation, third is Brightness (or Value)

Edit 23/12/2020: Updated Things to split the Broker and Generic Thing into two files.
Edit 05/07/2020: Improved things definition for dimmer and colour to remove warnings in logs. Requires REGEX transformation.
Edit 21/06/2020: Updated with improved things definition, additional sitemap configuration, and removed extraneous rules which are no longer required as a result of the improved things definitions.
Edit 18/05/2020: Updated to use default Tasmota MQTT settings for FullTopic
Edit 20/04/2020: Add channel, thing and rule enabling the main switch item to update if the LED strip has been turned on via the IR remote.


Thanks for your comprehensive post. I’m attempting to implement it but what are the rule snippets?
Can you post the full rule?

Those are just simple lines that you can use in your own rules. They’re not required to control the lights from your sitemap!

Thanks for the post, it realy helped me setting it all up. I just have one small problem that maybe you have the answer: Any time I pick a color “colorpicker” dimmer is set to 50%. Appreciated all your help.

This is an annoying bug with BasicUI in a browser, but works fine on the phone apps (Android/iOS). See:

1 Like

Thanks once again. Tested and it`s all fine when using the phone app.