How To Use Shelly Modules in Hubitat Elevation or Smart Things

I spent a good part of the afternoon teaming up with Scott Grayban on a fun project that combines products from two of my favorite smart home companies – Shelly Cloud and Hubitat Elevation! (and also Smart Things, if you like them).

Scott and I connected last year when I was looking for help in getting a Zigbee dimming switch working with Smart Things. While the switch didn’t pan out (ZLL – go figure), the connection was far more valuable. I’ve found he has a really interesting perspective on a number of technologies and he “gets it” as well as anybody else when it comes to smart home. Feel free to check out some of his public projects on his repository HERE.

My original plan for today’s blog entry was to learn (and share) how to write your own device driver for Hubitat. A couple of weeks ago, Scott cleaned up and ported a Smart Things device handler for Shelly modules over to Hubitat. The handler worked great on my HE, and that stoked my interest to learn more about custom device handlers, so I wanted to try to make my own.

On getting into it the project, however, my version was too stripped down – it wouldn’t have worked well with either the Hubitat dashboard or with Rule Machine. On a brighter note, Scott has continued to refine his code since the initial port and now has solid device handlers for Hubitat Elevation and Smart Things. This blog will show you how to set up a Shelly 1 module in Hubitat and in Smart Things, from install onward.

Speaking of the install, installing a Shelly module is a five minute job.

Un-box your module.

I like to make jumpers before I even remove the wall plate. Remember, the Shelly module’s terminal is not that deep, you don’t want a lot of exposed copper on that end. I’m using 14 gauge wire here – 12 is too large for the Shelly’s terminals..

The reason this one is marked “D1” is because I like to keep an inventory of all of my devices – I assign a specific IP address, I note where each is installed, and note if I shift one somewhere else. I then install my jumper wires and head out to the garage!

Pop the switch out – the red wire is going to the light, black is hot, neutral is the capped white wire. As usual (especially in this house), the ground is not connected to the green screw on the switch. It takes a few extra seconds, but I try to always do that before I put everything back into the wall.

Now we install the Shelly module. Connect the red wire from the light switch to the O terminal, then connect the red wire from terminal SW to the switch. Black wires are twisted together under a wire nut, white wire to the neutrals with a wire nut. I really need to pick up another pack of Wago connectors. They’re so much nicer than wire nuts and SO much safer!

BTW, I did notice the clear plastic on the insulation of several wires and removed it. I also made sure that the brass side of the switch was pointing up this time.

Installed so fast, my wife didn’t even have a chance to get off the phone with her sister before I buttoned it up!

Next, we open the Shelly Cloud app, create a group named Garage, Add Devices, and add the new light. Once the device setup is complete, tap it in the app, tap Settings, then tap Device Information. Note the IP address. For the Shelly 1/1PM, the channel will be 0. If you’re working with a Shelly 2/2,5, make note of the Channel for each switch you want to work with.

Now, to set up your new module in Hubitat Elevation, open a browser and navigate to your Hubitat’s IP address.

Click Drivers Code, then New Driver.

In a separate tab, navigate to Scott’s Github REPOSITORY (HERE) and click the “Raw” button.

Highlight the entire page’s text, select copy, switch back to the Hubitat Add Driver page, and paste the code there. Click the Save button.

Click the “Hamburger”
in the top left corner of the page to display the menu and select Devices.

Click Add Virtual Device.

Enter a value for Device Name, Device Network ID, and Device Label. I used the amazingly descriptive “Garage Light” for all three. Next, for Type, select “Shelly As Switch” in the User section, then click Save Device.

Important Note:

When setting up a Shelly 2 Module, set up a separate device for each channel.

In this example, Channel 0 should be set up as Garage Light 1. Channel 1 should be set up as Garage Light 2.

Each device MUST have its own distinct Network Device ID, Label, and Name.

This brings up the Garage Light settings page. You’ll want to enter your device’s IP address, the channel for the specific switch (o automatically for Shelly 1 models) and the settings for refresh and logging.

Refresh is where Hubitat polls the device to verify its current status – in this case, off or on. The device handler gives you the option to write description and debugging information to the log.

You now have your Shelly module working in Hubitat. You can add it to a dashboard, use it in Rule Machine, connect it to Alexa though Hubitat – and you can see any change executed in Hubitat automatically and immediately updating the status of the device in Shelly Cloud.

Smart Things requires a few different steps, but it isn’t really any harder.

Navigate to your Smart Things account at and log in.

Click “My Device Handlers” and then “Create New Device Handler”

Click the “From Code” tab and then open a new browser window/tab to navigate to THIS repository (please note, this is the SmartThings version of the device handler).

As before, you’ll click the “Raw” button, select all of the text on the page, and select copy.

Then, paste it into the “From Code” tab in the Smart Things IDE and Save it. Click Publish, “For Me.”

Next, click the”My Devices” tab and then “New Device.” Enter the Name, Label, Network ID, all the same as before. Please note that while you have to enter an initial value here, Smart Things will change the Device Network ID.

In the “type” select, you’ll need to scroll all the way to the bottom for “Shelly as Switch.” Select Version, Location, and Hub as applies for your setup, then click Create.

Important Note:

When setting up a Shelly 2 Module, set up a separate device for each channel.

In this example, Channel 0 should be set up as Garage Light 1. Channel 1 should be set up as Garage Light 2.

Each device MUST have its own distinct Network Device ID, Label, and Name.

Now click “edit” in the Preferences row. Enter your IP Address and the appropriate channel (Shelly 1 modules are always 0, Shelly 2/2.5 are 0 or 1). Click the Save button. Your Shelly switch is now live and available in the Smart Things app!

While Scott isn’t in The Smarter Home Club (or even on Facebook), he’s still accessible. If you’ve got any problems with the device handlers, create an issue and he’ll jump in. I’d also keep an eye on his repositories, as I expect he’ll continue to update these drivers as well as adding others. Based on our conversation this afternoon, Scott feels the same way about Shelly as I do!

Here are links to the products covered in this blog:

Shelly Cloud Products 

Here’s a link to their Amazon page if you’re in the US and want Prime Shipping.

Hubitat Elevation

Samsung Smart Things

Please note that when we provide our Affiliate links to product pages on Amazon, meaning we receive a small portion of the sale proceeds if you order from there. is the website for our Facebook community, The Smarter Home Club – which is an umbrella for all kinds of smart home technologies – home automation, security, custom electronics, weather stations, alternative energy, you name it. DIY focused.

If you’re interested in joining the Smarter Home Club’s Facebook group, please follow this link:

The Smarter Home Club on Facebook