arachnetech / homebridge-mqttthing

A plugin for Homebridge allowing the integration of many different accessory types using MQTT.
Apache License 2.0
459 stars 104 forks source link

Sonoff Strip L1 #293

Open zuhair68 opened 3 years ago

zuhair68 commented 3 years ago

I'm using homebridge-mqttthing with Sonoff L1 Strip light. Homebridge and the Tasmota web interface are exchanging the correct status when toggling the light. When changing the light level from Tasmota interface, Homebridge is not receiving the update.

This is the configuration: { "type": "lightbulb-HSV", "name": "Master Bedroom Strip", "url": "MQTT://192.168.3.100:1883", "topics": { "getOnline”: "tele/FF_Master_Bedroom_Small_Strip/LWT", "setHSV”: "cmnd/FF_Master_Bedroom_Small_Strip/HSBColor", "getHSV”: "stat/FF_Master_Bedroom_Small_Strip/HSBColor", "getOn”: "stat/FF_Master_Bedroom_Small_Strip/POWER", "setOn”: "cmnd/FF_Master_Bedroom_Small_Strip/POWER" }, "integerValue”: true, "onValue”: "ON", "offValue”: "OFF", "otherValueOff”: true, "accessory”: "mqttthing" }

Tasmota template: {"NAME":"Generic","GPIO":[0,148,0,149,0,0,0,0,0,56,0,0,0],"FLAG":0,"BASE":70}

Tasmota console when changing the light level from Homebridge or HomeKit: 21:48:09 MQT: stat/FF_Master_Bedroom_Small_Strip/POWER = ON

21:48:09 MQT: stat/FF_Master_Bedroom_Small_Strip/RESULT = {"POWER":"ON","Dimmer":61,"Color":"156,156,156","HSBColor":"0,0,61","Channel":[61,61,61]}

arachnetech commented 3 years ago

It doesn't look as if Tasmota is publishing stat/FF_Master_Bedroom_Small_Strip/HSBColor when you change the light level. If that's the case, it would appear that you need to read it from the JSON published to stat/FF_Master_Bedroom_Small_Strip/RESULT. Is that correct?

If so, something like this might work for your getHSV topic:

"getHSV”: {
    "topic": "stat/FF_Master_Bedroom_Small_Strip/RESULT",
    "apply": "return JSON.parse(message).HSBColor"
},
joaodforce commented 1 year ago

I just finished setting up My Sonoff L1 with MQTT-THING The config looks like this:

I've decided to use the RESULT topic for the getOn because the regular POWER topic does not update to ON whenever the device is turned on by changing the brightness or color, I personally thing this is a flaw in with tasmotta, but my workaround grabbing the power state from the RESULT json Works pretty well.

Its important t know that the property HSBColor is not always present in the RESULT topic, but it seems like the plugin ignores the event when null or undefined is returned, so no problem with that.

I've also setup the adaptiveLighting to false, because the Sonoff L1 LEDs are only RGB, and the white color (as well as the whole warm to cool white range) looks pretty bad, so I don't even bother with it.

I wonder if its possible to set a bulb in home kit to not even support those.

{
            "type": "lightbulb-HSV",
            "name": "Painel LED",
            "topics": {
                "getOnline": "tele/tasmota_E242A8/LWT",
                "getOn": {
                    "topic": "stat/tasmota_E242A8/RESULT",
                    "apply": "return JSON.parse(message).POWER;"
                },
                "setOn": "cmnd/tasmota_E242A8/POWER",
                "setHue": "cmnd/tasmota_E242A8/HsbColor1",
                "setSaturation": "cmnd/tasmota_E242A8/HsbColor2",
                "setBrightness": "cmnd/tasmota_E242A8/HsbColor3",
                "setHSV": "cmnd/tasmota_E242A8/HSBColor",
                "getHSV": {
                    "topic": "stat/tasmota_E242A8/RESULT",
                    "apply": "return JSON.parse(message).HSBColor;"
                }
            },
            "integerValue": true,
            "adaptiveLighting": false,
            "onValue": "ON",
            "offValue": "OFF",
            "otherValueOff": true,
            "accessory": "mqttthing"
        }
joaodforce commented 1 year ago

Ive been using this for a couple of hours now and I'm pretty pleased with the results, I shall get back to this topic if I make any changes.

Maybe this can be added to the list of validated configs?