Edge Shelly drivers for Gen1 and Gen2 Devices

I’ve tried in the past to get this working with the SmartThings energy dashboard, but that feature is only supporting Samsung appliance devices.

All - I’ve pushed out an update to the GEN1 Shelly Driver.

As some have reported (@Diegocampy), it can occasionally happen that the Shelly device goes offline for whatever reason and/or loses its configuration that tells it to keep the Edge driver updated with state changes.

This update implements a check every 30 minutes to make sure the Shelly device is (a) still responding and (b) is still configured to send state change updates to the Edge driver. If either are not true, then the device will be reinitialized if possible. If it is still not answering, the driver will re-attempt to initialize the device every 10 minutes.

I hope this addresses some of these cases where devices stop working. It may not fix everything; for example if there is a problem with the driver itself that takes a hub reboot, then that’s a different problem.

This update will be made automatically to your hubs. No action is needed, other than to let me know if you run in to any issues, or things seem to be a bit more reliable over the long term.


Updated Driver Version: 2023-01-09T22:58:30.991090192

2 Likes

Interesting, I’ll keep an eye on how it performs.
I’m a little dubious about trying to reconnect every 10 minutes if something is wrong. In case as you say, it’s the hub to reboot that’s the problem, the drive will retry every 10 minutes indefinitely. I still remember that I’m not a programmer, so forgive me if I say nonsense: it would be possible to set a notification if not immediately, maybe after a couple of attempts. (even immediately if it were easier to manage the notification, and btw when I say notification I mean anything that can warn me if there are other possibilities)

I hear you. The problem is that we really don’t know the cause of your specific issue without logs.

As far as notifications, Edge drivers don’t have any access to do that; it requires an automation or SmartApp. I have contemplated two options: 1) setting the device to an ‘offline’ status when it can’t reach the device, or 2) adding a status field to the device that would show any issues.

#1 is easy to do, but problematic because once you set a device to offline, you can no longer use any of the controls. I don’t love that because even if the device is no longer updating SmartThings, you might be able to still control it. If offline, you wouldn’t even be able to try the refresh button.

#2 is probably the best way to go, but is a LOT of work to go back and change 20 device profiles. But it can, and probably should, be done.

1 Like

I can survive without it, but if you can it would be appreciated :sweat_smile:

NEW DRIVER AVAILABLE FOR GEN1 BATTERY POWER DEVICES

It has become clear that the majority of the Shelly devices that are battery powered do not stay awake to listen to wifi. Therefore the devices cannot be asynchronously awoken with HTTP commands or initialization requests. As such, my Gen1 driver, which uses HTTP, is not suitable for supporting them.

The exceptions to this rule are the Motion sensors (both original and Motion 2), which, although are battery powered, DO stay awake on the network and work fine with my existing driver.


** EDIT:** This may no longer be the case; please let me know if you use the motion devices and what your experience is. I will be adding support for motion devices to this driver.


Instead of using HTTP to communicate with the ‘sleepy’ battery powered devices, a more suitable approach is to use MQTT. And so I have developed a new driver that supports the Flood, Smoke, Button, Humidity&Temp, and Door&Window devices using MQTT.

10/18/23 EDIT: Now also supports Shelly Motion 1 and Motion 2 devices.

This requires an MQTT broker running on your network, which I know is not feasible for many of you, but unfortunately it is really the only way to integrate these devices.

The new driver is called Shelly Gen1 MQTT V1 and is now available on my test channel. I hope to get it moved to my regular shared channel soon, but want a couple weeks of user testing first. I also haven’t created a github repository for this yet.

If anyone is in a position to test these, I look forward to your feedback.


Instructions for Use
First, you will have to use the Shelly app to enable MQTT for the devices you want to integrate. This is done in the device settings menus.

All shelly devices publish their messages on an MQTT topic that begins with ‘shellies/’, therefore if you want to test to confirm your device is publishing updates to MQTT, you can subscribe to that top-level topic using a command like this (if using Mosquitto):

mosquitto_sub -v -h <ip address of broker or 'localhost' if on same computer> -t "shellies/#" -u <userid> -P <password>

Omit the userid & password parameters if not needed.

Once the Edge driver is available on your hub, do an Add device / Scan for nearby devices and a device called ‘Shelly MQTT Master’ will be created, and you will need to go into device settings and configure your broker information. Back on the Controls screen, you should see a status of “Connected to Broker”. Once you complete this, you can start onboarding your devices.

Since these battery-powered devices have to be woken up during discovery, you will physically have to go to the device and press its ‘wake’ button, but first initiate an Add device / Scan for nearby devices in the SmartThings app. Then press the button on the device. The supported devices listed above will be discovered and added as new devices.

