CoIoT/CoAP Shelly

Hi, i have seen that nymea has as lib for CoAP Support.
Is there a way to add a Shelly through that?

Hi. The current Shelly Plugin uses mqtt to talk to the shelly. It would require to change the current plugin or add a second one using coap.

Are there any advantages in using coap over mqtt?

The Shellies of the 1st generation, that are many, cannot be connected to the Shelly cloud at the same time as they use mqtt. But with CoAP they can.

For speach assistants like Google assistant is the Shelly cloud needed as nymea still has no integration. Yet!

Simon gave it a try to use libnymeas coap implentation on the shelly. It does work, however, at a first glance it seens the shellys dont support observers which in turn would require to poll them. Also older shellies dont have support for coap and apparently shelly stopped shipping firmware updates for devices that havent beed logged in into their cloud at least once.

So IMO moving to coap gives more downsides than sticking with mqtt…

Good Morning,

I would like to refresh this topic, as I can fully support what @dossidos says.
I have the same usecase with my shellies, controlling them via app or speech assistant (in my case Alexa). Unfortunately, not being able to use a speech assistant is not a possible solution for me. And that’s the only reason why I haven’t included all my shellies into Nymea so far, which I mainly use for controlling my lights.

So therefore I have several questions:

You still do not plan to support shellies via CoAp, maybe for example in a separate PlugIn?
Or are you maybe planning to solve that via a kind of Nymea speech assistant integration?

Are there any plans from your side to implement support for 2nd Generation Shelly devices (Plus Series, for example Shelly Plus 1 or Shelly Plus 1 PM)? Those devices already support Cloud and MQTT connections simultaneously.

I’m aware that this is nothing that can be set up quickly. But maybe you gonna think about this topic again. I think that would make sense as probably lots of shelly users would not like to miss the ability to control their devices via speech assistant.

Thanks for your answers!

Indeed it’s quite odd that with newer firmwares the shelly devices can’t be connected to a custom MQTT broker and the shelly cloud simultaneously. Additionally, with newer firmwares the shelly devices require a reboot when configuring MQTT which also makes them behave a bit odd, so moving over to coap certainly would be a good thing. I have looked into the coap connectivity and it should be possible to do, but so far noone has had the time to create a new shelly plugin using coap. Likely it will happen some day, but can’t give any estimate. This could be a nice task for a community contribution, if anyone would step up to look into that. nymea itself is already capable of coap, although when I tried it, there seems to be a little bug which would need fixing. I would be willing to help with that.

As for the speech controlling, there are some attempts which use 3rd party speech recognition software and hooked up to nymea via MQTT. A howto can be found here: Low Code Private Voice controlled Home Automation - Hackster.io
This is, of course, also something we’d like to better integrate in the future but again not the smallest task so we can’t give any time estimate about this either.

Thanks for your quick answer! :+1:

Good to hear, that you might think about a Shelly CoAP Plugin in a future release. Would that contain the Gen2 Shelly devices as well? Unfortunately I’m not a programmer at all, therefore I can’t help you devolping that. :frowning_face: But I would be willing to test, if that would help!

The speech control was only thought as a workaround. At least for my usecase there would be no need for that if a Shelly CoAP Plugin would exist.

As I already said, I’m absolutely aware that devolping this is nothing which will be done by tomorrow. But maybe it could be an interesting feature in a future release.

Really appreciate your work and support! :+1:

Hey folks,

it happened. I was in the mood to learn a bit more about CoAP (not sure if it was worth it :stuck_out_tongue: ) and I’ve fixed nymea’s coap implementation [1], added some more needed features [2] and updated the shelly plugin to use CoAP (CoIoT) instead of MQTT. It is currently building in experimental and should be available soon. Note that those branches will not make it into the 1.2 release any more, but should be there for 1.3 then.

[1] Some fixes in Coap by mzanetti · Pull Request #531 · nymea/nymea · GitHub
[2] Add support for CoIoT by mzanetti · Pull Request #533 · nymea/nymea · GitHub
[3] Shelly: Rework plugin to use CoAP instead of MQTT by mzanetti · Pull Request #571 · nymea/nymea-plugins · GitHub

I have tested some of the devices, but I don’t have access to all of them so please help me testing by installing experimental somewhere and test your shelly devices with that. I’d be thankful if you could list all the devices you’ve tested here so I know if all have been tested.

There are some small changes in the overall plugin behavior:

  • For a start, this enables multiple nymea instances to communicate with a Shelly device, with MQTT this was not possible. Also, this of course allows connecting the shellies MQTT to the Shelly cloud and still use the Shelly device within nymea.
  • Some shellies, like the 2, 2.5 etc used to have “connected devices” parameters. Those are still from a time where nymea didn’t support generic I/O connections (actually they’ve inspired that feature) but are not needed any more. Instead set up generic lights or whatever and connect them to the shelly in the thing settings. Those who support power metering will still create a power meter thing per channel. This should be the only change that isn’t backwards compatible to previous setups tho. Everything else should just keep on working on an update of an existing setup.
  • The Shelly RGBW-2 got a new state to control the white channel.
  • Battery powered shellies (like the H&T sensor) are not marked as disconnected any more when they’re in deep sleep.

