Skip to content

[Bug] Duplicate unique_id errors prevent Zendure Manager from working #990

@leramleram

Description

@leramleram

Home Assistant Version

2025.11.1

Zendure Integration Version

v1.2.1

Describe the bug

Problem

Home Assistant logs show repeated errors like:
Platform zendure_ha does not generate unique IDs.
ID Hyper 2000-plugState is already used by sensor.hyper_2000_plug_state

  • ignoring sensor.Hyper 2000-plug_state

This affects sensors, binary_sensors, selects, and switches.

Root Cause

In entity.py line 43, the unique_id is generated using device.name:
self._attr_unique_id = f"{self.device.name}-{uniqueid}"

The problem is that device.name (e.g., "Hyper 2000") can produce collisions when:

  1. Entities are recreated during HA restart
  2. Multiple devices have similar names
  3. The entity_id generation (line 44) also uses device.name, causing the unique_id to match the entity registry's existing entries

Effect

  • Entities are ignored/not created
  • Sensor values don't update
  • Zendure Manager does not work - operations like setting manual power, changing modes, or controlling the device fail
  • "No devices online" warnings appear even though device is connected via MQTT
  • Integration appears completely non-functional after restart

Additional Issue: Renaming Devices

Using device.name for unique_id also causes problems when users rename their device in Zendure Cloud:

  • Renaming "Hyper 2000" → "Hyper 2000 Garden" creates new unique_ids
  • Old entities become orphaned
  • Entity history is lost
  • Automations and dashboards break

According to Home Assistant best practices, unique_ids should be:

  • Stable - not change when device is renamed
  • Unique - based on hardware ID, not user input

Solution

Use device.deviceId instead of device.name for unique_id generation:
self._attr_unique_id = f"{self.device.deviceId}-{uniqueid}"

The deviceId (e.g., "aB1cD2eF") is guaranteed to be unique per device and stable across restarts.

Affected Version

Tested with latest version from GitHub (January 2026)

I would be happy to submit a PR with this fix.

To Reproduce

  1. Install zendure_ha integration via HACS
  2. Configure the integration with your Zendure account
  3. Device entities are created (sensors, switches, selects, binary_sensors)
  4. Delete the device from Zendure Cloud (App or Web)
  5. Re-add the same device to Zendure Cloud
  6. Reload the zendure_ha integration or restart Home Assistant
  7. Check logs - duplicate unique ID errors appear:
    Platform zendure_ha does not generate unique IDs.
    ID Hyper 2000-faultLevel is already used by sensor.hyper_2000_fault_level
  8. Zendure Manager shows "No devices online" and cannot control the device

Expected Behaviour

After re-adding a device to Zendure Cloud and reloading the integration:

  • Entities should be recreated without errors
  • Unique IDs should remain stable and unique (based on deviceId, not device name)
  • Zendure Manager should recognize the device as online
  • Device control (set power, change modes) should work normally

What device are you using?

Hyper2000

Log Extracts

2026-01-04 09:58:32.581 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform zendure_ha does not generate unique IDs. ID Hyper 2000 Hütte-masterSwitch is already used by binary_sensor.hyper_2000_hutte_master_switch - ignoring binary_sensor.Hyper 2000 Hütte-master_switch
2026-01-04 09:58:32.581 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform zendure_ha does not generate unique IDs. ID Hyper 2000 Hütte-wifiState is already used by binary_sensor.hyper_2000_hutte_wifi_state - ignoring binary_sensor.Hyper 2000 Hütte-wifi_state
2026-01-04 09:58:32.581 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform zendure_ha does not generate unique IDs. ID Hyper 2000 Hütte-lowTemperature is already used by binary_sensor.hyper_2000_hutte_low_temperature - ignoring binary_sensor.Hyper 2000 Hütte-low_temperature
2026-01-04 09:58:32.581 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform zendure_ha does not generate unique IDs. ID Hyper 2000 Hütte-heatState is already used by binary_sensor.hyper_2000_hutte_heat_state - ignoring binary_sensor.Hyper 2000 Hütte-heat_state
2026-01-04 09:58:32.582 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform zendure_ha does not generate unique IDs. ID Hyper 2000 Hütte-reverseState is already used by binary_sensor.hyper_2000_hutte_reverse_state - ignoring binary_sensor.Hyper 2000 Hütte-reverse_state
2026-01-04 09:58:32.582 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform zendure_ha does not generate unique IDs. ID Hyper 2000 Hütte-localState is already used by binary_sensor.hyper_2000_hutte_local_state - ignoring binary_sensor.Hyper 2000 Hütte-local_state
2026-01-04 09:58:32.582 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform zendure_ha does not generate unique IDs. ID Hyper 2000 Hütte-ctOff is already used by binary_sensor.hyper_2000_hutte_ct_off - ignoring binary_sensor.Hyper 2000 Hütte-ct_off
2026-01-04 09:58:32.582 ERROR (MainThread) [homeassistant.components.select] Platform zendure_ha does not generate unique IDs. ID Hyper 2000 Hütte-autoHeat is already used by select.hyper_2000_hutte_auto_heat - ignoring select.Hyper 2000 Hütte-auto_heat
2026-01-04 09:58:32.583 ERROR (MainThread) [homeassistant.components.select] Platform zendure_ha does not generate unique IDs. ID Hyper 2000 Hütte-gridReverse is already used by select.hyper_2000_hutte_grid_reverse - ignoring select.Hyper 2000 Hütte-grid_reverse
2026-01-04 09:58:32.583 ERROR (MainThread) [homeassistant.components.select] Platform zendure_ha does not generate unique IDs. ID Hyper 2000 Hütte-gridOffMode is already used by select.hyper_2000_hutte_grid_off_mode - ignoring select.Hyper 2000 Hütte-grid_off_mode
2026-01-04 09:58:32.584 ERROR (MainThread) [homeassistant.components.switch] Platform zendure_ha does not generate unique IDs. ID Hyper 2000 Hütte-lampSwitch is already used by switch.hyper_2000_hutte_lamp_switch - ignoring switch.Hyper 2000 Hütte-lamp_switch

Other Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions