[SOLVED (with minor bug)] Gosund RGBW bulbs (tuya) flashed with Tasmota

Tags: #<Tag:0x00007f744e06bc28> #<Tag:0x00007f744e06bb60> #<Tag:0x00007f744e06ba98>

Hi Folks,

almost winter here in germany… so I decided to spend a little time with new bulbs…

I bought 4 RGBW bulbs manufactured by Gosund. They came with tuya firmware, and because I don’t like communicating with china cloud servers when I switch my light on, I decided to flash tasmota firmware with tuya-convert project from Github.

I installed tuya-convert on a Pi 3b. The ota (over the air) flash works only if you kill the wpa-supplicant service.

Now I configured the Tasmota module template with this configuration.

So far with no problems :wink:

After that I sniffed on my mqtt server for new channels to subscribe to:

RGB-Bulb-01
{"Time":"2019-11-02T00:44:16","Epoch":1572651856,"Uptime":"0T12:18:18","UptimeSec":44298,
"Heap":22,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":2,"POWER":"OFF",
"Dimmer":99,"Color":"252,252,252,252","HSBColor":"0,0,99","Channel":[99,99,99,99],
"Scheme":0,"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"xxxxxxxxxxxx",
"BSSId":"xx:xx:xx:xx:xx:xx","Channel":13,"RSSI":66,"LinkCount":2,"Downtime":"0T00:00:07"}}

Then I configured my openhab files to recognize the new bulbs.

POWER, Dimmer, Color and HSBColor looked quite promising to me, so I added them to the mqtt. things file…

Here’s my .things file:

Bridge mqtt:broker:MosquittoMqttBroker "MQTT - Mosquitto Broker" @ "MQTT" [ 
  host="192.168.xxx.xxx",
  secure=false,
  port=1883,
  qos=2,
  retainMessages=false,
  clientID="Openhab2",
  keep_alive_time=60000,
  reconnect_time=60000,
  username="openhab",
  password="xxxxxxxxx"
]
{
    Thing mqtt:topic:RGB-Bulb-01 "MQTT - RGB-Bulb-01" @ "Entrance"  {
        Channels:
            Type switch : switch "Power Switch" [ 
                stateTopic="stat/OpenHAB/RGB-Bulb-01/POWER", 
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/POWER",
                ON="ON",
                OFF="OFF"          
            ]
            Type string : dimmer "Dimmer" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                transformationPattern="JSONPATH:$.Dimmer"
            ]
            Type string : color "Color" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                transformationPattern="JSONPATH:$.Color"
            ]
            Type string : hsbcolor "HSB Color" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                transformationPattern="JSONPATH:$.HSBColor"
            ]
    }
}

And here’s the belonging .items file:

// RGB-Bulb-01
Switch  RGBBulb01Switch         "Switch"                                (gBulbs,gEntranceLight)         { channel="mqtt:topic:RGB-Bulb-01:switch" }
String  RGBBulb01Dimmer         "Dimmer"                <none>          (gBulbs)         { channel="mqtt:topic:RGB-Bulb-01:dimmer" }
String  RGBBulb01Color          "Color"                 <none>          (gBulbs)         { channel="mqtt:topic:RGB-Bulb-01:color" }
String  RGBBulb01HSBColor       "HSB Color"             <none>          (gBulbs)         { channel="mqtt:topic:RGB-Bulb-01:hsbcolor" }

I can switch on and off via Openhab right now, but I’m not able to dim or change colors.
I tried with a colorpicker, both the Color and the HSBColor channel to change colors, but both with no luck, also tried a slider on the Dimmer channel - same result :frowning:

Anyone here who is experienced with custom tasmota bulbs?? I think I have to change something like the channeltype in my things file. but trial and error doesn’t help out so far…

Maybe one could push me toi the right direction to get this fully working

Thanks and cheers

Hi @Dan! I just started tinkering with this topic myself but I very much got it to work so maybe we can figure this out. I’d recommend the following:

  1. Make sure the template is actually correct for your light bulb. Open Tasmota interface directly in the browser. Can you switch on/off? Can you dimm?
  2. Are you able to change colours in the Tasmota console? Open the console in your device and try something out, e.g.
    HsbColor 110,100,80
    Hope this gives you a green light :grin:
  3. If this is right there should be not much of a problem to add the MQTT device to openHAB. I personally have so far only added a “Color” channel with a “Color” item to the thing which is sufficient to control most of the features of the light bulb. The topic for the colour should include “cmnd” and “HsbColor”
  4. You have not configured any commands for the colour and dimmer so it’s unlikely anything will be changed in the light bulb.

You have not shared your config so it is difficult to say what exactly is not correct. I.e. your MQTT setup/topics seem to differ quite a bit from mine so I’m not able to debug remotetly. I can tell you that I was able to set the Tuya bulb up from Paper UI with the only file I needed to edit being the sitemap.