Devices that have been tested successfully so far (will be extending this as you guys report the tests):

  • Shelly 2 + 2.5
  • Shelly 1 + 1PM
  • Shelly Plug S
  • Shelly 3EM
  • Shelly H&T
  • Shelly i3
  • Shelly Button 1
  • Shelly EM
  • Shelly RGBW2
  • Shelly Vintage
  • Shelly Dimmer
1 Like

@mzanetti

Hello, first of all I want to say that I was really surprised to read that you made progress in such a short time. Therefore I really want to say thank you :+1: That is what I really appreciate at Nymea!

As I just came back from a short holiday, I didn’t have the time to start testing all of my different types of Shelly. But I already started with my Shellies 2.5 used to control some of my rollershutters and can confirm that they are working the way I hoped. :+1: I now can use Nymea or Alexa to control those rollershutters - Shelly cloud is still active.

The next days I will give you feedback on the Shelly 1 and the Shelly 1 PM.

What I have seen - or should I better say not seen - is that the Shelly 2nd generation devices (Shelly Plus 1 and Shelly Plus 1PM) are not recognised yet in Nymea. Can you confirm that this is not working yet.

So far, thanks again for your great support. :clap: I will keep you updated the next days.

1 Like

Indeed, the 2nd generation Shelly devices are not yet supported. They have an entirely new API and we don’t have such a device to implement them atm.

So today I had the chance to test the rest of my Shelly devices in use - Shelly 1, Shelly 1 PM, Shelly Plus 1 PM and Shelly 2.5.

As you already confirmed, the Shelly Plus 1 PM is not supported yet - if you like, i would offer sending you one of my Shelly Plus 1 PM I have as backup - just let me know if I can help you that way.

The Shelly 2.5 I already tested yesterday in rollershutter mode and everything seems to work still fine here.

The Shelly 1 and the Shelly 1 Plus I could test today. Here also everything was running smooth - I could use all Nymea, Shelly Cloud and Amazon Alexa together without any problem. Thanks for that!

But one little thing I noticed which appears a little bit strange to me is the following:

The Shelly 2.5 I could tell via Nymea that I want to use it in rollershutter mode. When I now open Nymea App, I can found it directly under the rollershutter section - that’s what I expected and what I think is the right behaviour.

But with the Shellies 1 and 1 PM, the behaviour is different. I use those shellies to switch on and off my lights - as probably most people do. Therfore I would have expected to be able to use those as switches.
I can found them under switches in Nymea but here I can only see what action happened last but I can not trigger an on / off action from here. To switch on or off I have to go to the gateway section from where I can trigger this action. This behaviour is nothing I can’t live with, but I think it would be more intuitive to trigger an on / off action under the switch section and not under the gateway section.

If you see it the same way and it is something easy to adjust, I’ll be happy if you change it in a future version, otherwise I’m fine as well and I’m getting used to it as I now know where to find it.

Thanks for your great work! :+1:

Thanks for testing and reporting.

For the Shelly 1 [PM], add a new “generic light” thing. Then open its settings and under I/O connections, select the output from the shelly 1. Then this generic light can be used to control the light on the Shelly.

If you happen to have a spare Shelly Generation 2 device, sure, that would help in getting this added. I’ll PM you on that. Thanks for the offer.

I could successfully test Shelly Dimmer / Vintage and also RGBW2. Thanks for the upgrade!

1 Like

Shelly EM successfully tested!

1 Like

So I think the last one supported but not yet confirmed to work with the new implementation is the motion sensor. @dossidos, are you still around? IIRC you had one of those.

Seems something went wrong with the latest Shelly experimental built from today (1.2.0+202206170016).
Since that update I lost the new implemented functionality, what means Shelly cloud is disabled again and I can only control my shellies via mqtt, no longer speech assistant.
Did you change anything or even revert the new functionality.
Is there a way to get back to the previous built.
Thanks.

The 1.2.0 is the stable release. 1.2.1 is currently building and a new experimental will be available again aoon.

Hey folks, a quick update:
Thanks to @plasmediaX contributing a Shelly Plus 1PM for development, the shelly plugin in experimental now also supports the Shelly Plus 1 and Plus 1PM. From now it should be trivial to add support for the other Shelly Plus/Pro devices, still I’d like to have someone owning such a device to test the changes instead of just blindly adding and shipping them untested.

So if you own a Shelly Plus/Pro device other than the Plus 1[PM], please let us know so we can get it supported.

It would be great, if devices like Shelly Flood and Shelly Gas will be supported by the Shelly plugin as well.

That shouldn’t be hard to do, if someone has those devices to test them. I can look at that later this week.