I’m trying to add a Tuya Dimmer running on the Tasmota software to my Openhab configuration using MQTT. But I cannot find out what the best way is to configure my items and rules if I need them.
The Tuya dimmer can send the following status messages:
stat/Tuya_Slaapkamer/RESULT {“POWER”:“ON”}
stat/Tuya_Slaapkamer/RESULT {“POWER”:“ON”,“Dimmer”:85}
The result with only {“POWER”:“ON”} is sent when I press the on off button on the Tuya, the result with dimmer value is sent when I press the up/down buttons. (And sometimes when I press the On/Off button back to the on state)
To control the Tuya dimmer over MQTT I can sent the following commands:
cmnd/Tuya_Slaapkamer/Dimmer 30
cmnd/Tuya_Slaapkamer/Power ON
The Dimmer Command can be used to set the dimmer percentage 0 = completely off, 100 completely on
The Power Command can be used to turn the lamp on and off
There is a side note on the Dimmer command. When I set the percentage to 0, I will not be able to control the dimmer using the physical buttons anymore. So I will want to send the dimmer value until a minimum of 6 and when I slide the slider further to 0 I want to send the Power OFF command
In my items file I have the following two items added:
Dimmer CeilingDimmer "CeilingDimmer [%d%%]" {mqtt="<[mosquitto:stat/Tuya1/RESULT:state:JSONPATH($.Dimmer)]"}
Switch CeilingSwitch "CeilingSwitch" {mqtt="<[mosquitto:stat/Tuya1/RESULT:state:JSONPATH($.POWER)]"}
But after this I don’t know how to continue to correctly implement my dimmer. I think the nicest implementation will be with a single slider on my sitemap to control the dimmer.