diff --git a/homeassistant/components/brunt/__init__.py b/homeassistant/components/brunt/__init__.py index 37c9fd73632..988a96ce08e 100644 --- a/homeassistant/components/brunt/__init__.py +++ b/homeassistant/components/brunt/__init__.py @@ -45,7 +45,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: try: async with async_timeout.timeout(10): things = await bapi.async_get_things(force=True) - return {thing.SERIAL: thing for thing in things} + return {thing.serial: thing for thing in things} except ServerDisconnectedError as err: raise UpdateFailed(f"Error communicating with API: {err}") from err except ClientResponseError as err: diff --git a/homeassistant/components/brunt/cover.py b/homeassistant/components/brunt/cover.py index faa4653d3be..08b7eade612 100644 --- a/homeassistant/components/brunt/cover.py +++ b/homeassistant/components/brunt/cover.py @@ -100,7 +100,7 @@ class BruntDevice(CoordinatorEntity, CoverEntity): self._remove_update_listener = None - self._attr_name = self._thing.NAME + self._attr_name = self._thing.name self._attr_device_class = CoverDeviceClass.SHADE self._attr_supported_features = COVER_FEATURES self._attr_attribution = ATTRIBUTION @@ -109,8 +109,8 @@ class BruntDevice(CoordinatorEntity, CoverEntity): name=self._attr_name, via_device=(DOMAIN, self._entry_id), manufacturer="Brunt", - sw_version=self._thing.FW_VERSION, - model=self._thing.MODEL, + sw_version=self._thing.fw_version, + model=self._thing.model, ) async def async_added_to_hass(self) -> None: @@ -127,8 +127,7 @@ class BruntDevice(CoordinatorEntity, CoverEntity): None is unknown, 0 is closed, 100 is fully open. """ - pos = self.coordinator.data[self.unique_id].currentPosition - return int(pos) if pos is not None else None + return self.coordinator.data[self.unique_id].current_position @property def request_cover_position(self) -> int | None: @@ -139,8 +138,7 @@ class BruntDevice(CoordinatorEntity, CoverEntity): to Brunt, at times there is a diff of 1 to current None is unknown, 0 is closed, 100 is fully open. """ - pos = self.coordinator.data[self.unique_id].requestPosition - return int(pos) if pos is not None else None + return self.coordinator.data[self.unique_id].request_position @property def move_state(self) -> int | None: @@ -149,8 +147,7 @@ class BruntDevice(CoordinatorEntity, CoverEntity): None is unknown, 0 when stopped, 1 when opening, 2 when closing """ - mov = self.coordinator.data[self.unique_id].moveState - return int(mov) if mov is not None else None + return self.coordinator.data[self.unique_id].move_state @property def is_opening(self) -> bool: @@ -190,11 +187,11 @@ class BruntDevice(CoordinatorEntity, CoverEntity): """Set the cover to the new position and wait for the update to be reflected.""" try: await self._bapi.async_change_request_position( - position, thingUri=self._thing.thingUri + position, thing_uri=self._thing.thing_uri ) except ClientResponseError as exc: raise HomeAssistantError( - f"Unable to reposition {self._thing.NAME}" + f"Unable to reposition {self._thing.name}" ) from exc self.coordinator.update_interval = FAST_INTERVAL await self.coordinator.async_request_refresh() @@ -204,7 +201,7 @@ class BruntDevice(CoordinatorEntity, CoverEntity): """Update the update interval after each refresh.""" if ( self.request_cover_position - == self._bapi.last_requested_positions[self._thing.thingUri] + == self._bapi.last_requested_positions[self._thing.thing_uri] and self.move_state == 0 ): self.coordinator.update_interval = REGULAR_INTERVAL diff --git a/homeassistant/components/brunt/manifest.json b/homeassistant/components/brunt/manifest.json index 7b9307e8ef2..f970419b787 100644 --- a/homeassistant/components/brunt/manifest.json +++ b/homeassistant/components/brunt/manifest.json @@ -3,7 +3,7 @@ "name": "Brunt Blind Engine", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/brunt", - "requirements": ["brunt==1.0.2"], + "requirements": ["brunt==1.1.0"], "codeowners": ["@eavanvalkenburg"], "iot_class": "cloud_polling" } diff --git a/requirements_all.txt b/requirements_all.txt index 1307dd09d74..61d329b7b0e 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -443,7 +443,7 @@ brother==1.1.0 brottsplatskartan==0.0.1 # homeassistant.components.brunt -brunt==1.0.2 +brunt==1.1.0 # homeassistant.components.bsblan bsblan==0.4.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 802e763f46c..acd093e8873 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -284,7 +284,7 @@ broadlink==0.18.0 brother==1.1.0 # homeassistant.components.brunt -brunt==1.0.2 +brunt==1.1.0 # homeassistant.components.bsblan bsblan==0.4.0