Introducing ShellyMQTT!

Posted on
Thu Mar 05, 2020 9:03 pm
aaronlionsheep offline
Posts: 61
Joined: Feb 24, 2019
Location: Virginia, USA

Introducing ShellyMQTT!

Hello ShellyMQTT!(aka: my first public plugin :mrgreen: )

This plugin focuses on adding simple control over Shelly devices in Indigo using the MQTT protocol. The plugin makes use of FlyingDiver's MQTT Connector (http://www.indigodomo.com/pluginstore/211/) that he designed to be used by other plugins. You can think of this as a "Shims" plugin that is designed specifically for Shelly devices. The use of MQTT allows for fast bi-directional communication between the individual devices and Indigo.

There is a 1-to-1 (with one exception) relationship between the physical Shelly device and the Indigo device that represents it. Each Shelly model is defined in the plugin, so you simply create a new Indigo device with the same device type as your model. No complex configuration is required since all the fine details are handled by the plugin. The only thing you need to do is determine if you want your temperatures shown in Fahrenheit or Celsius! (I won't say which one is right...)

Here are some sneak previews of the capabilities of the plugin:

Screen Shot 2020-03-05 at 9.28.42 PM.png
Overview of Shelly 1PM
Screen Shot 2020-03-05 at 9.28.42 PM.png (128.62 KiB) Viewed 808 times

Screen Shot 2020-03-05 at 9.31.07 PM.png
Overview of Shelly Dimmer/SL
Screen Shot 2020-03-05 at 9.31.07 PM.png (127.79 KiB) Viewed 808 times

Screen Shot 2020-03-05 at 9.31.25 PM.png
Overview of Shelly H&T
Screen Shot 2020-03-05 at 9.31.25 PM.png (113.01 KiB) Viewed 808 times


Some things that are currently implemented (and ready for beta testing):
    - Support for Shelly 1, Shelly 1PM, Shelly 2.5, Shelly Dimmer/SL, Shelly Door/Window, Shelly H&T, and Shelly Flood
    - Power and energy tracking with native Indigo UI (for capable devices)
    - Battery monitoring with native Indigo UI (for battery-powered devices)
    - Quick setup and configuration (a single trigger is all that was required to setup all the devices shown above)

Some things that are in the works and being tested:
    - Support for the Shelly Duo
    - Support for temperature sensor add-ons to Shelly 1 and Shelly 1PM devices
    - Auto-discovery of Shelly devices
    - Updating a Shelly device from within Indigo
    - Tracking when devices come and go online/offline (LWT)

Before the initial release, I would like to ask for any suggestions or feedback that you all might have. I am still working on documentation and creating guides for scenarios that I think will be common with these devices. If anyone is interested in testing the beta version of the plugin, then please let me know. If all goes well then I am aiming for a public release sometime next week.

Posted on
Thu Mar 05, 2020 10:12 pm
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: Introducing ShellyMQTT!

NICE work.

Karl

Posted on
Thu Mar 05, 2020 10:16 pm
aaronlionsheep offline
Posts: 61
Joined: Feb 24, 2019
Location: Virginia, USA

Re: Introducing ShellyMQTT!

kw123 wrote:
NICE work.

Karl


Thank you! It seems we both had the same idea :D

Posted on
Fri Mar 06, 2020 9:04 am
jay (support) offline
Site Admin
User avatar
Posts: 16214
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Introducing ShellyMQTT!

Fantastic job! Thanks for the contribution.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Mar 06, 2020 1:45 pm
CliveS offline
Posts: 491
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Introducing ShellyMQTT!

ShellyMQTT is so easy to setup and the Wiki is so well documented even I could get it working and I am MQTT illiterate!

This plugin makes buying Shelly devices a no brainer especially if you have a place where you don't get a reliable z-wave signal but have wi-fi or cat5 and they are so much cheaper than z-wave devices.

I have a detached garage that suffers with "no-ack" problems from a plug that monitors the freezer and also open/close the garage doors with Qubino dry switches but I do have excellent wi-fi via a couple of ubiquiti NanoStation 5AC loco's that stream a couple of Dahua cameras to the house.

Now I can control the doors with Shelly 1's, and monitor the freezer with a Shelly 1PM and also check the temp with the 1PM temperature add-on.

I did a mock up in the garage this afternoon over the wi-fi and it worked with no problems.

Aaron has done a great job on this, I just feel sorry for him as Shelly has just announced a load more devices for him to include :)

Code: Select all
1. Shelly GAS sensor - organic gases detector, made together with Heimann: ETA: April
2. Shelly Dimmer SL: ETA April
3. Shelly Battery powered Button - ETA: End of April
4. Shelly I3 - ETA: April
5. Shelly Spot Duo - G10 - ETA April/May
6. Shelly Spot RGB - G10 - Eta May/June
7. Code name; Shelly Party pooper :D No ETA
8. Shelly Smoke 2 - ETA May/June (certificaiton is slow)
And 15 more  devices :) most of them will be realised in next 4 months from April to July, but I can't share any details yet.


Shellies work out of the box with local MQTT so no going off to a Chinese server, it works on your network and stays on your network.

Details for Shelly can be found at https://shelly.cloud

CliveS

Indigo 7.4.1 : MacOS Catalina 10.15.1 : Mac mini Server (Mid 2011) : 2 GHz Core i7. : 8 GB. : 2 x 256GB Samsung EVO SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Fri Mar 06, 2020 3:11 pm
aaronlionsheep offline
Posts: 61
Joined: Feb 24, 2019
Location: Virginia, USA

Re: Introducing ShellyMQTT!

CliveS wrote:
ShellyMQTT is so easy to setup and the Wiki is so well documented even I could get it working and I am MQTT illiterate!

This plugin makes buying Shelly devices a no brainer especially if you have a place where you don't get a reliable z-wave signal but have wi-fi or cat5 and they are so much cheaper than z-wave devices.

I have a detached garage that suffers with "no-ack" problems from a plug that monitors the freezer and also open/close the garage doors with Qubino dry switches but I do have excellent wi-fi via a couple of ubiquiti NanoStation 5AC loco's that stream a couple of Dahua cameras to the house.

Now I can control the doors with Shelly 1's, and monitor the freezer with a Shelly 1PM and also check the temp with the 1PM temperature add-on.

I did a mock up in the garage this afternoon over the wi-fi and it worked with no problems.

Aaron has done a great job on this, I just feel sorry for him as Shelly has just announced a load more devices for him to include :)

Code: Select all
1. Shelly GAS sensor - organic gases detector, made together with Heimann: ETA: April
2. Shelly Dimmer SL: ETA April
3. Shelly Battery powered Button - ETA: End of April
4. Shelly I3 - ETA: April
5. Shelly Spot Duo - G10 - ETA April/May
6. Shelly Spot RGB - G10 - Eta May/June
7. Code name; Shelly Party pooper :D No ETA
8. Shelly Smoke 2 - ETA May/June (certificaiton is slow)
And 15 more  devices :) most of them will be realised in next 4 months from April to July, but I can't share any details yet.


Shellies work out of the box with local MQTT so no going off to a Chinese server, it works on your network and stays on your network.

Details for Shelly can be found at https://shelly.cloud


Thanks for the compliment (and thanks for testing)! Do you know how I can get some more information about those devices? I've done some searching around and I can't seem to find an announcement anywhere. If you have secret ties to Shelly, then can you get me the MQTT API for the Shelly Duo? It appears to be missing from the API docs :roll:

Maybe one of those secret devices will be a UL Listed Shelly Plug with a US-style plug, that would be nice...

Posted on
Fri Mar 06, 2020 6:56 pm
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: Introducing ShellyMQTT!

try:
curl ip#/settings
Code: Select all
{"device":{"type":"SHBLB-1","mac":"68C6xxx3","hostname":"shellybulb-BC84C3","num_outputs":1},"wifi_ap":{"enabled":false,"ssid":"shellybulb-BC84C3","key":""},"wifi_sta":{"enabled":true,"ssid":"xxxx","ipv4_method":"static","ip":"192.168xxx","gw":"192.1xxx","mask":"255.255.255.0","dns":null},"wifi_sta1":{"enabled":false,"ssid":null,"ipv4_method":"dhcp","ip":null,"gw":null,"mask":null,"dns":null},"mqtt": {"enable":false,"server":"192.168.33.3:1883","user":"","id":"shellybulb-BC84C3","reconnect_timeout_max":60.000000,"reconnect_timeout_min":2.000000,"clean_session":true,"keep_alive":60,"max_qos":0,"retain":false,"update_period":30},"sntp": {"server":"time.google.com"},"login":{"enabled":false,"unprotected":false,"username":"admin","password":"admin"},"pin_code":"","name":"","fw":"20191216-090015/v1.5.7@c30657ba","build_info":{"build_id":"20191216-090015/v1.5.7@c30657ba","build_timestamp":"2019-12-16T09:00:15Z","build_version":"1.0"},"cloud":{"enabled":false,"connected":false},"timezone":"America/Chicago","lat":32.948299,"lng":-96.729897,"tzautodetect":true,"time":"18:53","hwinfo": {"hw_revision":"prod-1.3","batch_id":1},"mode":"color","lights":[{"ison":true,"red":1,"green":1,"blue":1,"white":255,"gain":100,"temp":5065,"brightness":87,"effect":5,"default_state":"on","auto_on":0.00,"auto_off":0.00,"power":0.00,"schedule":false,"schedule_rules":[]}]}mini-18:53:09