That’s really all there is to it. There are no commands to be issued to these devices, only display of state data on the SmartThings device Controls screen, which is sent out by the device whenever it chooses to wake up. Of course all device states are available for automation routines.

1 Like

Hi,
there have probably already been changes on the side of smartthings and actiontiles, but the result is that no components from the UNI shell were loaded, only “main”, which means I lost the display of temperature and humidity in actiontiles. I will try to contact actiontiles about what the problem is. if actiontiles couldn’t solve it, could the sensors be moved as you wrote earlier?

It is possible to do, yes.

Please try to get a definitive answer from ActionTiles as to when they are going to fix their application to fully support SmartThings devices. There’s no sense going back and forth with them about one particular component or capability.

I’m still not enthusiastic about designing device profiles to account for ActionTile’s shortcomings.

1 Like

I write it here @TAustin To give feedback :I had to unplug 1 Shelly 1pm for a few days, to redo some wiring. The Shelly app obviously recognized it as offline, from SmartThings obviously not. I don’t know if he tried reconnecting all these days, but now that I reconnected it, it immediately didn’t work, but after 10 minutes it was back to work. Without having to restart the Hub. Great :+1:

1 Like

Hello @TAustin,

I already installed GEN2 Driver, and found some devices that I have at home.

The one that I really wanted still don’t, that is Shelly I4. Because this one don’t appear on Smartthings with Shelly integration.

When I try to add manually from “Shelly Gen2 Device Creator”, it stays loading and loading, but don’t add it.

I have already CLI ready to test it and help you. :slight_smile:

Do you know when it can be available?

Thank you.

I’ll try to get that done within a week. Thanks for volunteering to test!

2 Likes

@TAustin
Whenever I search the platform and find something cool, I always find that you’ve done it

3 Likes

DRIVER UPDATE NOTICE

I have added two more GEN2 devices to the Shelly Gen2 Device Driver:

I’m unable to test these myself, so as always, I rely on community members to report back their results. CLI logs are appreciated. THANK YOU!


Updated Driver Version: 2023-01-18T02:04:34.882529641

3 Likes

You are the men @TAustin :wink:

When I get home I will test it and give some feedback.

Thank you a lot.

after a long time I got a reply from actiontiles. the answer is: they have only migrated “main” so far, if there are any other components, they will not work. according to the statement, they don’t even know when or if it will be supported at all, the new platform is completely different and I have the feeling that more things don’t work there. when I read various discussions, there are a lot of problems after the migration, but it is uncertain whether they will be able to solve some of them.

that’s why I would like to ask you if you could convert the controller to UNI shells, at least so that there is a switch, sensor 1 and ADCS (relay1, temperature, humidity, volatge) in the main, otherwise it is not such a priority for me. other components can be used in automation, but it would be good to be able to display these things in one place.

and one more design change comes to my mind, so that it would be possible (since it is a universal device) in smarthings to choose how to display me (switch, temperature, humidity, volatage) and accordingly the device would be displayed in smarthings with the value of the selected sensor.

you have this functionality in one of your drivers - MQTT device creator

thank you very much for your willingness

OK you wore me down :slight_smile: . I’ve updated the Uni device to move those elements to the main component. Please test and let me know if everything is working ok.

I don’t know the status of ActionTile’s ability to support custom capabilities, so its possible it may not recognize the Input field. There’s not much I can do about that.

Also - a warning to anyone who might ask: The GEN2 devices will not work with ActionTiles since they are designed to use multiple components and I will not change this.


Updated Driver Version: 2023-01-18T17:54:06.061133365

1 Like

I know I’m pushy) so I tried it and the voltage is in main and is displayed in actiontiles fine. could the temperature and humidity of sensor 1 also be given there?


Temperature and humidity for the first sensor should already be showing in main in the device Controls screen.

You may need to create a new Uni device.

Hi @TAustin,

I tested Shelly Gen2 Device Driver - Shelly Plus I4, but is not working for now.

I sent you 3 messages for different tests:

  • Logs from Shelly Gen2 Device Driver, when I press physically the 4 buttons
  • Logs from Shelly Gen2 Device Driver, with one automation created on button 1
  • Logs from Shelly Gen2 Device Driver, removing shelly I4 and add again manually.

Graphically on Smartthings when I press a button of Shelly I4 nothing happen. But on Shelly app with this device is the same thing, so that is not a real problem.

But on logs you see that information is being recorded.

Using the device in automations also don’t do nothing.

Because I have 2 Shelly I4, and only one was automatically added, I added the other one manually, and I add also the IP address, but the device don’t update the network info.

Everytime I open the device on Smartthings, on both, this info message appears all the time:
This device is not yet updated with all status information. Please check again later.