Handle json decode exception in co2signal (#100857)
* Handle json decode exception in co2signal * Update homeassistant/components/co2signal/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Fix import --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
ea1108503d
commit
b9a3863645
2 changed files with 28 additions and 0 deletions
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||
|
||||
from collections.abc import Mapping
|
||||
from datetime import timedelta
|
||||
from json import JSONDecodeError
|
||||
import logging
|
||||
from typing import Any, cast
|
||||
|
||||
|
@ -68,6 +69,10 @@ def get_data(hass: HomeAssistant, config: Mapping[str, Any]) -> CO2SignalRespons
|
|||
wait=False,
|
||||
)
|
||||
|
||||
except JSONDecodeError as err:
|
||||
# raise occasional occurring json decoding errors as CO2Error so the data update coordinator retries it
|
||||
raise CO2Error from err
|
||||
|
||||
except ValueError as err:
|
||||
err_str = str(err)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue