Having about 30 switches in the house that will eventually want to make smart, I wanted to just use the native Shelly API rather than flash a whole slew of devices. Being that “Necessity is the mother of invention”, or in this case “integration” I have just completed a Shelly 1 device type for the native Shelly API. This is the first Smartthings device type I have written ever so its not completely robust, but it’s been working for me with some limitations:
- I can’t seem to poll the device any more often than one minute intervals so if you are using the Shelly app to control the relay it may take up to a minute for Smartthings to update status. Maybe using the refresh() method? I tinkered with that but it hasn’t seemed to do what I’ve expected so far. If you only use ST to control the relay the status updates immediately.
- I haven’t figured out how to do device discovery via mDns so all Shelly’s must be added manually. I do this through the Smartthings IDE (Instructions below).
a. Shelly App auto discovered it and from there I was able to get the IP address if the device under device information.
- I am using IPORT to communicate with the Shelly although apparently there is a way to use MAC address. For now I highly recommend creating a static IP reservation in your DHCP server or setting your Shelly devices to a static IP through the web interface (outside of your DHCP range of course). Maybe someone can show me how to do this all by MAC and then this wont be an issue.
- I only have Shell 1 devices so it operates on /relay/0 only.
Instructions:
Adding the Device Handler:
- Log into Smartthings IDE with your account.
- Ensure that you have selected your correct location and hub.
- Navigate to My Device Handlers.
- Click Create New Device Handler.
- Select From Code.
- Paste the code from below and click Create.
Device type code is here:
https://github.com/patrickkpowell/SmartThingsPublic/blob/master/devicetypes/patrickkpowell/Shelly/shelly-1.groovy 11
- Select Publish -> For Me.
Adding a Shelly Device:
- In the Smartthings IDE navigate to My Devices.
- Click on New Device.
- Fill out required fields. For the name use something descriptive as this is how it will show up in your ST App. For Network Device ID just use something unique.
- For Device Type select Shelly1. (Should be towards the bottom)
- Select correct Location/Hub. (There should only be one item to select for most people)
- Click Create.
- On the next screen you will need to click the edit link next to the Preferences entry in the table.
*Important: Not the Edit Button at the bottom of the page.
- Enter the IP address of the Shelly where it asks for it and click Save.
You should now see your shelly in your device list and it shows up in the ST app basically anywhere a smart switch will show up as far as I can tell.
Unfortunately I don’t have a-lot of time to devote to these kinds of things so if anyone would like to run with this code… by all means please do @shelly.cloud
. I hope this helps others out there who are not fond of flashing 30 devices! Enjoy!