diff --git a/homeassistant/components/bond/fan.py b/homeassistant/components/bond/fan.py index 1512cf7b2b4..bc6235cb219 100644 --- a/homeassistant/components/bond/fan.py +++ b/homeassistant/components/bond/fan.py @@ -153,7 +153,7 @@ class BondFan(BondEntity, FanEntity): except ClientResponseError as ex: raise HomeAssistantError( "The bond API returned an error calling set_power_state_belief for" - f" {self.entity_id}. Code: {ex.code} Message: {ex.message}" + f" {self.entity_id}. Code: {ex.status} Message: {ex.message}" ) from ex async def async_set_speed_belief(self, speed: int) -> None: diff --git a/homeassistant/components/bond/light.py b/homeassistant/components/bond/light.py index 2380321cc4c..c5816153c8d 100644 --- a/homeassistant/components/bond/light.py +++ b/homeassistant/components/bond/light.py @@ -138,7 +138,7 @@ class BondBaseLight(BondEntity, LightEntity): except ClientResponseError as ex: raise HomeAssistantError( "The bond API returned an error calling set_brightness_belief for" - f" {self.entity_id}. Code: {ex.code} Message: {ex.message}" + f" {self.entity_id}. Code: {ex.status} Message: {ex.message}" ) from ex async def async_set_power_belief(self, power_state: bool) -> None: @@ -150,7 +150,7 @@ class BondBaseLight(BondEntity, LightEntity): except ClientResponseError as ex: raise HomeAssistantError( "The bond API returned an error calling set_light_state_belief for" - f" {self.entity_id}. Code: {ex.code} Message: {ex.message}" + f" {self.entity_id}. Code: {ex.status} Message: {ex.message}" ) from ex @@ -313,7 +313,7 @@ class BondFireplace(BondEntity, LightEntity): except ClientResponseError as ex: raise HomeAssistantError( "The bond API returned an error calling set_brightness_belief for" - f" {self.entity_id}. Code: {ex.code} Message: {ex.message}" + f" {self.entity_id}. Code: {ex.status} Message: {ex.message}" ) from ex async def async_set_power_belief(self, power_state: bool) -> None: @@ -325,5 +325,5 @@ class BondFireplace(BondEntity, LightEntity): except ClientResponseError as ex: raise HomeAssistantError( "The bond API returned an error calling set_power_state_belief for" - f" {self.entity_id}. Code: {ex.code} Message: {ex.message}" + f" {self.entity_id}. Code: {ex.status} Message: {ex.message}" ) from ex diff --git a/homeassistant/components/bond/switch.py b/homeassistant/components/bond/switch.py index c0ff6368e5a..887532defd1 100644 --- a/homeassistant/components/bond/switch.py +++ b/homeassistant/components/bond/switch.py @@ -65,5 +65,5 @@ class BondSwitch(BondEntity, SwitchEntity): except ClientResponseError as ex: raise HomeAssistantError( "The bond API returned an error calling set_power_state_belief for" - f" {self.entity_id}. Code: {ex.code} Message: {ex.message}" + f" {self.entity_id}. Code: {ex.status} Message: {ex.message}" ) from ex diff --git a/homeassistant/components/netatmo/__init__.py b/homeassistant/components/netatmo/__init__.py index 42c48ff9751..f575f227753 100644 --- a/homeassistant/components/netatmo/__init__.py +++ b/homeassistant/components/netatmo/__init__.py @@ -149,8 +149,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: try: await session.async_ensure_token_valid() except aiohttp.ClientResponseError as ex: - _LOGGER.debug("API error: %s (%s)", ex.code, ex.message) - if ex.code in ( + _LOGGER.debug("API error: %s (%s)", ex.status, ex.message) + if ex.status in ( HTTPStatus.BAD_REQUEST, HTTPStatus.UNAUTHORIZED, HTTPStatus.FORBIDDEN, diff --git a/tests/components/bond/common.py b/tests/components/bond/common.py index 9b2e82abc84..6fbcb928b5a 100644 --- a/tests/components/bond/common.py +++ b/tests/components/bond/common.py @@ -220,7 +220,7 @@ def patch_bond_action_returns_clientresponseerror(): return patch( "homeassistant.components.bond.Bond.action", side_effect=ClientResponseError( - request_info=None, history=None, code=405, message="Method Not Allowed" + request_info=None, history=None, status=405, message="Method Not Allowed" ), ) diff --git a/tests/components/netatmo/test_init.py b/tests/components/netatmo/test_init.py index f4d24e87b91..c6146dca339 100644 --- a/tests/components/netatmo/test_init.py +++ b/tests/components/netatmo/test_init.py @@ -415,7 +415,7 @@ async def test_setup_component_invalid_token(hass: HomeAssistant, config_entry) headers={}, real_url="http://example.com", ), - code=400, + status=400, history=(), )