Shelly 2 Dimmer - Control the brightness

Hello all,
sorry for that newbie question …

I have bought a Shelly 2 Dimmer, and want to control the brightness and read the temperature via OpenHab.

You can find the MQTT documentation of the Shelly here:
https://shelly-api-docs.shelly.cloud/#shelly-dimmer-sl-status

According to this, I can read the brightness via /light/0 with attribute brightness.
`GET /light/0

{
“ison”: false,
“has_timer”: false,
“timer_started”: 0,
“timer_duration”: 0,
“timer_remaining”: 0,
“mode”: “white”,
“brightness”: 50
}`

MQTT State Topic is shellies/shellydimmer2-xx/light/0/ and this is not working, because the attribute is missing.
Where can I add these?

Thanks a lot
Tobias

Ensure the JSONPath Transformation service is installed, then use this for Incoming Value Transformations (assuming you’re using PaperUI)

JSONPATH:$.brightness

If you’re using files, add

transformationPattern="JSONPATH:$.brightness"

to your Thing Channel.

Ahhh perfect you are right, the reporting is working now.

Last question, openHab shows me now the brightness as following:
14.14141414141414141414141414141414 %

What can i do to cut before the dot?

BR
Tobias

State presentation. https://www.openhab.org/docs/configuration/items.html#state-presentation

What are you using to view this number?

This number represents the brightness. I configured at the shelly gui a brightness level of 15%, but at OpenHab it is represented as 14.141414%

How are you viewing this number in openHAB? PaperUI, BasicUI/sitemap, HABPanel?

Primarily I’m usung HabPanel, but for debug options sometimes PaperUI

To control the presentation of Item values, use the [state presentation] option embedded in the Item’s label definition.

"My dimmer text [%.0f %%]"

1 Like