HELP configure MQTT Shelly dimmer

I just installed the new Shelly dimmer, I turned on the MQTT function and configured a generic MQTT device and linked a number channel.

For the power on/off button it works just fine, I used the support page from Shelly to configure it, so the status is: shellies/shelltafellamp/light/0 and for the command prefix: shellies/shelltafellamp/light/0/command

But I can’t figure out how to get the dimmer function working, I used the command: shellies/shelltafellamp/light/0/set as the website described but it doesn’t work.
The Shelly support page is: https://shelly-api-docs.shelly.cloud/?shell#shelly-dimmer-sl-mqtt

Try the search function in this topic.:wink: Shelly Binding

Thanks for the suggestion but I can’t find the part how to solve my issue.

I don’t use the shelly binding but the MQTT function of the Shelly because I like the response time and reliability of the MQTT system.

The thing is that the dimmer of shelly are quit new so there are not a lot of good examples on the MQTT or openhab part.

Hope someone has a good idea what I could try :slight_smile:

So this is the config in PaperUI at the moment, I feel like I need to fill out the transformation field but can’t figure out what the statement should be…

If I remember correct from other shelly device…you have to send the whole payload everytime.
So you need to create a rule to put together the payload and send it

Using data from from the shelly guide the important part of your rule would be:

var shellyDimmerPayload='
{
"turn": "on", 
"brightness": 100     
}'

YourShellyItem.sendCommand(shellyDimmerPayload)

I don’t know if you can construct the payload only with the brightness line …you could try and let us know.

edit: I edited because I realized I was using wrong data from a different part of the shelly guide, now should be ok.

Thanks, I started playing around a bit with MQTT.fx and with sending some different types of payload.

After some time I figured out that when I use the payload {“turn”: “on”, “brightness”: 100} it wil always set the light at 100% brightness, so I changed the payload to {“turn”: “on”, “brightness”:%s} and that works great, so the dimmer works with a slider on my habpanel.

I used that payload because I saw it in a example somewhere but what does %s mean in this case?

Another question, when I put it to 0, it stays on, have to fix this?

So this is the solution

The %s represent the value of the slider.
Glad you’ve found the solution! :+1:

In this case if you put 0, only the brightness goes to zero…but the value of “turn” remains on.

To be able to turn it off I think you need to change the structure…maybe with a proxy item slider so when you slide to zero you can via rule send the payload with the “turn” to off.
With a the proxy item you’ll need to clear out all the transformation on the thing definition and send the payload using a rule like I posted above

Thanks for thinking with me, I created a really simple rule but it works :slight_smile:

this is it:

rule "Dimmer turn light off when 0"

when
    Item Tafellamp_dimmer received command 0
then
	Tafellamp_switch.sendCommand(OFF)
end 

Now I still want to do more thing, I want the lights to fade in or out when I change the brightness of the lamp, after a quick search it should be possible, but I will try that some other time because it quite big rules to do that.