Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shelly 1PM Plus (Gen2) works fine, then suddenly try to connect to wrong ip address, after 15 minutes come back to correct state #117816

Closed
ufluido opened this issue May 20, 2024 · 23 comments

Comments

@ufluido
Copy link

ufluido commented May 20, 2024

The problem

I had a Shelly 1PM (Gen1) that was broken.
I replaced it with a new 1PM Plus (Gen2), same configuration, same name, same ip. After first power on I connected to its AP to set the old one 1PM ip address (192.168.1.24).
All worked fine except integration randomly try to connect to a DHCP range ip (192.168.1.236) without success, so the device go "unavailable" on Home Assistant, after 14 minutes it reconnects without reason to correct ip 192.1681.24 (static set on device).
How is it possible that integration try to connect to another ip that I never set? And why always after 14 minutes it reconnect with right ip?
Do you know the reason? How can I help you to investigate on it?
For more info:
"Visit" button on integration page always point to right ip (192.168.1.24) even when device is unavailable
Device is always connected to wifi and has a strong signal
When it is unavailable I can connect to it from shelly app/browser
WhatsApp Image 2024-05-20 at 21 10 33
WhatsApp Image 2024-05-20 at 21 10 17

What version of Home Assistant Core has the issue?

2024.5.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

shelly

Link to integration documentation on our website

https://www.home-assistant.io/integrations/shelly/

Diagnostics information

home-assistant_shelly_2024-05-20T18-34-01.746Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

Hey there @balloob, @bieniu, @thecode, @chemelli74, @bdraco, mind taking a look at this issue as it has been labeled with an integration (shelly) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of shelly can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign shelly Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


shelly documentation
shelly source
(message by IssueLinks)

@bieniu
Copy link
Member

bieniu commented May 20, 2024

Please attach diagnostics file for this device.

@ufluido
Copy link
Author

ufluido commented May 20, 2024

I have diagnostic file Just for when device is available, when it is unavailable I do not have “download diagnostic” button, is there another way to do this?
config_entry-shelly-7b8e30c3d1ca2c64d39bbba4589890fd 3.json

@thecode
Copy link
Member

thecode commented May 20, 2024

Please enable Debug for Shelly integration, restart Home Assistant core, wait 20 minutes, disable debug and attach the log.

Note: it is better to drag the log into the comment (which will add it as an attachment) and not copy paste as it is hard to read logs in GitHub.

Thanks

@ufluido
Copy link
Author

ufluido commented May 20, 2024

Please enable Debug for Shelly integration, restart Home Assistant core, wait 20 minutes, disable debug and attach the log.

Note: it is better to drag the log into the comment (which will add it as an attachment) and not copy paste as it is hard to read logs in GitHub.

Thanks

Hi thecode,
I’m doing it.
In the meanwhile, just for curiosity, Is not helpful the attached debug file? Because in that file I catched the available/unavailable moment. Now I’ waiting 20 minutes but it is not sure that device go unavailable, it is something hard for me to reproduce

@ufluido
Copy link
Author

ufluido commented May 20, 2024

Ok, now it happened again after opening shelly app!
Can I stop now debugging and attach logfile or I have to wait 20 minutes?

@thecode
Copy link
Member

thecode commented May 20, 2024

Ok, now it happened again after opening shelly app! Can I stop now debugging and attach logfile or I have to wait 20 minutes?

You can stop now, I didn't notice your log on the first post, I will look at it and try to understand but please attach the 2nd log maybe it will help. Thanks 👍

@ufluido
Copy link
Author

ufluido commented May 20, 2024

here it is, thanks for helping

home-assistant_shelly_2024-05-20T21-16-08.410Z.log

@ufluido
Copy link
Author

ufluido commented May 20, 2024

At the moment I stopped debug device was unavailable

@thecode
Copy link
Member

thecode commented May 22, 2024

From the I suspect that the device still advertises the temp address it received until you gave it a static address, I don't know why it happens, I will try to add some more logging to find out.

@thecode
Copy link
Member

thecode commented Jun 7, 2024

@ufluido Do you still experiencing this issue? Can you collect new logs if you do?

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@gitgithubber
Copy link

Unfortunately, I still have the error.
The Shelly is equipped with a fixed IP.

Core 2024.6.4
Supervisor 2024.06.2
Operating System 12.4
Frontend 20240610.1
Shelly 1 Mini Gen3

2024-06-26 08_37_13-Verlauf – Home Assistant – Mozilla Firefox

@ufluido
Copy link
Author

ufluido commented Jun 26, 2024

Hi,
I can say it is no longer an issue for now, I solved by Fritzbox!7590 side, I don't know what I've done to solve it exactly but I deleted and re-added device in fritz device list and issues was gone.

On integration side, I'm still curious about why it try to change ip? If it works with an assigned ip, why after some minutes it search for another ip?

@ufluido
Copy link
Author

ufluido commented Jun 26, 2024

Unfortunately, I still have the error. The Shelly is equipped with a fixed IP.

Core 2024.6.4 Supervisor 2024.06.2 Operating System 12.4 Frontend 20240610.1 Shelly 1 Mini Gen3

