[APP][Pro&Cloud] Shelly

v3.0.12 - 2021-xx-xx

  • Split the 1PM and 1L driver to allow 1L specific functionality (this requires you to re-pair your 1L as Shelly 1L device)
  • Fixed an issue the Shelly EM which caused the device to be offline

For more information on installing version 3.x see [APP] Shelly - #1097 by Phuturist

Good to hear, and thanx for the donation. Much appreciated! :pray:

I fixed the Shelly EM issue. I also updated the debug branch on Github to look into the Shelly add on functionality. Please re-download and run that version. It will show all incoming CoAP messages now. If you have a lot of Shelly devices this will generate a lot of logging. Try to update the reed switch and see if you can identify the corresponding CoAp message on the command line. I need only those.

I just updated and I get the same error message and the shelly EM is offline. Also nothing happens when I trigger the reed switch.

The Shelly EM issue is fixed on the 3.0.12 test version from the app store. I havent fixed it in the debug branch on Github.

Are you seeying other CoAP events on the CLI but just not the reed switch trigger when running the debug version. That would indicate an issue on Shelly side. If you are not seeying any CoAP events you are probably not using the latest debug version.

I updated to 3.0.12 and repaired my Shelly 1L devices, but the button triggers aren’t working. When I press the button, the flow won’t start

Edit: first made a flow to turn a HUE lamp on/off but that didn’t work for all of the button triggers.
After that, made a flow for all devices and each triggers to send me a notification on which device what button was pressed, but I don’t receive a notification.

Edit2: had one device still connected as PM/1L and that device still works and send a notification after a button was pressed.

I have updated to version 3.0.12 test and shelly EM continues offline.

The Shelly Plug S only updates the values when you start the application, then never again.

I have downloaded the debug version again and the log is exactly the same. And the addon does not show the status of the reed switch, nor any message when I activate any shelly.

This is the status of the shelly 1 with addon:

reed off:

{“wifi_sta”:{“connected”:true,“ssid”:“xxxxxxxxxx”,“ip”:“0.0.0.0”,“rssi”:-63},“cloud”:{“enabled”:true,“connected”:true},“mqtt”:{“connected”:false},“time”:“17:47”,“unixtime”:1613321246,“serial”:70,“has_update”:false,“mac”:“00000000”,“cfg_changed_cnt”:2,“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”:“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”:“20210115-102904/v1.9.4@e2732e05”,“old_version”:“20210115-102904/v1.9.4@e2732e05”,“beta_version”:“20210209-101435/v1.10.0-rc2-g0cf9ee3-heads/v1.10.0-rc2”},“ram_total”:50704,“ram_free”:38196,“fs_size”:233681,“fs_free”:145078,“uptime”:108090}

and reed on:

