alexryd / homebridge-shelly-ng

Homebridge plugin for the next generation of Shelly devices
GNU General Public License v3.0
124 stars 49 forks source link

state of the plug issue #134

Open ohad-e opened 2 months ago

ohad-e commented 2 months ago

From time to time, the state of the physical switch doesn't update in the HOME app, so. For example, the lamp is on, but the state of the switch in the HOME app is off, and then I can't control the state from the HOME app (the button in the app not responding). To solve this, I have two options:

  1. to turn off, for example, the physical switch, and then I can control it again from the HOME app
  2. restart the bridge, and then the state of the devices will be updated again.

It happens a lot... Does this happen to other people? Many thanks

apartmedia commented 2 months ago

What exact type of Shelly are you talking about? Is authentication or password restricted login activated on the affected Shelly device?

ohad-e commented 2 months ago

Yes, They are protected by a password. The types are Shelly plus 1 and Shelly plus 2pm.

On Wed, 18 Sep 2024 at 12:52 apartmedia @.***> wrote:

What exact type of Shelly are you talking about? Is authentication or password restricted login activated on the affected Shelly device?

— Reply to this email directly, view it on GitHub https://github.com/alexryd/homebridge-shelly-ng/issues/134#issuecomment-2358014548, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLMBUVLW7CNRDX5ZJ52EM2TZXFEONAVCNFSM6AAAAABOM6KRP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJYGAYTINJUHA . You are receiving this because you authored the thread.Message ID: @.***>

apartmedia commented 2 months ago

If you need password protection activated you might need to switch to another plugin. Their is a technical communication issue with Shelly NG devices and this repo if authentication is activated. You can read about it in the issues. As @alexryd seems to be AFK and there is a long time no maintenance on this repo you should probably switch to another plugin or fork. As far as I can tell homebridge-shelly-ds9 from cubi1337 is the most active one. That fork supports more NextGen Shelly’s and has also a fix for password protected devices already implemented. If you would like to stay at the current plugin and repo you can disable password protection on the supported Shelly NG devices and they should work as expected.

ohad-e commented 2 months ago

Thank you!

I am already on this plugin: https://github.com/cubi1337/homebridge-shelly-ds9 The issue that I mentioned is relevant to this plugin.

On Wed, 18 Sep 2024 at 13:54 apart media @.***> wrote:

If you need password protection activated you might need to switch to another plugin. Their is a technical communication issue with Shelly NG devices and this repo if authentication is activated. You can read about it in the issues. As @alexryd https://github.com/alexryd seems to be AFK and there is a long time no maintenance on this repo you should probably switch to another plugin or fork. As far as I can tell homebridge-shelly-ds9 https://github.com/cubi1337/homebridge-shelly-ds9 from cubi1337 https://github.com/cubi1337 is the most active one. That fork supports more NextGen Shelly’s and has also a fix for password protected devices already implemented. If you would like to stay at the current plugin and repo you can disable password protection on the supported Shelly NG devices and they should work as expected.

— Reply to this email directly, view it on GitHub https://github.com/alexryd/homebridge-shelly-ng/issues/134#issuecomment-2358149927, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLMBUVONNHKI5LCF4WDKN5LZXFLVBAVCNFSM6AAAAABOM6KRP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJYGE2DSOJSG4 . You are receiving this because you authored the thread.Message ID: @.***>

apartmedia commented 2 months ago

Hm, that’s strange. I‘m using a Shelly Plus 1 with password protection with the ds9 plugin without any issues. What happens if you deactivate authentication? Does that change anything or resolve the issue? Version 1.1.2 should have fixed this re-auth issue related to password protected devices.

ohad-e commented 2 months ago

I could not control the devices with a password when I installed the original plugin. Now, the problem I mentioned before is with the switch control.

Do you use this device with a password, and does it work well?

On Wed, 18 Sep 2024 at 21:20 apartmedia @.***> wrote:

