Edge Shelly device support discussion

Amazing! I’ve just bought a Shelly 1PM Plus including the temperature sensor addon.
Intending to use it on a hot tub - measure temp, power usage, and control heater on/off.

Hi all. Making progress on the Shelly driver. Have my motion sensor working nicely and am working on the 1, 1PM, and 2.5 relays. In fact I may make a test driver available as early as tomorrow for the first 3.

Regarding the 2.5 relay, I’m going to need some design input from those of you owning this one:

In SmartThings you cannot have more than one particular standard capability type within a device definition. Meaning you can only have one standard switch, one standard power meter, etc. The usual way around this is to create what are called custom capabilities. This isn’t difficult to do for simple capabilities like switches or contacts. But for things like power & energy consumption meters, you really can’t recreate the GUI look of those capabilities in a custom version. So for the 2.5, which has two power and energy consumption meters, I have no way to show two in one device in the standard way. So I have some alternatives to suggest and would like opinions:

  1. Instead of using the standard capabilites which include graphical elements like this:

I could alternatively simply display the power and energy consumption values for the two relay channels in 4 plain text fields. Downside is no nice graphs, but at least you still have the values.
2) I could create 2 separate SmartThings devices for each 2.5 relay channel and each would have its own device details with the standard capability GUI above. The downside is the hassle of going to 2 separate SmartThings devices.

I haven’t gotten my head wrapped around how to deal with the roller mode vs. relay mode, so I will likely be seeking input regarding that as well. And that may have some bearing on whether it would be wise to consider #2 above.

2 Likes

One of each capability per component, up to 10 components per device. So you can have 10 switches or power meters before getting creative with custom capabilities.

I don’t have a Shelly so can’t comment on whether that’s the design choice you should go with, but it’s an option.

1 Like

I don’t currently have a 2.5 but 2 separate devices sounds like a good idea. Wouldn’t that make it easier to use these devices with Alexa and Google, in addition to maintaining the graphs.

You are absolutely right. I had completely forgotten about that! Never had to use components before personally, so this will be a first!

THANK YOU.

2 Likes

Are you going to run into this?

Edge is a new environment that is currently in beta. Current functionality may not match the functionality present when the platform is released generally. In the thread that you linked, ST staff indicated that that particular problem had been reported to engineering. Anyone developing in the new environment will have to make design decisions, and some will hinge on whether they trust that ST will solve that and other reported issues.

Components are a foundational structure of the device in the new architecture, and are used in many of the stock drivers. They appear to be the path that ST has paved for multi-endpoint devices like this. I’ve chosen to trust that ST will work through many (but perhaps not all) of the identified pain points with them. Others will make different choices as they work on Edge integrations.

The other two options - custom capabilities and additional devices - have their own pitfalls, as well as their own benefits.

1 Like

I have a preliminary test version of the Shelly driver I’m making available on my test channel here:

Caveats:

  • Limited communication retries for now, so if device doesn’t respond after two attempts, it gives up.
  • 1, 1PM, 2.5 relay, 2.5 roller, and Motion devices can be created; all others will result in a ‘not implemented’ message
  • No temperature add-on support for 1 and 1PM …yet!
  • NO actual testing has been done other than on the motion sensor, so don’t expect miracles!
  • Regarding above, CLI logging output will be necessary to see where the problems are

Instructions

  • Perform an Add device / Scan nearby and a new device will be created in your ‘No room assigned’ room called ‘Shelly Device Creator’.
  • Go to the new creator device’s details page and tap the button ‘Select Device Type to Create’ and select one of the implemented device types. You’ll get a message that the device was created, or ‘not implemented’
  • Find the new device in your ‘No room assigned’ room and go into device settings by clicking on the 3 vertical dot menu in the upper right of the device details screen.
    Each device will have a field to provide the IP address of the Shelly device. Once you enter it, the driver will attempt to get status from the device.
  • Return to the device details screen to see if the various fields have been initialized with what looks like valid data. If nothing seems to be getting filled in, then getting status from the device probably failed. To force a retry, go back to settings and set the IP address to something else and press OK. Wait 10 seconds then change the IP address back to the correct one. Check the details screen again.

