Skip to content

Commit

Permalink
Fix entity naming (make sure to always include device name)
Browse files Browse the repository at this point in the history
Some enitites where missing Envoy and serial in the name. This could cause issues when multiple Envoys are present.
  • Loading branch information
vincentwolsink committed Aug 22, 2024
1 parent 8013428 commit 1f5b44a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion custom_components/enphase_envoy/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ async def async_setup_entry(
coordinator.data.get("batteries") is not None
and coordinator.data.get("storage_charge_from_grid") is not None
):
entity_name = f"{name} {STORAGE_RESERVE_SOC_NUMBER.name}"
entities.append(
EnvoyStorageReservedSocEntity(
STORAGE_RESERVE_SOC_NUMBER,
STORAGE_RESERVE_SOC_NUMBER.name,
entity_name,
name,
config_entry.unique_id,
None,
Expand Down
3 changes: 2 additions & 1 deletion custom_components/enphase_envoy/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ async def async_setup_entry(
coordinator.data.get("batteries") is not None
and coordinator.data.get("storage_mode") is not None
):
entity_name = f"{name} {STORAGE_MODE_SELECT.name}"
entities.append(
EnvoyStorageModeSelectEntity(
STORAGE_MODE_SELECT,
STORAGE_MODE_SELECT.name,
entity_name,
name,
config_entry.unique_id,
None,
Expand Down
6 changes: 4 additions & 2 deletions custom_components/enphase_envoy/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ async def async_setup_entry(
coordinator.data.get("batteries") is not None
and coordinator.data.get(switch_description.key) is not None
):
entity_name = f"{name} {switch_description.name}"
entities.append(
EnvoyStorageSwitchEntity(
switch_description,
switch_description.name,
entity_name,
name,
config_entry.unique_id,
None,
Expand All @@ -44,10 +45,11 @@ async def async_setup_entry(
)
else:
if coordinator.data.get(switch_description.key) is not None:
entity_name = f"{name} {switch_description.name}"
entities.append(
EnvoySwitchEntity(
switch_description,
switch_description.name,
entity_name,
name,
config_entry.unique_id,
None,
Expand Down

0 comments on commit 1f5b44a

Please sign in to comment.