Fix netatmo with python 3.11 (#88093)

This commit is contained in:
J. Nick Koston 2023-02-15 07:02:33 -06:00 committed by GitHub
parent b21bf8763e
commit 6f38bc274a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -92,9 +92,11 @@ class NetatmoBase(Entity):
@property
def device_info(self) -> DeviceInfo:
"""Return the device info for the sensor."""
manufacturer, model = DEVICE_DESCRIPTION_MAP[
getattr(NetatmoDeviceType, self._model)
]
if "." in self._model:
netatmo_device = NetatmoDeviceType(self._model.partition(".")[2])
else:
netatmo_device = getattr(NetatmoDeviceType, self._model)
manufacturer, model = DEVICE_DESCRIPTION_MAP[netatmo_device]
return DeviceInfo(
configuration_url=self._config_url,
identifiers={(DOMAIN, self._id)},

View file

@ -368,7 +368,7 @@ async def test_service_set_camera_light_invalid_type(
await hass.async_block_till_done()
mock_set_state.assert_not_called()
assert excinfo.value.args == ("NACamera <Hall> does not have a floodlight",)
assert "NACamera <Hall> does not have a floodlight" in excinfo.value.args[0]
async def test_camera_reconnect_webhook(hass: HomeAssistant, config_entry) -> None: