mirror of
https://github.com/home-assistant/core
synced 2024-08-28 03:36:46 +02:00
Fix aiohttp code DeprecationWarnings (#97621)
This commit is contained in:
parent
02f8000f6c
commit
1a77121c02
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -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=(),
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user