Shelly binding - define things via things file?


I’d like to manually create the things for the Shelly binding (because the Duo Bulb in its binding code converts the color temperature to percent (0…100 instead of 2700…6500) which I highly dislike. I want a slider that goes from 2700 to 5500. Actually creating an item from the thing via UI creates a slider with min=2700 and max=6500 which does not work, I had to overrule it with min=0 and max=100).

So I’d like to create the thing manually and do ingoing/outgoing transformations on the channel. Unfortunately it does not work right now, when I use this things file:

Thing shelly:shellybulbduo:gang "Gang" @ "Vorzimmer" [deviceIp=""] {
        Type dimmer : Helligkeit "Helligkeit" [stateTopic="white#brightness", commandTopic="white#brightness"]

openhab.log says

2021-01-15 16:02:24.930 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'shelly.things'2021-01-15 16:02:24.953 [ERROR] [.thing.internal.GenericThingProvider] - Channel type shelly:dimmer could not be resolved.

anyone has done this before and got a working example?

I doubt you will be able to define the Channels in the thing configuration if you are using the Shelly binding (ie. the binding defines the channels).

As an alternative, you could configure MQTT which will allow you to define the channels.

1 Like

Any binding will support defining the Things in .things files. However, few binding authors will generate docs to explain how to do it. So one usually needs to do some looking at an example discovered Thing in the JSONDB to figure out the parameters.

Manually defining the Things in .things files is not going to change the behavior of the binding. If it’s using 0-100 for that when the Thing is automatically discovered, defining the Thing in a .things file isn’t going to change that. You can’t just apply a transformation or change the data if the binding doesn’t support it. And if the binding supported it, you’d be able to configure that in the UI on the automatically discovered Thing.

Have you filed an issue?

Thanks a lot for the explanation, that helped a lot!
Altough I’ve by now flashed all my bulbs to Tasmota (due to the features and the nicer MQTT message structure), I will file an issue :slight_smile:

indeed, I’d need to create a transformation due to the state topic looking way different than the command topic. Anyhow, as posted above, I flashed Tasmota which is easier for me to handle anyway.

thanks again