StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
616 stars 111 forks source link

[BUG] "Platform shelly does not generate unique IDs", for renamed entities #725

Open LordMike opened 1 year ago

LordMike commented 1 year ago

See also #307, although that is from 2020.

Environment

Describe the bug

I moved from the integrated Shelly integration to S4H, as I read about the CoAP support and found that S4H presented more effects :). But since moving, after which all my ~12 light bulbs appeared immediately in HA, I'm having a bit of trouble. This issue is about the logs I'm seeing.

I've enabled debug logging for the component using the below service call, but not more logs appear, so I'm unsure why S4H thinks it's discovered a new device. My best bet is that it calculates an entity id, and then tests if it exists - which in my case it might not, since I renamed the entity id's.

# Increase S4H log level
service: logger.set_level
data:
  homeassistant.components.shelly: debug

Steps to Reproduce

  1. Discover new devices automatically w/ S4H
  2. Rename all devices, which also renames the entities within
  3. Rename entities, I only renamed the light entity to fit my naming scheme
  4. Observe that each 90 seconds (I assume discovery interval), that the below logs appear.

Expected behavior

Discovery should not re-create entities that already exist.

Traceback/Error logs

2022-10-31 17:39:07.826 ERROR (MainThread) [homeassistant.components.light] Platform shelly does not generate unique IDs. ID shelly_SHCB-1_98CDAC1E03C1 is already used by light.light_41_4 - ignoring light.shelly_shcb_1_98cdac1e03c1
2022-10-31 17:39:07.856 ERROR (MainThread) [homeassistant.components.light] Platform shelly does not generate unique IDs. ID shelly_SHCB-1_98CDAC1EA999 is already used by light.light_41_5 - ignoring light.shelly_shcb_1_98cdac1ea999
2022-10-31 17:39:07.860 ERROR (MainThread) [homeassistant.components.light] Platform shelly does not generate unique IDs. ID shelly_SHCB-1_98CDAC1F9266 is already used by light.light_43_2 - ignoring light.shelly_shcb_1_98cdac1f9266
2022-10-31 17:39:07.863 ERROR (MainThread) [homeassistant.components.light] Platform shelly does not generate unique IDs. ID shelly_SHCB-1_98CDAC1F61C7 is already used by light.light_43_3 - ignoring light.shelly_shcb_1_98cdac1f61c7
2022-10-31 17:39:07.867 ERROR (MainThread) [homeassistant.components.light] Platform shelly does not generate unique IDs. ID shelly_SHCB-1_98CDAC1ED599 is already used by light.light_41_2 - ignoring light.shelly_shcb_1_98cdac1ed599
2022-10-31 17:39:07.870 ERROR (MainThread) [homeassistant.components.light] Platform shelly does not generate unique IDs. ID shelly_SHCB-1_98CDAC1EC892 is already used by light.light_1_5 - ignoring light.shelly_shcb_1_98cdac1ec892
2022-10-31 17:39:07.873 ERROR (MainThread) [homeassistant.components.light] Platform shelly does not generate unique IDs. ID shelly_SHCB-1_98CDAC1EFB62 is already used by light.light_41_3 - ignoring light.shelly_shcb_1_98cdac1efb62
2022-10-31 17:39:07.877 ERROR (MainThread) [homeassistant.components.light] Platform shelly does not generate unique IDs. ID shelly_SHCB-1_98CDAC1E03CB is already used by light.light_44_2 - ignoring light.shelly_shcb_1_98cdac1e03cb
2022-10-31 17:39:07.915 ERROR (MainThread) [homeassistant.components.light] Platform shelly does not generate unique IDs. ID shelly_SHCB-1_98CDAC1F6AC7 is already used by light.light_41_1 - ignoring light.shelly_shcb_1_98cdac1f6ac7

Additional context

snicktc commented 1 year ago

I have the same problem

miaosun commented 1 year ago

Any update on this? I have the exact same problem

robleedotinfo commented 1 year ago

Me too, this seems to be causing loss of signalling between devices and HA as well. I switch a switch and it immediately switches in the opposite direction

TheDelta commented 1 year ago

I had to keep everything untouched (no rename) or my Shelly 3EM wouldn't work properly.

TheDK commented 1 year ago

I am seeing the same thing for one Shelly Pro4 PM - it was not renamend, I re-added it (no change), and aside from the log entries after start-up it works fine.

knewg commented 1 year ago

This also happens to me

r100gs commented 1 year ago

I have the same

Source: helpers/entity_platform.py:540
Integration: Sensor (documentation, issues)
First occurred: 03:40:50 (56049 occurrences)
Last logged: 10:31:52

Platform shelly does not generate unique IDs. ID shelly_shplg_s_b86412_cloud_status is already used by sensor.shelly_shplg_s_b86412_cloud_status - ignoring sensor.shelly_shplg_s_b86412_cloud_status
Platform shelly does not generate unique IDs. ID shelly_shsw_pm_765be1_cloud_status is already used by sensor.shelly_shsw_pm_765be1_cloud_status - ignoring sensor.shelly_shsw_pm_765be1_cloud_status
Platform shelly does not generate unique IDs. ID shelly_shsw_pm_76d8f1_cloud_status is already used by sensor.shelly_shsw_pm_76d8f1_cloud_status - ignoring sensor.shelly_shsw_pm_76d8f1_cloud_status
Platform shelly does not generate unique IDs. ID shelly_shsw_25_ba8487_cloud_status is already used by sensor.shelly_shsw_25_ba8487_cloud_status - ignoring sensor.shelly_shsw_25_ba8487_cloud_status
Platform shelly does not generate unique IDs. ID shelly_shplg_s_7a3031_cloud_status is already used by sensor.shelly_shplg_s_7a3031_cloud_status - ignoring sensor.shelly_shplg_s_7a3031_cloud_status
martgo21 commented 1 year ago

I had the same issue. The problem for me was the already existing HACS Shelly integration. Solution to fix the problem for me was the following (please create a backup before doing this):

  1. Remove native HA Shelly Integration
  2. Remove HACS Shelly Integration
  3. Remove all existing Shelly configurations in config.yaml, scripts, etc.
  4. Restart HA
  5. Add native HA Shelly Integration for each device

Now I have all my devices available and working :-)

TracyP commented 10 months ago

I have this issue too

LupoCri commented 9 months ago

Same still here.

:(