By the way, I am not using the Gosund light bulbs but instead opted for Slitinto (https://www.amazon.de/gp/product/B07SPBMCC7/) - they seem to be a bit brighter and they also support different white temperatures. The tuya-convert flash worked without much of a hickup (well, there was a hickup: Make sure to flash the included version of Tasmota first) and the first random template I tried (https://blakadder.github.io/templates/teckin_SB50_v3.html) got them to work.

Hope this helps, flash those tuyas before they block it again!

Cheers
Benjamin

1 Like

Thanks so much Benjamin… I will try your suggestions and report back :wink:

Ok here’s what I got so far:

The Tasmota template seems correct, I am able to switch & dim, also changing colors with console hsb command - thanks for that…

So I think we end up trying another thing/item config.

I will try a ‘color’ object to control RGB/HSB maybe this is the solution… I only tried ‘string’ and ‘slider’ on the dimmer yesterday…

Edit:
Now I have added a command channel to the thing and also removed Color and Dimmer channels to concentrate on HSBColor - it looks like this:

Thing topic RGB-Bulb-01 "MQTT - RGB-Bulb-01" @ "Entrance"  {
        Channels:
            Type switch : switch "Power Switch" [ 
                stateTopic="stat/OpenHAB/RGB-Bulb-01/POWER", 
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/POWER",
                ON="ON",
                OFF="OFF"          
            ]
            Type color : hsbcolor "HSB Color" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/HsbColor",
                transformationPattern="JSONPATH:$.HSBColor"
            ]
    }

also corrected the syntax e.g.

Thing mqtt:topic:RGB-Bulb_01

to

Thing topic RGB-Bulb-01

as this seems to be the corrrect way… although the old way also worked on my other mqtt things.

my item looks like this now

// RGB-Bulb-01
Switch  RGBBulb01Switch         "Switch"                                (gBulbs,gEntranceLight)         { channel="mqtt:topic:RGB-Bulb-01:switch" }
Color   RGBBulb01HSBColor       "HSB Color"             <none>          (gBulbs)         { channel="mqtt:topic:RGB-Bulb-01:hsbcolor" }

and my sitemap integration:

Colorpicker item=RGBBulb01HSBColor label="Entrance Light" icon="color"

I think the cmnd topic isn’t configured right in my OH2. but I don’t know how to sniff the right topic…

in Tasmota its configured like this:

Topic: RGB-Bulb-01
Full Topic: %prefix%/OpenHAB/%topic%/

which is similar to my working mqtt devices…

@goddib maybe you see a mayor mistake in my reconfigured files, but I think it is a wrong command topic I have to find out and change…

Any suggestions?

Your topic is correct
Your channel type is not see: https://www.openhab.org/addons/bindings/mqtt.generic/#supported-channels

            Type colorHSB : hsbcolor "HSB Color" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/HsbColor",
                transformationPattern="JSONPATH:$.HSBColor"
            ]

1 Like

Ok it seems to work now…

had to change some things to get it all working

First: If you use the new Thing config mentioned above, you have to change the according items also:

{ channel="mqtt:topic:RGB-Bulb-01:hsbcolor" }

no longer works, instead you have to use it like this in combination with the changed Thing syntax

{ channel="mqtt:topic:**YourBrokerNameHere**:RGB-Bulb-01:hsbcolor" }

After that I changed the Type of the topic to colorHSB as you wrote and it works now with this config:
.things file

Bridge mqtt:broker:MosquittoMqttBroker "MQTT - Mosquitto Broker" @ "MQTT" [ 
  host="192.168.xxx.xxx",
  secure=false,
  port=1883,
  qos=2,
  retainMessages=false,
  clientID="Openhab2",
  keep_alive_time=60000,
  reconnect_time=60000,
  username="openhab",
  password="xxxxxxxx"
]
{
    Thing topic RGB-Bulb-01 "MQTT - RGB-Bulb-01" @ "Entrance"  {
        Channels:
            Type switch : switch "Power Switch" [ 
                stateTopic="stat/OpenHAB/RGB-Bulb-01/POWER", 
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/POWER",
                ON="ON",
                OFF="OFF"          
            ]
            Type colorHSB : hsbcolor "HSB Color" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/HSBColor",
                transformationPattern="JSONPATH:$.HSBColor"
            ]
    }
}

.items file:

// RGB-Bulb-01
Switch  RGBBulb01Switch         "Switch"                                (gBulbs,gEntranceLight)         { channel="mqtt:topic:MosquittoMqttBroker:RGB-Bulb-01:switch" }
Color   RGBBulb01HSBColor       "HSB Color"             <none>          (gBulbs)         { channel="mqtt:topic:MosquittoMqttBroker:RGB-Bulb-01:hsbcolor" }

and sitemap integration:

            Colorpicker item=RGBBulb01HSBColor label="Entrance Color"
            Slider item=RGBBulb01HSBColor label="Entrance Dimmer"
            Switch item=RGBBulb01HSBColor label="Entrance Switch"

only for test purposes but all three items work.

just one last thing that is annoying to me. If I switch the bulb off, no matter if I chose a Switch or the Colorpicker, when I switch it back on its brightness is only at about 10% (the dimmerslider shows 100%) and only when opening the colorpickermenu (colorpalette symbol) the bulb dimms up to 100% - weird behavior can’t understand why this happens.

Last Edit:
When I use my Switch Item instead of my Color Item it behaves normal when switching back on. Maybe one shouldn’t use the color topic for switching ON and OFF… Only thing is now that the Colorpicker ON/OFF buttons still behave in that strange kind of way - weird!!

Glad everything is working!

I observe the same behaviour. From what I have dedcuted so far when using the colour picker clicking the “UP” arrow to dimm up sends the “ON” or “INCREASE” command to the HSBcolor item which gets messed up somewhere along the way. Not sure if that’s the issue and if there is a good work around. I will likely add a dimme channel and use rules to catch those buttons to send to the bulb. Not sure when I will have the time, though.

Cheers
Benjamin

1 Like

Thanks for that information… I was thinking there’s something wrong with my installation or something, good to know that the behavior is the same on your side :wink:

Big thanks again for pointing me to the right direction!!

Cheers
Dan

It definitely seems to have something to do with the Colorpicker module :confused: Not sure how to debug that.