Add missing type hint in zestimate (#145218)

This commit is contained in:
epenet 2025-05-19 14:55:48 +02:00 committed by GitHub
parent f6a0d630c3
commit 7c5090d627
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,13 +107,13 @@ class ZestimateDataSensor(SensorEntity):
attributes["address"] = self.address attributes["address"] = self.address
return attributes return attributes
def update(self): def update(self) -> None:
"""Get the latest data and update the states.""" """Get the latest data and update the states."""
try: try:
response = requests.get(_RESOURCE, params=self.params, timeout=5) response = requests.get(_RESOURCE, params=self.params, timeout=5)
data = response.content.decode("utf-8") data = response.content.decode("utf-8")
data_dict = xmltodict.parse(data).get(ZESTIMATE) data_dict = xmltodict.parse(data)[ZESTIMATE]
error_code = int(data_dict["message"]["code"]) error_code = int(data_dict["message"]["code"])
if error_code != 0: if error_code != 0:
_LOGGER.error("The API returned: %s", data_dict["message"]["text"]) _LOGGER.error("The API returned: %s", data_dict["message"]["text"])