Hm, that’s strange. I‘m using a Shelly Plus 1 with password protection with the ds9 plugin without any issues. What happens if you deactivate authentication? Does that change anything or resolve the issue? Version 1.1.2 https://github.com/cubi1337/homebridge-shelly-ds9/releases/tag/v1.1.2 should have fixed this re-auth issue related to password protected devices.

— Reply to this email directly, view it on GitHub https://github.com/alexryd/homebridge-shelly-ng/issues/134#issuecomment-2359129526, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLMBUVKRXINCJJ7NNHFBZNLZXG76VAVCNFSM6AAAAABOM6KRP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJZGEZDSNJSGY . You are receiving this because you authored the thread.Message ID: @.***>

apartmedia commented 2 months ago

Yes, I have password protection enabled and controlling the device is working flawless. But honestly I haven‘t connected a physical switch, so you are right and it might be a complete different issue. Most of the time I‘m controlling the device only via home app not a physical switch. Are you using a regular flip switch or momentary button? Is the Shelly configured correctly for your type of physical switch? The state should be communicated in the same way as the control commands (using web sockets). Can you open the web gui of the Shelly and see if the physical switch state is displayed there correctly?

ohad-e commented 2 months ago

So, in my case, also, the Shelly devices that control only from the app without a physical switch work perfectly.

The issue is just with the devices, which are sometimes controlled by the physical switch and sometimes from the app.

I tried many things:

  1. Change the switch type in Shelly (all the types and settings).
  2. Static IP
  3. Disable mesh technology.
  4. Disable mdns.
  5. Change the parameters related to the bridge's communication time.

The issue didn't occur all the time. For example, after I restarted the bridge, everything worked fine. It happened after a few hours.

I suggest that someone add a service that updates the state of the physical switch occasionally because, after a restart, all works well!

Many thanks!

On Wed, 18 Sep 2024 at 22:00 apartmedia @.***> wrote:

Yes, I have password protection enabled and controlling the device is working flawless. But honestly I haven‘t connected a physical switch, so you are right and it might be a complete different issue. Most of the time I‘m controlling the device only via home app not a physical switch. Are you using a flip switch or momentary button? Is the Shelly configured correctly for you type of physical switch? The state should be communicated in the same way as the control commands (using web sockets). Can you open the web gui of the Shelly and see if the physical switch state is displayed there correctly?

— Reply to this email directly, view it on GitHub https://github.com/alexryd/homebridge-shelly-ng/issues/134#issuecomment-2359200113, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLMBUVN24FORCCHSSFSIUNTZXHEWPAVCNFSM6AAAAABOM6KRP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJZGIYDAMJRGM . You are receiving this because you authored the thread.Message ID: @.***>

apartmedia commented 2 months ago

What displays the Shelly web gui? Does it respond to the physical switch change (when the home app doesn‘t)? It‘s important that the Shelly’s software switch type is configured accordingly with the real used physical switch type. Is the latest Shelly firmware installed on the device? Which version? It could also be a firmware issue especially it the web gui of the device has the same problem. There should be no need for an additional update service as this is already part of the web socket communication. There must be some other issue (firmware, network, configuration, software, installation, plugin).

ohad-e commented 2 months ago

The shelly GUI presents the correct state of the lamp (on when on or off when off). Here is a print screen of the shelly settings: image When the app doesn't work, I can control the shelly from the GUI. If it doesn't work from the HOME app, when I change the state through the GUI, I can control the shelly again from the HOME app. all the devices updated to the last version (automatic update) shelly plus 2pm: 20240819-074337/1.4.2-gc2639da plugin: 1.5.2

I will try to diagnose Shelly's log to understand how the command got in the device. I will update you later.

thanks!

ohad-e commented 2 months ago

So, it is more interesting: This is the log file from the shelly:

image

