Edge Shelly drivers for Gen1 and Gen2 Devices

New update has been pushed. This should hopefully make reporting of the device status more accurate. I’ve also increased communication timeouts to mitigate failures with battery-powered devices, which can take longer to respond.

Confirm this driver version before you retest:

2022-01-21T17:46:16.355395

1 Like

@TAustin
My shelly one is working perfectly !!!
Thanks
I have a suggestion for you , there is also tasmota device (firmware), that can be done in same way as shelly (i think )
There are accesible thru the ip add !
In case that you have time to spend.

2 Likes

That’s great to hear! The one connected to your doorbell is working right now as well?

I’ll have to check out the tasmota devices…

1 Like

Yes , did’nt see any issue since last update !

1 Like

My shelly 1 seems to work as intended. Attach are logs when the IP address was changed and 1 set on on-offs using the dumb switch at the end.

2022-01-21T18:49:13.169822877+00:00 TRACE Shelly Device Driver V1 Received event with handler device_lifecycle
2022-01-21T18:49:13.175919793+00:00 INFO Shelly Device Driver V1 <Device: 67ed4bc7-fe39-4a6b-942d-3412c6c36d69 (Shelly R1 1)> received lifecycle event: infoChanged
2022-01-21T18:49:13.189833752+00:00 TRACE Shelly Device Driver V1 Found DeviceLifecycleDispatcher handler in thisDriver
2022-01-21T18:49:13.192945252+00:00 DEBUG Shelly Device Driver V1 Info changed handler invoked
2022-01-21T18:49:13.195881335+00:00 INFO Shelly Device Driver V1 Device address changed to: 192.168.1.140
2022-01-21T18:49:13.199463168+00:00 PRINT Shelly Device Driver V1 Sending HTTP request: http://192.168.1.140/status
2022-01-21T18:49:13.326271085+00:00 PRINT Shelly Device Driver V1 response=> {“wifi_sta”:{“connected”:true,“ssid”:“K21E8”,“ip”:“192.168.1.140”,“rssi”:-57},“cloud”:{“enabled”:true,“connected”:false},“mqtt”:{“connected”:false},“time”:“13:49”,“unixtime”:1642790953,“serial”:92,“has_update”:false,“mac”:“8CAAB5C51A51”,“cfg_changed_cnt”:20,“actions_stats”:{“skipped”:0},“relays”:[{“ison”:false,“has_timer”:false,“timer_started”:0,“timer_duration”:0,“timer_remaining”:0,“source”:“http”}],“meters”:[{“power”:0.00,“is_valid”:true}],“inputs”:[{“input”:0,“event”:"",“event_cnt”:0}],“ext_sensors”:{},“ext_temperature”:{},“ext_humidity”:{},“update”:{“status”:“unknown”,“has_update”:false,“new_version”:"",“old_version”:“20211109-124958/v1.11.7-g682a0db”},“ram_total”:50880,“ram_free”:38496,“fs_size”:233681,“fs_free”:149094,“uptime”:52558}
2022-01-21T18:49:13.332299793+00:00 INFO Shelly Device Driver V1 <Device: 67ed4bc7-fe39-4a6b-942d-3412c6c36d69 (Shelly R1 1)> emitting event: {“capability_id”:“signalStrength”,“component_id”:“main”,“state”:{“value”:-57},“attribute_id”:“rssi”}
2022-01-21T18:49:13.342846585+00:00 INFO Shelly Device Driver V1 <Device: 67ed4bc7-fe39-4a6b-942d-3412c6c36d69 (Shelly R1 1)> emitting event: {“capability_id”:“switch”,“component_id”:“main”,“state”:{“value”:“off”},“attribute_id”:“switch”}
2022-01-21T18:49:13.353898502+00:00 INFO Shelly Device Driver V1 <Device: 67ed4bc7-fe39-4a6b-942d-3412c6c36d69 (Shelly R1 1)> emitting event: {“capability_id”:“contactSensor”,“component_id”:“main”,“state”:{“value”:“open”},“attribute_id”:“contact”}
2022-01-21T18:49:13.367021460+00:00 PRINT Shelly Device Driver V1 Sending HTTP request: http://192.168.1.140/settings/actions?index=0&name=out_on_url&enabled=true&urls[]=http://192.168.1.154:36847/67ed4bc7-fe39-4a6b-942d-3412c6c36d69/relay/0/on
2022-01-21T18:49:13.589974085+00:00 PRINT Shelly Device Driver V1 response=> {“actions”:{“out_on_url”:[{“index”:0,“urls”:[“http://192.168.1.154:36847/67ed4bc7-fe39-4a6b-942d-3412c6c36d69/relay/0/on"],"enabled”:true}]}}
2022-01-21T18:49:13.593626418+00:00 PRINT Shelly Device Driver V1 Sending HTTP request: http://192.168.1.140/settings/actions?index=0&name=out_off_url&enabled=true&urls[]=http://192.168.1.154:36847/67ed4bc7-fe39-4a6b-942d-3412c6c36d69/relay/0/off
2022-01-21T18:49:13.739601293+00:00 PRINT Shelly Device Driver V1 response=> {“actions”:{“out_off_url”:[{“index”:0,“urls”:[“http://192.168.1.154:36847/67ed4bc7-fe39-4a6b-942d-3412c6c36d69/relay/0/off"],"enabled”:true}]}}
2022-01-21T18:49:13.745179043+00:00 INFO Shelly Device Driver V1 Device actions successfully configured for Shelly R1 1
2022-01-21T18:49:13.751784126+00:00 DEBUG Shelly Device Driver V1 Shelly R1 1 device thread event handled
2022-01-21T18:50:18.333144569+00:00 TRACE Shelly Device Driver V1 Received event with handler server
2022-01-21T18:50:18.345066153+00:00 DEBUG Shelly Device Driver V1 Accepted connection from 192.168.1.140:7816
2022-01-21T18:50:18.348480278+00:00 PRINT Shelly Device Driver V1 Firstline: GET /67ed4bc7-fe39-4a6b-942d-3412c6c36d69/relay/0/on HTTP/1.1
2022-01-21T18:50:18.352180528+00:00 PRINT Shelly Device Driver V1 Headerline: Host: 192.168.1.154:36847
2022-01-21T18:50:18.355562111+00:00 PRINT Shelly Device Driver V1 Headerline: Content-Length: 0
2022-01-21T18:50:18.358992694+00:00 PRINT Shelly Device Driver V1 Headerline: User-Agent: Shelly/20211109-124958/v1.11.7-g682a0db (SHSW-1)
2022-01-21T18:50:18.368360903+00:00 INFO Shelly Device Driver V1 Message for Shelly R1 1: endpoint=/67ed4bc7-fe39-4a6b-942d-3412c6c36d69/relay/0/on
2022-01-21T18:50:18.373779403+00:00 INFO Shelly Device Driver V1 <Device: 67ed4bc7-fe39-4a6b-942d-3412c6c36d69 (Shelly R1 1)> emitting event: {“capability_id”:“contactSensor”,“component_id”:“main”,“state”:{“value”:“closed”},“attribute_id”:“contact”}
2022-01-21T18:50:18.390311736+00:00 INFO Shelly Device Driver V1 <Device: 67ed4bc7-fe39-4a6b-942d-3412c6c36d69 (Shelly R1 1)> emitting event: {“capability_id”:“switch”,“component_id”:“main”,“state”:{“value”:“on”},“attribute_id”:“switch”}
2022-01-21T18:50:24.140106235+00:00 TRACE Shelly Device Driver V1 Received event with handler server
2022-01-21T18:50:24.160736901+00:00 DEBUG Shelly Device Driver V1 Accepted connection from 192.168.1.140:22201
2022-01-21T18:50:24.164407235+00:00 PRINT Shelly Device Driver V1 Firstline: GET /67ed4bc7-fe39-4a6b-942d-3412c6c36d69/relay/0/off HTTP/1.1
2022-01-21T18:50:24.167679943+00:00 PRINT Shelly Device Driver V1 Headerline: Host: 192.168.1.154:36847
2022-01-21T18:50:24.171448401+00:00 PRINT Shelly Device Driver V1 Headerline: Content-Length: 0
2022-01-21T18:50:24.174769860+00:00 PRINT Shelly Device Driver V1 Headerline: User-Agent: Shelly/20211109-124958/v1.11.7-g682a0db (SHSW-1)
2022-01-21T18:50:24.184127526+00:00 INFO Shelly Device Driver V1 Message for Shelly R1 1: endpoint=/67ed4bc7-fe39-4a6b-942d-3412c6c36d69/relay/0/off
2022-01-21T18:50:24.188904610+00:00 INFO Shelly Device Driver V1 <Device: 67ed4bc7-fe39-4a6b-942d-3412c6c36d69 (Shelly R1 1)> emitting event: {“capability_id”:“contactSensor”,“component_id”:“main”,“state”:{“value”:“open”},“attribute_id”:“contact”}
2022-01-21T18:50:24.199700735+00:00 INFO Shelly Device Driver V1 <Device: 67ed4bc7-fe39-4a6b-942d-3412c6c36d69 (Shelly R1 1)> emitting event: {“capability_id”:“switch”,“component_id”:“main”,“state”:{“value”:“off”},“attribute_id”:“switch”}
listening for logs… -

Perfecto! Very gratifying to see it working correctly. :+1:t3:

1 Like

Tasmota is open source firmware that people use to flash ESP based WiFi devices So they can be used on any Wi-Fi network, not just to a private cloud.

Historically, in this community, Tasmota has been a popular option for Sonoff devices, although it’s no longer required for those.

Some people use Tasmota to flash Shelley devices to connect to an existing LAN.

You used to be able to flash some Tuya WiFi devices, like some MOES switches, but I don’t think that’s possible anymore. :thinking:

It is unfortunately very easy to fry a Shelly relay when attempting to flash it with Tasmota. See the following:

1 Like

Thanks for developing, debugging and sharing this driver with the community.

2 Likes

Thanks for the info!

1 Like

Forgot to mention here’s the discussion thread for the previous groovy DTH for Tasmota devices. (That is, Wi-Fi devices of any brand that have been flashed with the Tasmota firmware.)

There is already some discussion in that thread of future edge drivers.

@Sylvain

2 Likes

@TAustin here are my logs for door window 2 sensor. The status of the sensor does not change in the application.

2022-01-22T13:52:26.128470877+00:00 TRACE Shelly Device Driver V1 Received event with handler server
2022-01-22T13:52:26.150526793+00:00 DEBUG Shelly Device Driver V1 Accepted connection from 192.168.1.221:25490
2022-01-22T13:52:26.153977668+00:00 PRINT Shelly Device Driver V1 Firstline: GET /b3086cea-3215-43b4-b084-f8d23ea66bed/contact/closed HTTP/1.1
2022-01-22T13:52:26.157319877+00:00 PRINT Shelly Device Driver V1 Headerline: Host: 192.168.1.161:53653
2022-01-22T13:52:26.160980085+00:00 PRINT Shelly Device Driver V1 Headerline: Content-Length: 0
2022-01-22T13:52:26.164356085+00:00 PRINT Shelly Device Driver V1 Headerline: User-Agent: Shelly/20210909-144858/v1.11.4-DNSfix-ge6b2f6d (SHDW-2)
2022-01-22T13:52:26.182575918+00:00 INFO Shelly Device Driver V1 Message for Shelly Contact 1: endpoint=/b3086cea-3215-43b4-b084-f8d23ea66bed/contact/closed
2022-01-22T13:52:26.185817252+00:00 ERROR Shelly Device Driver V1 Door/Window: Unexpected action: closed
2022-01-22T13:52:26.292775210+00:00 TRACE Shelly Device Driver V1 Received event with handler server
2022-01-22T13:52:26.314288002+00:00 DEBUG Shelly Device Driver V1 Accepted connection from 192.168.1.221:11941
2022-01-22T13:52:26.317838168+00:00 PRINT Shelly Device Driver V1 Firstline: GET /b3086cea-3215-43b4-b084-f8d23ea66bed/contact/report?state=close&lux=426&temp=23.20&id=shellydw2-E8DB84D32483 HTTP/1.1
2022-01-22T13:52:26.321707793+00:00 PRINT Shelly Device Driver V1 Headerline: Host: 192.168.1.161:53653
2022-01-22T13:52:26.324944002+00:00 PRINT Shelly Device Driver V1 Headerline: Content-Length: 0
2022-01-22T13:52:26.338977293+00:00 PRINT Shelly Device Driver V1 Headerline: User-Agent: Shelly/20210909-144858/v1.11.4-DNSfix-ge6b2f6d (SHDW-2)
2022-01-22T13:52:26.348024835+00:00 INFO Shelly Device Driver V1 Message for Shelly Contact 1: endpoint=/b3086cea-3215-43b4-b084-f8d23ea66bed/contact/report?state=close&lux=426&temp=23.20&id=shellydw2-E8DB84D32483
2022-01-22T13:52:26.351812668+00:00 ERROR Shelly Device Driver V1 Door/Window: Unexpected action: report?state=close&lux=426&temp=23.20&id=shellydw2-E8DB84D32483
2022-01-22T13:52:39.145981499+00:00 TRACE Shelly Device Driver V1 Received event with handler server
2022-01-22T13:52:39.213803207+00:00 DEBUG Shelly Device Driver V1 Accepted connection from 192.168.1.221:9080
2022-01-22T13:52:39.225321874+00:00 PRINT Shelly Device Driver V1 Firstline: GET /b3086cea-3215-43b4-b084-f8d23ea66bed/contact/open HTTP/1.1
2022-01-22T13:52:39.244737874+00:00 PRINT Shelly Device Driver V1 Headerline: Host: 192.168.1.161:53653
2022-01-22T13:52:39.257068249+00:00 PRINT Shelly Device Driver V1 Headerline: Content-Length: 0
2022-01-22T13:52:39.278032457+00:00 PRINT Shelly Device Driver V1 Headerline: User-Agent: Shelly/20210909-144858/v1.11.4-DNSfix-ge6b2f6d (SHDW-2)
2022-01-22T13:52:39.331474457+00:00 INFO Shelly Device Driver V1 Message for Shelly Contact 1: endpoint=/b3086cea-3215-43b4-b084-f8d23ea66bed/contact/open
2022-01-22T13:52:39.358800207+00:00 INFO Shelly Device Driver V1 <Device: b3086cea-3215-43b4-b084-f8d23ea66bed (Shelly Contact 1)> emitting event: {“attribute_id”:“contact”,“component_id”:“main”,“capability_id”:“contactSensor”,“state”:{“value”:“open”}}
2022-01-22T13:52:39.413873499+00:00 ERROR Shelly Device Driver V1 Door/Window: Unexpected action: open
2022-01-22T13:52:39.466291124+00:00 TRACE Shelly Device Driver V1 Received event with handler server
2022-01-22T13:52:39.488036165+00:00 DEBUG Shelly Device Driver V1 Accepted connection from 192.168.1.221:23471
2022-01-22T13:52:39.506787874+00:00 PRINT Shelly Device Driver V1 Firstline: GET /b3086cea-3215-43b4-b084-f8d23ea66bed/contact/report?state=open&lux=372&temp=23.20&id=shellydw2-E8DB84D32483 HTTP/1.1
2022-01-22T13:52:39.524328957+00:00 PRINT Shelly Device Driver V1 Headerline: Host: 192.168.1.161:53653
2022-01-22T13:52:39.533501957+00:00 PRINT Shelly Device Driver V1 Headerline: Content-Length: 0
2022-01-22T13:52:39.538341374+00:00 PRINT Shelly Device Driver V1 Headerline: User-Agent: Shelly/20210909-144858/v1.11.4-DNSfix-ge6b2f6d (SHDW-2)
2022-01-22T13:52:39.571320873+00:00 INFO Shelly Device Driver V1 Message for Shelly Contact 1: endpoint=/b3086cea-3215-43b4-b084-f8d23ea66bed/contact/report?state=open&lux=372&temp=23.20&id=shellydw2-E8DB84D32483
2022-01-22T13:52:39.574623165+00:00 ERROR Shelly Device Driver V1 Door/Window: Unexpected action: report?state=open&lux=372&temp=23.20&id=shellydw2-E8DB84D32483
2022-01-22T13:53:00.650423327+00:00 TRACE Shelly Device Driver V1 Received event with handler server
2022-01-22T13:53:00.677924118+00:00 DEBUG Shelly Device Driver V1 Accepted connection from 192.168.1.221:5371
2022-01-22T13:53:00.681808118+00:00 PRINT Shelly Device Driver V1 Firstline: GET /b3086cea-3215-43b4-b084-f8d23ea66bed/contact/closed HTTP/1.1
2022-01-22T13:53:00.685158702+00:00 PRINT Shelly Device Driver V1 Headerline: Host: 192.168.1.161:53653
2022-01-22T13:53:00.688730285+00:00 PRINT Shelly Device Driver V1 Headerline: Content-Length: 0
2022-01-22T13:53:00.692251118+00:00 PRINT Shelly Device Driver V1 Headerline: User-Agent: Shelly/20210909-144858/v1.11.4-DNSfix-ge6b2f6d (SHDW-2)
2022-01-22T13:53:00.706061452+00:00 INFO Shelly Device Driver V1 Message for Shelly Contact 1: endpoint=/b3086cea-3215-43b4-b084-f8d23ea66bed/contact/closed
2022-01-22T13:53:00.716473743+00:00 ERROR Shelly Device Driver V1 Door/Window: Unexpected action: closed
2022-01-22T13:53:00.827779618+00:00 TRACE Shelly Device Driver V1 Received event with handler server
2022-01-22T13:53:00.844275618+00:00 DEBUG Shelly Device Driver V1 Accepted connection from 192.168.1.221:9755
2022-01-22T13:53:00.847666493+00:00 PRINT Shelly Device Driver V1 Firstline: GET /b3086cea-3215-43b4-b084-f8d23ea66bed/contact/report?state=close&lux=408&temp=23.20&id=shellydw2-E8DB84D32483 HTTP/1.1
2022-01-22T13:53:00.855949702+00:00 PRINT Shelly Device Driver V1 Headerline: Host: 192.168.1.161:53653
2022-01-22T13:53:00.859313035+00:00 PRINT Shelly Device Driver V1 Headerline: Content-Length: 0
2022-01-22T13:53:00.863715077+00:00 PRINT Shelly Device Driver V1 Headerline: User-Agent: Shelly/20210909-144858/v1.11.4-DNSfix-ge6b2f6d (SHDW-2)
2022-01-22T13:53:00.879911868+00:00 INFO Shelly Device Driver V1 Message for Shelly Contact 1: endpoint=/b3086cea-3215-43b4-b084-f8d23ea66bed/contact/report?state=close&lux=408&temp=23.20&id=shellydw2-E8DB84D32483
2022-01-22T13:53:00.883204368+00:00 ERROR Shelly Device Driver V1 Door/Window: Unexpected action: report?state=close&lux=408&temp=23.20&id=shellydw2-E8DB84D32483

Thanks very much for the log, it really helps! There was a couple of things I needed to change based what is coming back from the device. I’ve pushed out a driver update that you can try again:

Version: 2022-01-22T19:08:19.221695

One other thing I see from the log is that there may be a way to reduce the notifications needed from the device. The open and close notifications might be redundant with another one being received called ‘report’. So first see if this update fixes the problem with the sensor not changing in the mobile app. Give me another log if you could with a couple open/close sequences so I can confirm the redundant messages. If they are, I’ll make one more change to have them removed.

One other item: the device has a vibration and tilt detector. See if you can trigger those as well. I am only showing the vibration in the SmartThings app, not the tilt. Let me know if that is acceptable. If not I can see about translating the tilt values to the threeAxis capability in SmartThings.

Thanks again!

I’m still waiting for the driver update on the hub.
Vibrations are already visible in the application.

You can use CLI to install immediately:

smartthings edge:drivers:install

Just select my test channel and Shelly driver when prompted.

Thanks. I did this now but it still shows the old driver in the app. Made a clear cache and stopped the application - still an old driver.

The driver is still old - 2022-01-21T17:46:16.355395. I also did delete the driver and unroll and later add the driver but it is still an old driver. I also restart the hub. What else can I do but wait?

Work fine in my shelly1. I added using relay1but i see a contract sensor. I change the icon, but the funcion open close Remained! IMG_20220123_181819|225x500

It’s not a big deal, maybe it’s already been reported, or maybe it’s just my problem. I don’t know.

Having the contact sensor with these switch is a good thing to have.
You can use it to trigger Alexa routines.

1 Like

Thanks for all the feedback guys. Wanted to give a quick update:

I got my 2.5 yesterday and in doing some testing with it found that there are some ‘anomolies’ I’m getting in sending messages to it, which may be causing some inconsistencies in SmartThings device behavior. I’m glad I got one of these so I can see how they are behaving, and once I work through the issues, we’ll have a more dependable driver.

One other thing I’ve been able to see with the 2.5 is that it IS discoverable on the network using mDNS. This may not be the case with battery-powered devices, but for hardwired ones, it should work. As a result, one of my improvements will be to add auto-discovery code to the driver.

FYI, the next driver update will also include a first pass at the Dimmer device, but give me a couple days to learn what I can from the 2.5.

@Hafo - this may have been my fault. Hold off until I get the next driver pushed out. Thank you for your patience!

4 Likes

When the switch is ‘ON’, that means the contact is ‘CLOSED’. That’s how it should be, but if that doesn’t make sense I could certainly change it.

I’m not sure what you meant when you said “I change the icon”.