Skip to content

Commit

Permalink
Merge pull request #170 from tykeal/fix_startup
Browse files Browse the repository at this point in the history
Fix: Use entry_id in device setup
  • Loading branch information
tykeal authored Sep 7, 2023
2 parents 14f4951 + 2b9449c commit 1a42c06
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions custom_components/rental_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if DOMAIN not in hass.data:
hass.data[DOMAIN] = {}
hass.data[DOMAIN][entry.unique_id] = RentalControl(
hass=hass, config=config, unique_id=entry.unique_id
hass=hass, config=config, unique_id=entry.unique_id, entry_id=entry.entry_id
)

for component in PLATFORMS:
Expand Down Expand Up @@ -306,11 +306,12 @@ class RentalControl:

# pylint: disable=too-many-instance-attributes

def __init__(self, hass, config, unique_id):
def __init__(self, hass, config, unique_id, entry_id):
"""Set up a calendar object."""
self.hass = hass
self._name = config.get(CONF_NAME)
self._unique_id = unique_id
self._entry_id = entry_id
self.event_prefix = config.get(CONF_EVENT_PREFIX)
self.url = config.get(CONF_URL)
# Early versions did not have these variables, as such it may not be
Expand Down Expand Up @@ -365,7 +366,7 @@ def __init__(self, hass, config, unique_id):
# setup device
device_registry = dr.async_get(hass)
device_registry.async_get_or_create(
config_entry_id=self.unique_id,
config_entry_id=self._entry_id,
identifiers={(DOMAIN, self.unique_id)},
name=self.name,
sw_version=self.version,
Expand Down

0 comments on commit 1a42c06

Please sign in to comment.