Feedback needed
Obviously anything you can provide is welcome, but here are some specific things that will need decisions:

  • For the relay-type devices, is it valuable to include a contact in addition to a switch? Another option might be to include the contact so it is available to automation routines, but not display it on the device details screen, since it’s redundant information.
  • How do you like/dislike the multi-component aspect of the 2.5 devices? The earlier posts on this topic raise some interesting issues regarding other applications being able to access secondary components. Is this an issue for you? For the 2.5, it is only a matter of the second relay and associated energy info.
  • Regarding energy: in order to maintain a current value for total energy, there would have to be polling out to the device on some frequency. This is not yet implemented - the values are updated only when an action is sent or received.
  • Some of the Shelly devices have quite a number of configuration options. I did not try to reproduce those in this driver, but rather for now I’ve stuck with what I considered to be the primary function. Philosophically, I think it would be best to use the Shelly app to do ‘deep’ configuration of the device, but let me know what you all think. If there are any key things that seem to be missing that are important to you, let me know what they are.
  • I’m not quite sure of the 2.5 roller functionality, so I had to make some assumptions there. The API doesn’t clearly distinguish, for example, between ‘closing’ and ‘closed’ or ‘opening’ and ‘opened’ when it comes to the state. However the position is available and I use it to set the shade level. I fully expect there’s some more work needed to get this working correctly.

Let me know what you think!

3 Likes

Hi @TAustin
I have some logs for the shelly one
It only works to turn on the device , the button keep spinning and dont report back the state of the device .
What i did in the logs is

  • turn on and off the device
  • change the ip for a wrong one (192.168.1.3)and wait then change for the ip of my device.
  • I have tried 2 shelly one , with same result .

Is there a command to stop the logs in the cli ?

Thanks