2024-06-26 08_37_13-Verlauf – Home Assistant – Mozilla Firefox

Do you have a fritzbox?
When you say device has "fixed ip", you mean you set it in shelly device or you reserved an ip on router side?

@Vedeneb
Copy link

Vedeneb commented Jun 26, 2024

Hi,
I have the same issue. I installed a new Shelly PM Mini (Gen3) and added it to HA. So far everything worked as expcected. Later I used my Fritzbox to assign a static DHCP Lease to the Shelly. The old IP was 10.10.14.120 and the new, "static" IP is 10.10.13.110. I completely removed the device from HA and added it with the new IP. The initial connection was successful and all entities were added. However after a few seconds, all entities became unavailable. On the integration page I can see that for some reason HA tries to connect to the old IP again:

image

I tried deleting and readding the integration multiple times, with and without HA restarts in between. I even searched for the old IP within the whole HA directory (including .storage) but couldn't find any reference to it. The crazy thing is that the integration even seems to replace the configured (new) IP with the old IP in the core.config_entries-registry.

So right after setup it looks like this (which is correct):
image

But after a few seconds the IP get's replaced by the old IP:
image

By the way, the same Shelly works absolutely fine in another HA instance were I added it after changing it's IP

I also tried disabling zeroconf by removing default_config and tried removing, restarting and readding -> same issue

@ufluido
Copy link
Author

ufluido commented Jun 26, 2024

Hi, I have the same issue. I installed a new Shelly PM Mini (Gen3) and added it to HA. So far everything worked as expcected. Later I used my Fritzbox to assign a static DHCP Lease to the Shelly. The old IP was 10.10.14.120 and the new, "static" IP is 10.10.13.110. I completely removed the device from HA and added it with the new IP. The initial connection was successful and all entities were added. However after a few seconds, all entities became unavailable. On the integration page I can see that for some reason HA tries to connect to the old IP again:

image

I tried deleting and readding the integration multiple times, with and without HA restarts in between. I even searched for the old IP within the whole HA directory (including .storage) but couldn't find any reference to it. The crazy thing is that the integration even seems to replace the configured (new) IP with the old IP in the core.config_entries-registry.

So right after setup it looks like this (which is correct): image

But after a few seconds the IP get's replaced by the old IP: image

By the way, the same Shelly works absolutely fine in another HA instance were I added it after changing it's IP

I also tried disabling zeroconf by removing default_config and tried removing, restarting and readding -> same issue

Same for me,
did you try to delete all reference on device list on fritzbox interface?
I think you have to work on it, not HA or Shelly.
Delete all reference and set ip static on shelly device instead of fritz webpage.

For integration side, problem is that it has to lock on working ip and don't try to search another. What is the reason?

@Vedeneb
Copy link

Vedeneb commented Jun 26, 2024

Yep, the old IP is not listed anywhere on the fritzbox UI anymore. Also, it works as expected on another HA instance so I'm not really convinced that it is a problem with the Fritzbox.

Using a static IP on the shelly is only a workaround (and I'm not even sure if it would help) and doesn't fix the actual issue. I use static DHCP leases on all other devices aswell which always worked without problems

@ufluido
Copy link
Author

ufluido commented Jun 26, 2024

Another thing you can check to see if it’s the same problem:
If you go to fritz ui, network, this Shelly settings, the fields on which you have to write the assigned ip you can actually write or they are grey and you aren’t able to change ip?

@Vedeneb
Copy link

Vedeneb commented Jun 26, 2024

It's not greyed out, I could change the IP:
image

@Vedeneb
Copy link

Vedeneb commented Jun 26, 2024

So I just restarted my Fritzbox and now everything seems to be working fine... Let's hope it stays that way!
Still I think it's a bug in the HA shelly integration because imo if I set a specific IP address during setup of the integration, it should never be overwritten with something HA "assumes" is the correct IP for whatever reason...

@thecode
Copy link
Member

thecode commented Jun 26, 2024

So I just restarted my Fritzbox and now everything seems to be working fine... Let's hope it stays that way! Still I think it's a bug in the HA shelly integration because imo if I set a specific IP address during setup of the integration, it should never be overwritten with something HA "assumes" is the correct IP for whatever reason...

We don't differentiate between an IP you manually added or an IP that was discovered automatically (using zeroconf/mDNS), this is not specific to Shelly, other core integrations works the same.

While it might help you overcome FritzBox bug, if we don't update the IP for most users it will just create problems when IP changes.

Since this is not a Shelly bug and confirmed to be fixed by rebooting the router I am closing this issue.

Thanks for reporting back @ufluido

@thecode thecode closed this as completed Jun 26, 2024
@gitgithubber
Copy link

Feedback:
It works for me now too.
The solution for me was also the FritzBox.
I have an older FritzBox with 6.x firmware.
I found the solution in the HA documentation under https://www.home-assistant.io/integrations/fritz#integration-options.
Simply activate the checkbox "Enable old discovery method" and it works without errors ... more than 13 hours.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants