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
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?
The %s represent the value of the slider.
Glad youâve found the solution!
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
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.