{“wifi_sta”:{“connected”:true,“ssid”:“xxxxxxxx”,“ip”:“0.0.0.0”,“rssi”:-64},“cloud”:{“enabled”:true,“connected”:true},“mqtt”:{“connected”:false},“time”:“17:49”,“unixtime”:1613321378,“serial”:71,“has_update”:false,“mac”:“00000000”,“cfg_changed_cnt”:2,“actions_stats”:{“skipped”:0},“ext_switch":{“0”:{“input”:1}},“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”:“idle”,“has_update”:false,“new_version”:“20210115-102904/v1.9.4@e2732e05”,“old_version”:“20210115-102904/v1.9.4@e2732e05”,“beta_version”:“20210209-101435/v1.10.0-rc2-g0cf9ee3-heads/v1.10.0-rc2”},“ram_total”:50704,“ram_free”:38164,“fs_size”:233681,“fs_free”:145078,“uptime”:108223}

Do you know how to run the app from the command line using the command homey app run ? If so, could you run the debug version of Github and perform a long and shortpush about 60 seconds after the app has been started from the command line.

I have updated the debug version with the changes that are included in 3.0.12. Could you re-download and run it again and see if it gives an error.

This means the CoAP traffic is not working for this device. On startup it requests the status over HTTP REST but then relies on CoAP for device updates. That could also be the reason for other devices not updating it’s status like your Shelly 1 add on. If you have the devices in a seperate LAN you might need to do some extra configuration in your network.

You need to wait for a minute or so after running the app before the CoAP messages are being processed. Try to change the status of a different Shelly. If you still do not see any CoAP messages that there is an issue with CoAP traffic on your network.

Found out how to run the debug app.
Here’s the log from command line:

2021-02-14 18:24:15 [log] [ShellyApp] Initializing Shelly App ...
2021-02-14 18:24:58 [log] [ShellyApp] Discovered device with ID 84CCA8ACD848 and type SHSW-L on IP address 192.168.0.50
2021-02-14 18:24:58 [log] [ShellyApp] Discovered device with ID 84CCA8AC9E33 and type SHSW-L on IP address 192.168.0.52
2021-02-14 18:24:58 [log] [ShellyApp] Discovered device with ID 84CCA8ADAD68 and type SHSW-L on IP address 192.168.0.53
2021-02-14 18:24:58 [log] [ShellyApp] Discovered device with ID 84CCA8AD58B0 and type SHSW-L on IP address 192.168.0.51
2021-02-14 18:25:04 [log] [ShellyApp] inputEventCounter0 changed from 18 to 19 for device 84CCA8ADAD68 with IP address 192.168.0.53
2021-02-14 18:25:04 [log] [ManagerDrivers] [shelly1L] [2] Shelly 1L coap message for capability inputEventCounter0 with value 19
2021-02-14 18:25:16 [log] [ShellyApp] input0 changed from 0 to 1 for device 84CCA8ADAD68 with IP address 192.168.0.53
2021-02-14 18:25:16 [log] [ManagerDrivers] [shelly1L] [2] Shelly 1L coap message for capability input0 with value 1
2021-02-14 18:25:16 [log] [ShellyApp] deviceTemperature changed from 45.19 to 45.3 for device 84CCA8ADAD68 with IP address 192.168.0.53
2021-02-14 18:25:16 [log] [ManagerDrivers] [shelly1L] [2] Shelly 1L coap message for capability deviceTemperature with value 45.3
2021-02-14 18:25:17 [log] [ShellyApp] inputEvent0 changed from S to L for device 84CCA8ADAD68 with IP address 192.168.0.53
2021-02-14 18:25:17 [log] [ManagerDrivers] [shelly1L] [2] Shelly 1L coap message for capability inputEvent0 with value L
2021-02-14 18:25:17 [log] [ShellyApp] inputEventCounter0 changed from 19 to 20 for device 84CCA8ADAD68 with IP address 192.168.0.53
2021-02-14 18:25:17 [log] [ManagerDrivers] [shelly1L] [2] Shelly 1L coap message for capability inputEventCounter0 with value 20
2021-02-14 18:25:17 [log] [ShellyApp] deviceTemperature changed from 45.3 to 45.19 for device 84CCA8ADAD68 with IP address 192.168.0.53
2021-02-14 18:25:17 [log] [ManagerDrivers] [shelly1L] [2] Shelly 1L coap message for capability deviceTemperature with value 45.19
2021-02-14 18:25:20 [log] [ShellyApp] input0 changed from 1 to 0 for device 84CCA8ADAD68 with IP address 192.168.0.53
2021-02-14 18:25:20 [log] [ManagerDrivers] [shelly1L] [2] Shelly 1L coap message for capability input0 with value 0
2021-02-14 18:25:24 [log] [ShellyApp] deviceTemperature changed from 45.19 to 45.3 for device 84CCA8ADAD68 with IP address 192.168.0.53
2021-02-14 18:25:24 [log] [ManagerDrivers] [shelly1L] [2] Shelly 1L coap message for capability deviceTemperature with value 45.3
2021-02-14 18:25:31 [log] [ShellyApp] deviceTemperature changed from 45.62 to 45.51 for device 84CCA8ACD848 with IP address 192.168.0.50
2021-02-14 18:25:39 [log] [ShellyApp] deviceTemperature changed from 45.3 to 45.19 for device 84CCA8ADAD68 with IP address 192.168.0.53
2021-02-14 18:25:39 [log] [ManagerDrivers] [shelly1L] [2] Shelly 1L coap message for capability deviceTemperature with value 45.19

Edit:
I pressed the button 2 times for short push and after that 1 time for longpush

Update:

This is the Shelly EM log:

2021-02-14 18:28:01 [log] [ManagerDrivers] [shellyem] [0] TypeError: Cannot read property ‘0’ of undefined
at ShellyEmDevice.initialStateUpdate (/drivers/shellyem/device.js:84:40)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
2021-02-14 18:28:02 [log] [ManagerDrivers] [shellyem] [1] TypeError: Cannot read property ‘1’ of undefined
at ShellyEmDevice.initialStateUpdate (/drivers/shellyem/device.js:84:40)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

I have a server with home assistant with the shellyforhass integration, according to the information that HA gives me, the shellys are communicating by CoAP (I’m not 100% sure), and they all work perfectly. All the shellies are in the same network.

I have a ubiquiti AC-Pro and USG router. How can I see if there is coap traffic on my network?

I’m only seeying one longpush here but it could be you did the two short pushes before the coap listener had started as it’s one of the first events in the log. So the messages are coming through. Have you actually updated your flows for these triggers as these need to be changed because of the re-pairing of the device and the adding of the second button?

I’ll fix that. It’s a small type-o.

It uses both poll (which is HTTP REST) and CoAP. If you are not seeying any other messages in the command line (similar to the post of TheFops which is from the same debug version) I’m pretty sure CoAP isnt working on your network.

Most simple way to confirm it has nothing to do with Homey or my app is:

  1. install nodejs

  2. npm install -g shellies

  3. save the code below as shellies.js

  4. from the folder where you saved shellies.js run node shellies.js and see if it give any data

    const shellies = require(‘shellies’)

    shellies.on(‘discover’, device => {
    // a new device has been discovered
    console.log(‘Discovered device with ID’, device.id, ‘and type’, device.type)

    device.on(‘change’, (prop, newValue, oldValue) => {
    // a property on the device has changed
    console.log(prop, ‘changed from’, oldValue, ‘to’, newValue)
    })

    device.on(‘offline’, () => {
    // the device went offline
    console.log(‘Device with ID’, device.id, ‘went offline’)
    })
    })

    // start discovering devices and listening for status updates
    shellies.start()

Yes actually made a new flow to test, see that one below:

Edit: also tried the same app with the other push actions, nothing happens.

I have a Gas sensor.
I can added the device… But after 2 seconds the device is no longer available…

Can someone help me?

I have no clue. I have updated the debug branch with more debug logging. Could you re-download, run the app, wait a minute and try a long and short push.

Can you restart the app and after a minute send me a crash report through the app settings.

Here you go:
─────────────── Logging stdout & stderr ───────────────
2021-02-14 21:19:26 [log] [ShellyApp] Initializing Shelly App …
2021-02-14 21:20:09 [log] [ShellyApp] Discovered device with ID 84CCA8AC9E33 and type SHSW-L on IP address 192.168.0.52
2021-02-14 21:20:09 [log] [ShellyApp] Discovered device with ID 84CCA8ADAD68 and type SHSW-L on IP address 192.168.0.53
2021-02-14 21:20:09 [log] [ShellyApp] Discovered device with ID 84CCA8AD58B0 and type SHSW-L on IP address 192.168.0.51
2021-02-14 21:20:09 [log] [ShellyApp] Discovered device with ID 84CCA8ACD848 and type SHSW-L on IP address 192.168.0.50
2021-02-14 21:20:46 [log] [ManagerDrivers] [shelly1L] [2] triggering action event for Shelly 1L Gang Plafondlamp and action event null
2021-02-14 21:20:53 [log] [ManagerDrivers] [shelly1L] [2] triggering action event for Shelly 1L Gang Plafondlamp and action event null

Hierbij!

e6dde96f-5c42-48ce-a6b5-d85b5d2bebde

This is what i get:
C:\shelly>node shellies.js
C:\shelly\shellies.js:1
(function (exports, require, module, __filename, __dirname) { const shellies = require(�shellies�)
^

SyntaxError: Invalid or unexpected token
at new Script (vm.js:80:7)
at createScript (vm.js:264:10)
at Object.runInThisContext (vm.js:316:10)
at Module._compile (internal/modules/cjs/loader.js:670:28)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
at Function.Module._load (internal/modules/cjs/loader.js:536:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
at startup (internal/bootstrap/node.js:308:19)

:cold_sweat:

v3.0.13 - 2021-xx-xx

  • Fixed another issue with the Shelly EM causing the device to appear offline
  • Fixed an issue with the Shelly Gas causing the device to appear offline

For more information on installing version 3.x see [APP] Shelly - #1097 by Phuturist

Make sure you save the file in UTF-8 format (use a proper file editor).

The issue is that the piece of code you posted isn’t formatted using </>, so it contains “smart” quotes which JS cannot handle.