curl ip#/status
Code: Select all
{"wifi_sta":{"connected":true,"ssid":"xxxx","ip":"192.1xxxxxxx","rssi":-68},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"18:54","serial":1,"has_update":false,"mac":"68C6xxxxC3","lights":[{"ison":true,"mode":"color","red":1,"green":1,"blue":1,"white":255,"gain":100,"temp":5065,"brightness":87,"effect":5}],"meters":[{"power":0.00,"is_valid":"true"}],"update":{"status":"idle","has_update":false,"new_version":"20191216-090015/v1.5.7@c30657ba","old_version":"20191216-090015/v1.5.7@c30657ba"},"ram_total":51048,"ram_free":40828,"fs_size":233681,"fs_free":170680,"uptime":24888}
returned for a RGBlight bulb
that should give you info on the json returned

Karl

Posted on
Sat Mar 07, 2020 7:36 pm
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: Introducing ShellyMQTT!

for the duo light bulb:

devtype = SHBDUO-1

The http actions look like this:

curl http://ip#/?status see posting above
curl http://ip#/?settings see posting above
curl http://ip#/?brightness=xx 0..100
curl http://ip#/?white=xx 0..100 for color temp; setting temperature level (temp) does not seem to work, looks read only, and the min max temp are2700 .. 6500

so you need to map;
white =int( max(0, min(100,100*(tempLevel-2700)/6500-2700))))


and on the way back map into indigo dev states :
brightness --> brightness (0-100)
temp --> temperatureLevel 2700 ..6500

in dev properties: indigo dev type = dimmer; you need to set:
Code: Select all
         <Field id="SupportsColor"                    type="checkbox" defaultValue="true" hidden ="false"><Label>SupportsColor</Label></Field>
         <Field id="SupportsRGB"                    type="checkbox" defaultValue="false" hidden ="false"><Label>SupportsRGB</Label></Field>
         <Field id="SupportsWhite"                    type="checkbox" defaultValue="true"  hidden ="false"><Label>SupportsWhite</Label></Field>
         <Field id="SupportsWhiteTemperature"           type="checkbox" defaultValue="true"  hidden ="false"><Label>SupportsWhiteTemperature</Label></Field>
hope that helps

will post my version tomorrow

Karl

the controls then look like:
Screen Shot 2020-03-07 at 19.34.10.png
Screen Shot 2020-03-07 at 19.34.10.png (41.58 KiB) Viewed 515 times

Posted on
Sat Mar 07, 2020 7:51 pm
aaronlionsheep offline
Posts: 61
Joined: Feb 24, 2019
Location: Virginia, USA

Re: Introducing ShellyMQTT!

kw123 wrote:
for the duo light bulb:

devtype = SHBDUO-1

The http actions look like this:

curl http://ip#/?status see posting above
curl http://ip#/?settings see posting above
curl http://ip#/?brightness=xx 0..100
curl http://ip#/?white=xx 0..100 for color temp; setting temperature level (temp) does not seem to work, looks read only, and the min max temp are2700 .. 6500

so you need to map;
white =int( max(0, min(100,100*(tempLevel-2700)/6500-2700))))


and on the way back map into indigo dev states :
brightness --> brightness (0-100)
temp --> temperatureLevel 2700 ..6500

in dev properties: indigo dev type = dimmer; you need to set:
Code: Select all
         <Field id="SupportsColor"                    type="checkbox" defaultValue="true" hidden ="false"><Label>SupportsColor</Label></Field>
         <Field id="SupportsRGB"                    type="checkbox" defaultValue="false" hidden ="false"><Label>SupportsRGB</Label></Field>
         <Field id="SupportsWhite"                    type="checkbox" defaultValue="true"  hidden ="false"><Label>SupportsWhite</Label></Field>
         <Field id="SupportsWhiteTemperature"           type="checkbox" defaultValue="true"  hidden ="false"><Label>SupportsWhiteTemperature</Label></Field>
hope that helps

will post my version tomorrow

Karl

the controls then look like:
Screen Shot 2020-03-07 at 19.34.10.png


Karl, thanks for the info! Clive has informed me that the temperature control is broken in the current firmware of the Shelly Duo. I guess we need to wait for a new firmware before we can control that from the public API's. I'm using MQTT, so I can confirm that controls are broken in both HTTP and MQTT protocols.

I did in fact get that Indigo UI figured out, but why do you need to manipulate that white value? It appears that the API accepts a white value between 0 and 100, and the Indigo UI produces a white slider that also ranges from 0 to 100. The Shelly Duo web interface only has brightness and temperature control, no explicit white control. Is this white slider just something we are stuck with in order to get the temperature slider in the Indigo UI? For now, I just have my Duo device limited to sending control data for on/off and brightness. When the new firmware comes out I will add the temperature field back into my command payload.

