diff --git a/custom_components/econet300/api.py b/custom_components/econet300/api.py index 9ca6ec6..969cf2b 100644 --- a/custom_components/econet300/api.py +++ b/custom_components/econet300/api.py @@ -66,8 +66,9 @@ def __init__( self._session = session self._auth = BasicAuth(username, password) - def host(self): - """Set host address""" + @property + def host(self) -> str: + """Get host address""" return self._host async def set_param(self, key: str, value: str): @@ -127,18 +128,22 @@ async def create(cls, client: EconetClient, cache: MemCache): return c - def host(self): + @property + def host(self) -> str: """Get clients host address""" - return self._client.host() + return self._client.host + @property def uid(self) -> str: """Get uid""" return self._uid + @property def sw_rev(self) -> str: """Get software version""" return self._sw_revision + @property def hw_ver(self) -> str: """Get hardware version""" return self._hw_version diff --git a/custom_components/econet300/config_flow.py b/custom_components/econet300/config_flow.py index 080ff81..ba52e50 100644 --- a/custom_components/econet300/config_flow.py +++ b/custom_components/econet300/config_flow.py @@ -36,7 +36,7 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str, try: api = await make_api(hass, cache, data) - info["uid"] = api.uid() + info["uid"] = api.uid except AuthError as auth_error: raise InvalidAuth from auth_error except TimeoutError as timeout_error: diff --git a/custom_components/econet300/entity.py b/custom_components/econet300/entity.py index b2e2d87..b28995d 100644 --- a/custom_components/econet300/entity.py +++ b/custom_components/econet300/entity.py @@ -30,19 +30,19 @@ def has_entity_name(self): @property def unique_id(self) -> str | None: """Return the unique_id of the entity""" - return f"{self.api.uid()}-{self.entity_description.key}" + return f"{self.api.uid}-{self.entity_description.key}" @property def device_info(self) -> DeviceInfo | None: """Return device info of the entity""" return DeviceInfo( - identifiers={(DOMAIN, self.api.uid())}, + identifiers={(DOMAIN, self.api.uid)}, name=DEVICE_INFO_CONTROLLER_NAME, manufacturer=DEVICE_INFO_MANUFACTURER, model=DEVICE_INFO_MODEL, - configuration_url=self.api.host(), - sw_version=self.api.sw_rev(), - hw_version=self.api.hw_ver(), + configuration_url=self.api.host, + sw_version=self.api.sw_rev, + hw_version=self.api.hw_ver, ) @callback