? Select a driver. 12
2022-01-18T14:20:58.684678941+00:00 TRACE Shelly Device Driver V1 Received event with handler capability
2022-01-18T14:20:58.846814843+00:00 INFO Shelly Device Driver V1 <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)> received command: {“positional_args”:,“args”:,“component”:“main”,“capability”:“switch”,“command”:“on”}
2022-01-18T14:20:58.851490138+00:00 TRACE Shelly Device Driver V1 Found CapabilityCommandDispatcher handler in thisDriver
2022-01-18T14:20:58.934599630+00:00 INFO Shelly Device Driver V1 main switch turned on
2022-01-18T14:20:58.940466520+00:00 PRINT Shelly Device Driver V1 Sending HTTP request: http://192.168.1.36/relay/0/?turn=on
2022-01-18T14:20:59.410881319+00:00 PRINT Shelly Device Driver V1 response=> {“ison”:true,“has_timer”:false,“timer_started”:0,“timer_duration”:0,“timer_remaining”:0,“source”:“http”}
2022-01-18T14:20:59.440328410+00:00 ERROR Shelly Device Driver V1 Shelly R1 2 thread encountered error: [string “st.dispatcher”]:229: Error encountered while processing event for <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)>:
arg1: table: 0x18a0368
[string “st.capabilities”]:225: Value table: 0x180cbb0 is invalid for Switch.switch
2022-01-18T14:21:29.324807669+00:00 TRACE Shelly Device Driver V1 Received event with handler capability
2022-01-18T14:21:29.378155544+00:00 INFO Shelly Device Driver V1 <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)> received command: {“positional_args”:,“args”:,“component”:“main”,“capability”:“switch”,“command”:“on”}
2022-01-18T14:21:29.388433669+00:00 TRACE Shelly Device Driver V1 Found CapabilityCommandDispatcher handler in thisDriver
2022-01-18T14:21:29.417691003+00:00 INFO Shelly Device Driver V1 main switch turned on
2022-01-18T14:21:29.427929253+00:00 PRINT Shelly Device Driver V1 Sending HTTP request: http://192.168.1.36/relay/0/?turn=on
2022-01-18T14:21:29.708135753+00:00 PRINT Shelly Device Driver V1 response=> {“ison”:true,“has_timer”:false,“timer_started”:0,“timer_duration”:0,“timer_remaining”:0,“source”:“http”}
2022-01-18T14:21:29.730809211+00:00 ERROR Shelly Device Driver V1 Shelly R1 2 thread encountered error: [string “st.dispatcher”]:229: Error encountered while processing event for <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)>:
arg1: table: 0x1890580
[string “st.capabilities”]:225: Value table: 0x18983d0 is invalid for Switch.switch
2022-01-18T14:22:35.400754469+00:00 TRACE Shelly Device Driver V1 Received event with handler device_lifecycle
2022-01-18T14:22:35.406858344+00:00 INFO Shelly Device Driver V1 <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)> received lifecycle event: infoChanged
2022-01-18T14:22:35.450650385+00:00 TRACE Shelly Device Driver V1 Found DeviceLifecycleDispatcher handler in thisDriver2022-01-18T14:22:35.453975635+00:00 DEBUG Shelly Device Driver V1 Info changed handler invoked
2022-01-18T14:22:35.469691802+00:00 INFO Shelly Device Driver V1 Device address changed to: 192.168.1.3
2022-01-18T14:22:35.499470760+00:00 PRINT Shelly Device Driver V1 Sending HTTP request: http://192.168.1.3/status
2022-01-18T14:22:38.653597719+00:00 ERROR Shelly Device Driver V1 HTTP request failed: [string “socket”]:1406: connect (with timeout) failed (192.168.1.3:80): Os { code: 113, kind: Other, message: “No route to host” }
2022-01-18T14:22:39.666785511+00:00 PRINT Shelly Device Driver V1 Sending HTTP request: http://192.168.1.3/status
2022-01-18T14:22:41.776546678+00:00 ERROR Shelly Device Driver V1 HTTP request failed: [string “socket”]:1406: connect (with timeout) failed (192.168.1.3:80): Os { code: 113, kind: Other, message: “No route to host” }
2022-01-18T14:22:42.783529678+00:00 ERROR Shelly Device Driver V1 Failed to get status for Shelly R1 2
2022-01-18T14:22:42.789973428+00:00 DEBUG Shelly Device Driver V1 Shelly R1 2 device thread event handled
2022-01-18T14:22:57.234401596+00:00 TRACE Shelly Device Driver V1 Received event with handler device_lifecycle
2022-01-18T14:22:57.242312680+00:00 INFO Shelly Device Driver V1 <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)> received lifecycle event: infoChanged
2022-01-18T14:22:57.254714263+00:00 TRACE Shelly Device Driver V1 Found DeviceLifecycleDispatcher handler in thisDriver2022-01-18T14:22:57.258425971+00:00 DEBUG Shelly Device Driver V1 Info changed handler invoked
2022-01-18T14:22:57.261474430+00:00 INFO Shelly Device Driver V1 Device address changed to: 192.168.1.36
2022-01-18T14:22:57.270234513+00:00 PRINT Shelly Device Driver V1 Sending HTTP request: http://192.168.1.36/status
2022-01-18T14:22:57.361582513+00:00 PRINT Shelly Device Driver V1 response=> {“wifi_sta”:{“connected”:true,“ssid”:“BELL808”,“ip”:“192.168.1.36”,“rssi”:-39},“cloud”:{“enabled”:true,“connected”:true},“mqtt”:{“connected”:false},“time”:“09:22”,“unixtime”:1642515777,“serial”:239,“has_update”:false,“mac”:“A4CF12F47D54”,“cfg_changed_cnt”:1,“actions_stats”:{“skipped”:0},“relays”:[{“ison”:true,“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”:“idle”,“has_update”:false,“new_version”:“20211109-124958/v1.11.7-g682a0db”,“old_version”:“20211109-124958/v1.11.7-g682a0db”},“ram_total”:50880,“ram_free”:38916,“fs_size”:233681,“fs_free”:150098,“uptime”:2418161}
2022-01-18T14:22:57.370503346+00:00 INFO Shelly Device Driver V1 <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)> emitting event: {“component_id”:“main”,“capability_id”:“signalStrength”,“attribute_id”:“rssi”,“state”:{“value”:-39}}
2022-01-18T14:22:57.389117430+00:00 ERROR Shelly Device Driver V1 Shelly R1 2 thread encountered error: [string “st.dispatcher”]:229: Error encountered while processing event for <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)>:
arg1: infoChanged
arg2: table: 0x188ad00
[string “R1”]:12: attempt to index a nil value (local ‘status_table’)
2022-01-18T14:24:50.757033454+00:00 TRACE Shelly Device Driver V1 Received event with handler device_lifecycle
2022-01-18T14:24:50.763307315+00:00 INFO Shelly Device Driver V1 <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)> received lifecycle event: infoChanged
2022-01-18T14:24:50.784024659+00:00 TRACE Shelly Device Driver V1 Found DeviceLifecycleDispatcher handler in thisDriver2022-01-18T14:24:50.788364488+00:00 DEBUG Shelly Device Driver V1 Info changed handler invoked
2022-01-18T14:24:50.793335044+00:00 INFO Shelly Device Driver V1 Device address changed to: 192.168.1.212
2022-01-18T14:24:50.798456232+00:00 PRINT Shelly Device Driver V1 Sending HTTP request: http://192.168.1.212/status
2022-01-18T14:24:50.902956747+00:00 PRINT Shelly Device Driver V1 response=> {“wifi_sta”:{“connected”:true,“ssid”:“BELL808”,“ip”:“192.168.1.212”,“rssi”:-37},“cloud”:{“enabled”:true,“connected”:true},“mqtt”:{“connected”:false},“time”:“09:24”,“unixtime”:1642515890,“serial”:343,“has_update”:false,“mac”:“500291ED3079”,“cfg_changed_cnt”:11,“actions_stats”:{“skipped”:0},“ext_switch”:{“0”:{“input”:0}},“relays”:[{“ison”:false,“has_timer”:false,“timer_started”:0,“timer_duration”:0,“timer_remaining”:0,“source”:“timer”}],“meters”:[{“power”:0.00,“is_valid”:true}],“inputs”:[{“input”:0,“event”:"",“event_cnt”:0}],“ext_sensors”:{},“ext_temperature”:{},“ext_humidity”:{},“update”:{“status”:“idle”,“has_update”:false,“new_version”:“20211109-124958/v1.11.7-g682a0db”,“old_version”:“20211109-124958/v1.11.7-g682a0db”},“ram_total”:50880,“ram_free”:38964,“fs_size”:233681,“fs_free”:151102,“uptime”:2418616}
2022-01-18T14:24:50.909232774+00:00 INFO Shelly Device Driver V1 <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)> emitting event: {“component_id”:“main”,“capability_id”:“signalStrength”,“attribute_id”:“rssi”,“state”:{“value”:-37}}
2022-01-18T14:24:50.932700076+00:00 ERROR Shelly Device Driver V1 Shelly R1 2 thread encountered error: [string “st.dispatcher”]:229: Error encountered while processing event for <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)>:
arg1: infoChanged
arg2: table: 0x1895e48
[string “R1”]:12: attempt to index a nil value (local ‘status_table’)
2022-01-18T14:25:16.396821893+00:00 TRACE Shelly Device Driver V1 Received event with handler capability
2022-01-18T14:25:16.417380775+00:00 INFO Shelly Device Driver V1 <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)> received command: {“positional_args”:,“args”:,“component”:“main”,“capability”:“switch”,“command”:“on”}
2022-01-18T14:25:16.422329258+00:00 TRACE Shelly Device Driver V1 Found CapabilityCommandDispatcher handler in thisDriver
2022-01-18T14:25:16.427601954+00:00 INFO Shelly Device Driver V1 main switch turned on
2022-01-18T14:25:16.433416253+00:00 PRINT Shelly Device Driver V1 Sending HTTP request: http://192.168.1.212/relay/0/?turn=on
2022-01-18T14:25:16.556405936+00:00 PRINT Shelly Device Driver V1 response=> {“ison”:true,“has_timer”:true,“timer_started”:1642497916,“timer_duration”:0,“timer_remaining”:0,“source”:“http”}
2022-01-18T14:25:16.564642482+00:00 ERROR Shelly Device Driver V1 Shelly R1 2 thread encountered error: [string “st.dispatcher”]:229: Error encountered while processing event for <Device: f0c9426b-aa11-4712-90b7-2ea474a26c49 (Shelly R1 2)>:
arg1: table: 0x1845d30
[string “st.capabilities”]:225: Value table: 0x17e8f38 is invalid for Switch.switch