FYI, I plan on giving access to my repo tomorrow with my latest beta (0.0.4). I did a lot of testing today and am satisfied with the results. I now have auto-discovery (not as extensive as yours though), firmware update detection, the ability to update firmware from Indigo, and support for the add-on temperature sensors for the Shelly 1/1PM.

Posted on
Sat Mar 07, 2020 8:20 pm
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: Introducing ShellyMQTT!

it seems that you need whiteLevel to get a slider for brightness if you have color on and want color temp control

the mapping whit 0-100 to 2700k-6500k seems to wok fine


Karl
and here the cleanup version:
Attachments
Screen Shot 2020-03-07 at 20.26.29.png
Screen Shot 2020-03-07 at 20.26.29.png (38.05 KiB) Viewed 495 times
Last edited by kw123 on Sat Mar 07, 2020 8:27 pm, edited 1 time in total.

Posted on
Sat Mar 07, 2020 8:26 pm
aaronlionsheep offline
Posts: 61
Joined: Feb 24, 2019
Location: Virginia, USA

Re: Introducing ShellyMQTT!

kw123 wrote:
it seems that you need whiteLevel to get a slider for brightness if you have color on and want color temp control

the mapping whit 0-100 to 2700k-6500k seems to wok fine


Karl


Yeah I haven't found a way to remove the white slider and keep the temperature slider. Maybe once the updated firmware is release for the Duo, then we will see what setting the white value does. It would be nice to get a brightness slider instead of the white slider if setting the white value has no effect.

I used the following for my device to set the min and max for the temperature slider. Not sure if you missed this setting, or if you left it out of the post.
Code: Select all
            <Field type="checkbox" id="SupportsColor" hidden="true" defaultValue="true" />
            <Field type="checkbox" id="SupportsWhite" hidden="true" defaultValue="true" />
            <Field type="checkbox" id="SupportsWhiteTemperature" hidden="true" defaultValue="true" />
            <Field type="textfield" id="WhiteTemperatureMin" hidden="true" defaultValue="2700" />
            <Field type="textfield" id="WhiteTemperatureMax" hidden="true" defaultValue="6500" />

Posted on
Sat Mar 07, 2020 10:05 pm
kw123 offline
User avatar
Posts: 7038
Joined: May 12, 2013
Location: Dallas, TX

Re: Introducing ShellyMQTT!

I use an internal dict to manage these.. would be nice if indigo could add that to the default slider

<Field type="textfield" id="WhiteTemperatureMin" hidden="true" defaultValue="2700" />
<Field type="textfield" id="WhiteTemperatureMax" hidden="true" defaultValue="6500" />

karl

Posted on
Thu Mar 12, 2020 6:06 pm
Colly offline
Posts: 340
Joined: Jan 16, 2016
Location: Ireland

Re: Introducing ShellyMQTT!

Just tried your new plugin with a Shelly 1PM, works great, well done!
Can you add the Shelly EM device? I've it running via FlyingDivers plugin in any case so just interested to give it a go with your plugin also.
Colly

Posted on
Thu Mar 12, 2020 8:48 pm
aaronlionsheep offline
Posts: 61
Joined: Feb 24, 2019
Location: Virginia, USA

Re: Introducing ShellyMQTT!

Colly wrote:
Just tried your new plugin with a Shelly 1PM, works great, well done!
Can you add the Shelly EM device? I've it running via FlyingDivers plugin in any case so just interested to give it a go with your plugin also.
Colly


I'm glad to hear you got it working! Do you mind sharing which devices you have and would be willing to use with my plugin (even temporarily)? I don't have access to some devices due to certifications, shipping limitations, and outlet compatibility, so I am unable to personally verify some devices at this time. I will definitely add the Shelly EM to my list if you can verify that it works :mrgreen:

I am in the process of testing beta 0.0.6 (hoping to release tomorrow if all goes well) which adds some new features that were supported/fixed in the Shelly 1.6 firmware update that was released on Monday. I would expect to add support for the Shelly EM in beta 0.0.7 as well as any new devices you might have.

Thanks,
Aaron

Posted on
Fri Mar 13, 2020 3:01 pm
Colly offline
Posts: 340
Joined: Jan 16, 2016
Location: Ireland

Re: Introducing ShellyMQTT!

aaronlionsheep wrote:
I will definitely add the Shelly EM to my list if you can verify that it works :mrgreen:

Hi Aaron,
Happy to test to the best of my ability!

Who is online

Users browsing this forum: No registered users and 1 guest

cron