Fix IQVIA failing to start if any API call fails (#50615)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
960ed13f94
commit
9c5f1b4406
2 changed files with 13 additions and 4 deletions
|
@ -104,9 +104,12 @@ class ForecastSensor(IQVIAEntity):
|
|||
@callback
|
||||
def update_from_latest_data(self):
|
||||
"""Update the sensor."""
|
||||
data = self.coordinator.data.get("Location")
|
||||
if not self.coordinator.data:
|
||||
return
|
||||
|
||||
if not data or not data.get("periods"):
|
||||
data = self.coordinator.data.get("Location", {})
|
||||
|
||||
if not data.get("periods"):
|
||||
return
|
||||
|
||||
indices = [p["Index"] for p in data["periods"]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue