mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Fix NMBS IndexError (#89698)
This commit is contained in:
parent
35c02ddc81
commit
cb74b934dc
@ -162,7 +162,11 @@ class NMBSLiveBoard(SensorEntity):
|
||||
"""Set the state equal to the next departure."""
|
||||
liveboard = self._api_client.get_liveboard(self._station)
|
||||
|
||||
if liveboard is None or not liveboard.get("departures"):
|
||||
if (
|
||||
liveboard is None
|
||||
or not liveboard.get("departures")
|
||||
or liveboard.get("number") == "0"
|
||||
):
|
||||
return
|
||||
|
||||
next_departure = liveboard["departures"]["departure"][0]
|
||||
|
Loading…
x
Reference in New Issue
Block a user