Skip to content

Commit

Permalink
Merge pull request #144 from vincentwolsink/fix_entity_naming
Browse files Browse the repository at this point in the history
Fix entity naming (make sure to always include device name)
  • Loading branch information
vincentwolsink authored Aug 22, 2024
2 parents 235ff83 + 1f5b44a commit 9f06e51
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 9f06e51

Please sign in to comment.