Shelly Binding

Hi,

I started to develop a binding for Shelly products. I have a Shelly1 and a Shelly2. These will be implemented and tested for the time being, the rest of the product family I will implement as well as possible, but can not test. Is there any interest in having the binding published in due course?

I’m only doing it because I wanted to work on programming bindings and I’m not really a fan of MQTT :slight_smile:

You can just contact me and let me know if someone is interested or not.

13 Likes

Just go ahead and publish away. That what the community is for. Share away.
If you share it, there will be people willing to try it.
No sense in developing something and keeping it for yourself.

4 Likes

Hi,

I have some Shelly1’s which I purchased recently and have them setup for bench testing, so connected to a test switch/LED light, so would be happy to test any binding.

I’d be interested to know how you envisage the binding working against say how MQTT works.

Regards

Kevin

I’m very very insterested, at least in Shelly 1 and 2. I’ve got both and I’m willing to add them to OH. If you want, I could test the binding in my OH test system.

I also ordered some Shelly for integration into my openHAB. I thought about using Mqtt at the moment but would like a specific binding as well. If Shelly 1/2 work, I also plan to get a 4 and would like to help you with testing and maybe even programming.

What benefit are you expecting against using MQTT for integration ?
I am already using some Shellys with stock firmware.
MQTT setup was straight forward and the devices work as expected.

1 Like

How do you use it with MQTT? Is there any tutorial? I already own a MQTT server for other uses so I suppose it could be easier for me.

Here is an example of one of my Shelly items

Switch LightCeilingCorridorSF	"Corridor Light" <light>	(gSF_Corridor, Lights)  { mqtt=">[mymqtt:shellies/shelly1-8B18F7/relay/0/command:command:*:MAP(shelly.map)],<[mymqtt:shellies/shelly1-8B18F7/relay/0:state:MAP(shelly.map)]" }

and this is my shelly.map file

ON=on
OFF=off
on=ON
off=OFF

and my mqtt.cfg for mqtt1 Binding, having Mosquitto on the same machine as openHAB

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
mymqtt.url=tcp://localhost:1883

# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a default one is generated.
mymqtt.clientId=openHAB

5 Likes

Thank you very much. Very useful

Is there any progress on this binding, i have a Shelly H&T, not sure how to setup with MQTT.

Config for ShellyHT is straight forward, received mine today and had it running after 2 minutes.

Number ShellyHtTemp     "ShellyHT Temperature" <temperature> { mqtt="<[mymqtt:shellies/shellyht-123456/sensor/temperature:state:default]" }
Number ShellyHtHumidity "ShellyHT Humidity"    <humidity>    { mqtt="<[mymqtt:shellies/shellyht-123456/sensor/humidity:state:default]" }
Number ShellyHtBattery  "ShellyHT Battery"     <battery>     { mqtt="<[mymqtt:shellies/shellyht-123456/sensor/battery:state:default]" }

so you just add that to the items folder?

Yes, if you already have MQTT 1.x Binding running, see my earlier post.
Of course, you need to enable MQTT in the device. Please note, that they will only wake up when a configurable treshold is reached. For most of the time, the device is not reachable trough network.

so i added it to items folder, i think i have MQTT enabled in the device correctly, in paper ui, i see all three in the items list, but under control there is no display for temp humidity or battery.

Of course, MQTT 1.x does not use things, therefore you can‘t see those in PaperUI.

then where are they displayed?

In your Sitemap.
PaperUI is an administrative UI and not meant for controlling openHAB on a regular basis.

ok, thank for all the help.

hmerk, can you give me a bit more guidance. I am not sure what i need in sitemap, the icons are there but it does not display the numbers. the shelly H&T is sending the numbers, i can see them on MQTT.fx.

 Frame label="H&T Temperature"
   {
           Text item=ShellyHtTemp
           Text item=ShellyHtHumidity
           Text item=ShellyHtBattery

   }

I’m not sure of this, but try modifying your items like this:

Number ShellyHtTemp     "ShellyHT Temperature [%d]" <temperature> { mqtt="<[mymqtt:shellies/shellyht-123456/sensor/temperature:state:default]" }

So add [%d] in your label.