1 Like

Very helpful; thanks for the logs. Looks like I have a few things to fix…

1 Like

OK, just pushed out an update. Hopefully this fixes that set of problems. NEXT!

3 Likes

Only way is to press Ctrl-c to break out of the app. Log messages are always being emitted; the CLI just lets you view them in real time.

1 Like

@TAustin do you plan to make a edge driver for Shelly Door Window as well?

Sure, I’ll add it to the list! You’re the first one to request it.

1 Like

Can someone let me know if you see ‘2.5 Roller Mode’ on the list of devices to create? It should be there, but an older version of the list is still showing for me which doesn’t have it.

Roller mode is available but not working for me. Spinning icon at the open/close setting.
Regards. Dušan

Your update Shelly Device Creator driver works well with my Shelly1 relay. The relay responds quickly to the app and automations.

Thanks for developing and sharing this driver.

3 Likes

Thanks it is working perfectly with one of my shelly one !! The other is not ok , it doe’snt return to the off state , this one is hookup to a doorbell, so in the shelly app i have set up a timer of 0.3 seconde so that the doorbell is making the real sound , anyway i have tried to put this value to 3 secondes and its does the same thing .
Here the logs of my doorbell when turning on .

2022-01-18T20:23:51.100137602+00:00 TRACE Shelly Device Driver V1 Received event with handler capability
2022-01-18T20:23:51.176498935+00:00 INFO Shelly Device Driver V1 <Device: 5727f3b1-51c6-4f35-941c-f754eb8d0a3c (Shelly R1 2)> received command: {“positional_args”:,“capability”:“switch”,“command”:“on”,“args”:,“component”:“main”}
2022-01-18T20:23:51.195286810+00:00 TRACE Shelly Device Driver V1 Found CapabilityCommandDispatcher handler in thisDriver
2022-01-18T20:23:51.212668601+00:00 INFO Shelly Device Driver V1 main switch turned on
2022-01-18T20:23:51.226480393+00:00 PRINT Shelly Device Driver V1 Sending HTTP request: http://192.168.1.212/relay/0/?turn=on
2022-01-18T20:23:51.609768643+00:00 PRINT Shelly Device Driver V1 response=> {“ison”:true,“has_timer”:true,“timer_started”:1642519432,“timer_duration”:0,“timer_remaining”:0,“source”:“http”}
2022-01-18T20:23:51.644567393+00:00 INFO Shelly Device Driver V1 <Device: 5727f3b1-51c6-4f35-941c-f754eb8d0a3c (Shelly R1 2)> emitting event: {“state”:{“value”:“on”},“attribute_id”:“switch”,“capability_id”:“switch”,“component_id”:“main”}
2022-01-18T20:23:51.717961893+00:00 INFO Shelly Device Driver V1 <Device: 5727f3b1-51c6-4f35-941c-f754eb8d0a3c (Shelly R1 2)> emitting event: {“state”:{“value”:“closed”},“attribute_id”:“contact”,“capability_id”:“contactSensor”,“component_id”:“main”}
2022-01-18T20:23:51.747930310+00:00 DEBUG Shelly Device Driver V1 Shelly R1 2 device thread event handled
2022-01-18T20:23:51.766151976+00:00 TRACE Shelly Device Driver V1 Received event with handler server
2022-01-18T20:23:51.819535435+00:00 DEBUG Shelly Device Driver V1 Accepted connection from 192.168.1.212:27801
2022-01-18T20:23:51.841704351+00:00 PRINT Shelly Device Driver V1 Firstline: GET /5727f3b1-51c6-4f35-941c-f754eb8d0a3c/relay/0/on HTTP/1.1
2022-01-18T20:23:51.853402560+00:00 PRINT Shelly Device Driver V1 Headerline: Host: 192.168.1.176:53743
2022-01-18T20:23:51.864142018+00:00 PRINT Shelly Device Driver V1 Headerline: Content-Length: 0
2022-01-18T20:23:51.876277101+00:00 PRINT Shelly Device Driver V1 Headerline: User-Agent: Shelly/20211109-124958/v1.11.7-g682a0db (SHSW-1)
2022-01-18T20:23:51.919577893+00:00 INFO Shelly Device Driver V1 Message for Shelly R1 2: endpoint=/5727f3b1-51c6-4f35-941c-f754eb8d0a3c/relay/0/on
2022-01-18T20:23:51.944417435+00:00 ERROR Shelly Device Driver V1 Relay 1: Unrecognized command state: 0
listening for logs… -

Is there an intention to make an edge drive for 3EM shelly?:speak_no_evil:

That can be added to the list!

1 Like