Skip to content

Commit

Permalink
Merge pull request #40 from koenhendriks/31-when-removing-the-integra…
Browse files Browse the repository at this point in the history
…tion-device-and-entity-registry-remain

Add hub_id as prefix for entity identifier.
  • Loading branch information
koenhendriks authored Jan 24, 2024
2 parents 163d161 + 7f40dac commit 748395b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions custom_components/button_plus/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def device_info(self):
device_info["name"] = f"BAR Module {self._connector.connector_id}"
device_info["connections"] = {("bar_module", self._connector.connector_id)}
device_info["model"] = "BAR Module"
device_info["identifiers"] = {(DOMAIN, f'{self._btn_id}_bar_module_{self._connector.connector_id}')}
device_info["identifiers"] = {(DOMAIN, f'{self._hub.hub_id}_{self._btn_id}_bar_module_{self._connector.connector_id}')}
case 2:
device_info["name"] = f"Display Module"
device_info["connections"] = {("display_module", 1)}
device_info["model"] = "Display Module"
device_info["identifiers"] = {(DOMAIN, f'{self._btn_id}_display_module')}
device_info["identifiers"] = {(DOMAIN, f'{self._hub.hub_id}_{self._btn_id}_display_module')}

return device_info

Expand Down
2 changes: 1 addition & 1 deletion custom_components/button_plus/buttonplushub.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, hass: HomeAssistant, config: DeviceConfiguration, entry: Conf
_LOGGER.debug(f"New hub with config {config.core}")
self._hass = hass
self.config = config
self._name = config.core.name
self._name = config.info.device_id
self._id = self.config.info.device_id
self._client = LocalApiClient(config.info.ip_address, aiohttp_client.async_get_clientsession(hass))
self.online = True
Expand Down
4 changes: 2 additions & 2 deletions custom_components/button_plus/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ def device_info(self):
device_info["name"] = f"BAR Module {self._connector.connector_id}"
device_info["connections"] = {("bar_module", self._connector.connector_id)}
device_info["model"] = "BAR Module"
device_info["identifiers"] = {(DOMAIN, f'{self._btn_id}_bar_module_{self._connector.connector_id}')}
device_info["identifiers"] = {(DOMAIN, f'{self._hub.hub_id}_{self._btn_id}_bar_module_{self._connector.connector_id}')}
case 2:
device_info["name"] = f"Display Module"
device_info["connections"] = {("display_module", 1)}
device_info["model"] = "Display Module"
device_info["identifiers"] = {(DOMAIN, f'{self._btn_id}_display_module')}
device_info["identifiers"] = {(DOMAIN, f'{self._hub.hub_id}_{self._btn_id}_display_module')}

return device_info

Expand Down
4 changes: 2 additions & 2 deletions custom_components/button_plus/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ def device_info(self):
device_info["name"] = f"BAR Module {self._connector.connector_id}"
device_info["connections"] = {("bar_module", self._connector.connector_id)}
device_info["model"] = "BAR Module"
device_info["identifiers"] = {(DOMAIN, f'{self._btn_id}_bar_module_{self._connector.connector_id}')}
device_info["identifiers"] = {(DOMAIN, f'{self._hub.hub_id}_{self._btn_id}_bar_module_{self._connector.connector_id}')}
case 2:
device_info["name"] = f"Display Module"
device_info["connections"] = {("display_module", 1)}
device_info["model"] = "Display Module"
device_info["identifiers"] = {(DOMAIN, f'{self._btn_id}_display_module')}
device_info["identifiers"] = {(DOMAIN, f'{self._hub.hub_id}_{self._btn_id}_display_module')}

return device_info

Expand Down
4 changes: 2 additions & 2 deletions custom_components/button_plus/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ def device_info(self):
device_info["name"] = f"BAR Module {self._connector.connector_id}"
device_info["connections"] = {("bar_module", self._connector.connector_id)}
device_info["model"] = "BAR Module"
device_info["identifiers"] = {(DOMAIN, f'{self._btn_id}_bar_module_{self._connector.connector_id}')}
device_info["identifiers"] = {(DOMAIN, f'{self._hub.hub_id}_{self._btn_id}_bar_module_{self._connector.connector_id}')}
case 2:
device_info["name"] = f"Display Module"
device_info["connections"] = {("display_module", 1)}
device_info["model"] = "Display Module"
device_info["identifiers"] = {(DOMAIN, f'{self._btn_id}_display_module')}
device_info["identifiers"] = {(DOMAIN, f'{self._hub.hub_id}_{self._btn_id}_display_module')}

return device_info

Expand Down

0 comments on commit 748395b

Please sign in to comment.