Tuya Dimmer with Tasmota using MQTTv1

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.

You can set a min and max value to a slider on the sitemap:
Element Type Slider

This gave me a start, setting a minimum resolved the issue of having a device that will no longer works.
In my sitemap I’ve now added 2 devices a switch and a slider to control the dimmer value and the on of value

Slider item= CeilingDimmer label="TestDimmer [%d %%]" minValue=6 maxValue=100
Switch item= CeilingSwitch  label="TestSwitch"

But is it possible to somehow combine these 2 items to a single slider, so that I can have 1 item in my sitemap to fully control the dimmer. When sliding below 6 I want to send the Power command OFF command

Yes just use rules

The docs are a little ambiguous. Try adding the “switchSupport” option to the slider. Then a short tap of up will send ON and a short tap on down will send OFF. What isn’t clear in the docs is whether this option is only supported by ClassicUI, which would be sad.