So I have been using different Shelly devices for some time now (about a year) almost without fault or issues. I’ve used the plugs, the temperature sensors, water sensors etc but now I have stumbled upon a problem which I cannot find a solution for.
I recently got the Shelly Motion 2 which looked great on paper. The binding of the device and adding it to the model went just fine and everything seemed okay. The problem is the “motion” part of it. If I walk into the perimeter of the motion sensor, Openhab uses up to 60 seconds to set motion = true. If I open up the web application of the device, the motion is correctly identified immediately there saying “motion detected” with a countdown going, but it seems Openhab uses quite some time to see this new status from the device. Its like its only polling the status of the sensor every 60 seconds instead of updating the “motion” item once its updated from the Shelly sensor. Has anybody else had this issue? This makes it unusable for controlling lights in a room because I have to stand there like a bafoon for 1- 60 seconds before the lights turn on.
I’ve tried removing the item and adding it again multiple times, I’ve also tried deleting it from the Shelly app just to see if it changed anything (hint: it didn’t) .
Did you get any progress here?
I’ve ordered 3x Shelly Motion 2 sensors as part of some automations I’m planning. I don’t have them yet, and I was looking through the documentation. Although they look to have a sensitivity setting, it appears that the binding doesn’t expose that (at least from the documentation). Do you get a sensitivity channel in Openhab?
I presume I could connect using MQTT instead and see if that would expose additional functions. And that could be a solution to your problem given that these devices apparently have an MQTT interface available, and MQTT is very easy to integrate into Openhab.
Actually no, I haven’t had any progress here unfortunately. I have tried changing various settings on the web application of the device itself but not no luck so far. I haven’t really had the time either so there is that.
Regarding the channels the is exposed in openhab this is what I get:
So as you see, no sensitivity there, but you can just configure this in the web application for the device, which I kinda find easier.
tip: If you want to configure this device and the network for it without adding it to the Shelly app, all devices from Shelly is pre-configured with the IP of 192.168.33.1, but you probably already know that.
I will look into the mqtt part of it and see if I get anywhere. Will post again about my finings
So I did some digging and I got it working! So I guess that’s good news?
Here is how I did it
It seems that battery operated Shelly devices uses unicast with the port 5683 port enabled on the device (COIOT)
Go into the web application of the shelly device and open up “Internet and security” and the select “Enable CoIoT”
In the “Remote address” Enter the following:
YourOpenhabIPaddress:5683 which I do believe is the unicast port.
Reboot your Shelly device.
I got this information from the Home Assistent Shelly Page
What is strange though is that it says the following:
Generation 1 devices use the
CoIoT protocol to communicate with the integration. For Shelly firmware 1.10.0 or newer,
CoIoT must be enabled in the device settings. Navigate to the local IP address of your Shelly device, Internet & Security >> ADVANCED - DEVELOPER SETTINGS and check the box Enable CoIoT.
We recommend using
unicast for communication. To enable this, enter the local IP address of the Home Assistant server and port
5683 into the CoIoT peer field and push SAVE button. This is mandatory for battery operated devices. After changing the CoIoT peer, the Shelly device needs to be manually restarted.
And I have a Shelly H&T which has been working perfectly without the need for this and this is the Shelly Motion 2 which I would guess should not have the need for this setting… but I am struggling with a water sensors which I am going to test this out on.
Hope it helps!
Let me know if you have any difficulties
That’s useful information. The binding does say that you need CoIoT for generation 1 devices, and I think the Shelly Motion 2 is generation 1, whereas the Shelly 1 plus that I also got (still haven’t arrived) is Gen 2.
For the sensitivity, I’m going to use mine outside (under the eaves, I know they’re not waterproof). I want to automatically adjust the sensitivity if they are triggering too often - on a windy night perhaps. Which means I need to access it from API. But I can access the web endpoint directly I think, it just means I need to record the ip-address for each device.
When you say that the IP address is preconfigured with 192.168.33.1, how do they automatically join your wifi network without using the Shelly app to connect them? It seemed to me that I’d need to connect to the AP in the device, tell it the SSID and password of my wifi network, then restart it. The manual doesn’t appear to describe those steps, but I figured I’d sort it out once they arrive.
You will have to use the API for that yes as I don’t see any channels in openhab (through the binding) that allows you to set this automatically.
So regarding the default IP address, you will have to power the device on (one by one) and configure them by using the web application.
You will have to set you network interface card (NIC) to an address within the same subnet as the Shelly device (192.168.33.2 will do) and then access the device from a browser. You will then gain access to the web application and you can change the wifi network there. Once you have done this, the configured device will not be reachable through the web application unless you change the address of your NIC bakc to its original address or state (auto). I would reccomend that you configure all your Shelly devices in one go so that you don’t have to change you IP address back and forth to check that the configuration is correct.
Now this is of course completely unessesary if you connect straight to the AP that the device provides, but I find that a bit more tiresome when setting up a bunch of different components at once as it takes some time to connect and re-connect to the different APs, but thats just my way of doing it.
How do you connect to it if you’re not on the same SSID - i.e. without connecting to the AP? Having the same IP address doesn’t help unless you’re on the same network, surely? Is there some trick there - do they all have the same SSID or something?
I’m sorry, your totally right. My memory is failing me
You need to connect to the Shelly device AP before setting the IP. I’m not even certain any more if you actually have to set the IP within the same subnet as the Shelly device or not (like the picture below) in order to connect to it.
My initial idea was to create a script that could connect to every Shelly AP one by one, set the networking settings automatically (using pre-configured credentials and an IP-plan) so that you could configure many units with the push of a button, and I think that’s why my memory is failing me here . I never got that far though as I moved a lot of my devices over to Zigbee and I also have to re-structure my home network so that I can segregate all of my IoT devices out on a separate network.