1) try to control the device from the HOME app - there is no answer from the shelly (I think because the state of the switch isn't correct) 2) I controlled the switch from Shelly GUI - it works well, and the state changed! 3) I succeeded in controlling the switch from the HOME app!

So, in my opinion, the problem is with the plugin—it does not update the state of the switch in the app well.

ohad-e commented 2 months ago

@cubi1337, can you take a look, please?

MaDDeePee commented 1 month ago

+1 need a fix :(

cubi1337 commented 1 month ago

You seem to be the only one with the problem. So it probably depends on your Shelly system landscape. i log all actions in the Log. Please Check …..

ohad-e commented 1 month ago

@cubi1337, please look @MaDDeePee wrote that this happened to him too. Is this a result of the authentication? As you asked, I checked the log, and it looks good! Look the same as control that successes. Would it be feasible to implement a service that automatically updates the plug's state whenever the user interacts with it, such as when the plugin is launched? Many thanks!

MaDDeePee commented 1 month ago

Well, for me its no issue as long as i don't press physical buttons. Opening with "software" is ok. As soon as i press up or down at the wall status stops working until reboot, its "spinning" at "closing" all the time :(

Edit: No, i don't use Auth connecting to my shells. Tested several stuff (static IP, energy saving mode off...), don't get it working. I need to replace 7 more 2.5 they stop working after 2 years one by one :(

ohad-e commented 1 month ago

It is also when I don’t use the physical buttons. Can you also check if the HOME app work again after the change of the physical switch?

Thanks!

On Sun, 29 Sep 2024 at 13:07 MaDDeePee @.***> wrote:

Well, for me its no issue as long as i don't press physical buttons. Opening with "software" is ok. As soon as i press up or down at the wall status stops working until reboot, its "spinning" at "closing" all the time :(

— Reply to this email directly, view it on GitHub https://github.com/alexryd/homebridge-shelly-ng/issues/134#issuecomment-2381294428, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLMBUVOLY3EOFQINLRAWM23ZY7GNHAVCNFSM6AAAAABOM6KRP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBRGI4TINBSHA . You are receiving this because you authored the thread.Message ID: @.***>

MaDDeePee commented 1 month ago

after using physical switch % - status doesn't update in home app anymore. Its always "closing...". Shelly app is working, though. Within apple home app its just the state that doesnt work, i can still open and close.

Also, i notice A LOT " Device disconnected (code: 1006)" and Reconnected in homekit console of THAT shelly, no idea if its related to this.

MaDDeePee commented 1 month ago

Ok,

i tried both DS9 and PP fork, same result. Pressing Wallswitch doesn't update cover position and stucks in endless loop "closing" (need to restart Homebridge to make it show up right again). @alexryd @cubi1337 could you look into the code? something is bugged with shelly 2pm cover positioning feedback while triggering physical wallswitches. Help much appreciated <3

apartmedia commented 1 month ago

So here are at two totally different devices involved although the title states it‘s all about the plug. @MaDDeePee talks about the Plus 2PM. That could be a bit confusing for others joining this discussion… Might be a good idea to update the title…

apartmedia commented 1 month ago

Here is a print screen of the shelly settings: image

What type of physical switch are you using? Is it a flip switch or momentary button? From what you described so far it looks like you are using a regular flip switch. Does it change anything updating your Shelly configuration to Toggle instead of Edge?

ohad-e commented 1 month ago

I have the same issue with the cover's position, but it isn't essential because it works from the HOME app even when the position isn't correct. There is an issue with the callback from the Shelly devices. For some unknown reason, they didn't report the positions of the switches or covers. The solution is maybe to be more active and collect this manually every few minutes (or fix the bug).

cubi1337 commented 1 month ago

The potential code location is not my code.

For me, my plugin is all about keeping the whole thing alive. Alex doesn't seem to be doing anything about this anymore. If anyone provides a fix I will include it.

MaxiHuHe04 commented 1 month ago

Could you check whether there are any "Switch Status(...): on/off" messages in your Homebridge log?

ohad-e commented 1 month ago

yes, it looks to work correctly. As I mentioned, the plugin sent the command, but nothing happened because the switch's state didn't update. Is it hard to create a virtual switch that updates the switch states instead of restarting the bridge anytime?

ohad-e commented 1 month ago

Moreover, after 5 days without any activity, none of the plugs worked through the HOME app. Could it be a cash problem?