core icon indicating copy to clipboard operation
core copied to clipboard

MacAddressMismatchError when replacing a Shelly device

Open Misiu opened this issue 1 year ago • 24 comments

The problem

Yesterday one of my Shelly 2PM (Gen1) died, so I replaced it and wanted to replace it in Home Assistant. I went to Shelly integration, removed the old device and tried to add new, but I got this error:

Failed setup, will retry:
MacAddressMismatchError('Input MAC: E8DB84D21065, Shelly MAC: 244CAB43B378')

I'm also using Huawei LTE integration which has device tracker build in (sadly there is no way to disable the tracker), so I disabled the Huawei LTE and tried again, same error.

I've again removed the bad device, restarted HA, and verified that I don't have any other device with the same IP in /homeassistant/.storage/core.device_registry. I also tried searching for both MAC addresses

Similar issue :https://github.com/home-assistant/core/issues/119933 (it is closed for comments)

What version of Home Assistant Core has the issue?

core-2024.9.1

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

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

Misiu avatar Sep 12 '24 09:09 Misiu

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)

home-assistant[bot] avatar Sep 12 '24 09:09 home-assistant[bot]

Using re-configure flow to replace one device with another is not supported and likely never will be.

You must unconfigure the old device and configure the new device.

bieniu avatar Sep 12 '24 10:09 bieniu

@bieniu I replaced a physical device because the old one was broken. In Home Assistant I deleted the old device using Integrations->Shelly->Devices->Delete (in 3 dots menu on the right side of the device) Then I tried to add a new device, I've even changed the name in Shelly web interface, restarted HA a couple of times, but I still get the same error. I hope the description is clean right now.

EDIT: I didn't manually edit any files in .storage folder.

Misiu avatar Sep 12 '24 10:09 Misiu

Oh I thought you used re-configure flow to replace the device.

bieniu avatar Sep 12 '24 10:09 bieniu

Did you give the new device the same IP address as the old device?

thecode avatar Sep 12 '24 10:09 thecode

No, I didn't assign a static IP on my router for this MAC address, so it should get a different IP. I can check that after power get back. I think it's a valid use case: Your device is broken, you remove it from HA, install new one, assign the same IP and add a new device to HA.

Probably I'm not the only one with excel file contacting all my devices informations in my house :)

czw., 12 wrz 2024, 12:29 użytkownik Shay Levy @.***> napisał:

Did you give the new device the same IP address as the old device?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/125811#issuecomment-2345873680, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANJIDWUVWWI5B5RAOWN4S3ZWFUJ3AVCNFSM6AAAAABOCXXC5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBVHA3TGNRYGA . You are receiving this because you authored the thread.Message ID: @.***>

Misiu avatar Sep 12 '24 10:09 Misiu

@Misiu I asked just to understand, didn't say it is not a valid case. I just did the same two days ago. I did give it same IP & same names, but what I did was:

  1. Remove the old device from HA
  2. Configure the new device (names & IP)
  3. Add new device to HA

This work without any issues.

thecode avatar Sep 12 '24 11:09 thecode

Can you add diagnostics both for Shelly and for the device tracker?

thecode avatar Sep 12 '24 11:09 thecode

Just a quick update: I plan to add another Shelly 2PM Gen1. Another died this weekend and today after returning home I'll be able to provide full logs.

Can you add diagnostics both for Shelly and for the device tracker?

I have device tracker disabled, but I can enable it and try to add new device.

Ideally Huawei LTE should have an option to disable the device tracker, because I only need some info about transfers, but that's a different issue. I need to look at that integration and maybe I'll be able to add an option for that.

Misiu avatar Sep 16 '24 07:09 Misiu

A few weeks ago I also replaced the device with a new one and I didn't encounter any problems. I did the following:

  • deleting the old device configuration from HA
  • restarting HA
  • powering the new device and configuring it
  • configuring the device with HA

bieniu avatar Sep 16 '24 08:09 bieniu

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.

I just bought a 1 mini gen 3 and added it to HA without any problems. This specific Gen 1 device still gives me errors. I've rolled back to a couple of backups and tried adding it again, but nothing helped.

What does the error mean? MacAddressMismatchError('Input MAC: E8DB84D21065, Shelly MAC: 244CAB43B378') Maybe my router assigned same IP to a different device?

Misiu avatar Oct 03 '24 09:10 Misiu

I just bought a 1 mini gen 3 and added it to HA without any problems. This specific Gen 1 device still gives me errors. I've rolled back to a couple of backups and tried adding it again, but nothing helped.

What does the error mean? MacAddressMismatchError('Input MAC: E8DB84D21065, Shelly MAC: 244CAB43B378') Maybe my router assigned same IP to a different device?

Can you check the MAC output from http://device_ip/shelly and what is reported by the router?

thecode avatar Oct 03 '24 20:10 thecode

Hmm...this is weird When I go to the device via browser I see this in the device info: image

this is returned using http://device_ip/shelly image

this is info from the Shelly app: image

and this is from my router: image

Misiu avatar Oct 04 '24 13:10 Misiu

Did you buy this device from Shelly store? From what I know such situations occur if the device was previously flashed with non-original firmware.

bieniu avatar Oct 04 '24 16:10 bieniu

@bieniu Yes, isn't a new device that I bought directly from Shelly. It was laying a year or two, but my old Shelly 2PM (gen1) are dying one by one and I'm replacing them with those I have as spare units. Not sure what to do with it. I can create a ticket as Shelly, but not sure if they will be able to help. THe device works just fine via the web interface and in the app.

Misiu avatar Oct 04 '24 16:10 Misiu

I think you should ask Shelly support about this. The device is somehow faulty.

bieniu avatar Oct 04 '24 17:10 bieniu

Ticket created. I'll get you updated as soon as the Shelly team replies.

Misiu avatar Oct 04 '24 17:10 Misiu

Quick update: I got a reply from the Shelly Team that this is probably a provisioning issue during the manufacturing process. I'll try one more Shelly 2.5 from the same batch to check if this is a problem with a single unit or something more.

The unit works fine from the web UI and via the APP. Not sure if such strict validation is needed and maybe it can be loosened a bit.

Misiu avatar Oct 07 '24 09:10 Misiu

There isn't a software workaround for this as we need to be able to match the device somehow, and the only stable identifier we have is the MAC address.

If its provisioned incorrectly, sometimes a factory reset can fix the issue.

bdraco avatar Oct 07 '24 09:10 bdraco

@bdraco I'll try that. I get the same MAC address when I open the device info in the Shelly app and when I do request to http://device_ip/shelly, same on my router. The device id in the Web UI is different, so I think the MAC can be used. question is which one is used by aioshelly

Misiu avatar Oct 07 '24 10:10 Misiu

Did you try the factory reset?

bdraco avatar Oct 07 '24 10:10 bdraco

as I wrote in my previous message, I'll try that 🙂 but I have to get home first

Misiu avatar Oct 07 '24 10:10 Misiu

I know that some users had problems after flashing a Gen1 device with Tasmota and flashing back Shelly firmware since the MAC needs to be provisioned correctly in the image and the images used to reflash already had a MAC.

thecode avatar Oct 07 '24 16:10 thecode

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.