From cb74b934dcde99a149eb85148e9f850990ca6aa4 Mon Sep 17 00:00:00 2001 From: PatrickGlesner <34370149+PatrickGlesner@users.noreply.github.com> Date: Wed, 15 Mar 2023 18:09:39 +0100 Subject: [PATCH] Fix NMBS IndexError (#89698) --- homeassistant/components/nmbs/sensor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/nmbs/sensor.py b/homeassistant/components/nmbs/sensor.py index b9a216875f4..c3bcdb35536 100644 --- a/homeassistant/components/nmbs/sensor.py +++ b/homeassistant/components/nmbs/sensor.py @@ -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]