From 2516b9474dc998c4d5ae324e63ba75fe00476556 Mon Sep 17 00:00:00 2001 From: Squixx Date: Sun, 16 Feb 2020 17:24:38 +0100 Subject: [PATCH] Update nederlandse_spoorwegen to properly handle punctuality (#31741) --- .../components/nederlandse_spoorwegen/manifest.json | 2 +- homeassistant/components/nederlandse_spoorwegen/sensor.py | 5 +++++ requirements_all.txt | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/nederlandse_spoorwegen/manifest.json b/homeassistant/components/nederlandse_spoorwegen/manifest.json index 8718843d73d..c6025abe0b5 100644 --- a/homeassistant/components/nederlandse_spoorwegen/manifest.json +++ b/homeassistant/components/nederlandse_spoorwegen/manifest.json @@ -2,7 +2,7 @@ "domain": "nederlandse_spoorwegen", "name": "Nederlandse Spoorwegen (NS)", "documentation": "https://www.home-assistant.io/integrations/nederlandse_spoorwegen", - "requirements": ["nsapi==3.0.2"], + "requirements": ["nsapi==3.0.3"], "dependencies": [], "codeowners": ["@YarmoM"] } diff --git a/homeassistant/components/nederlandse_spoorwegen/sensor.py b/homeassistant/components/nederlandse_spoorwegen/sensor.py index f4bb99399ea..45413d4a15a 100644 --- a/homeassistant/components/nederlandse_spoorwegen/sensor.py +++ b/homeassistant/components/nederlandse_spoorwegen/sensor.py @@ -142,6 +142,7 @@ class NSDepartureSensor(Entity): "arrival_platform_planned": self._trips[0].arrival_platform_planned, "arrival_platform_actual": self._trips[0].arrival_platform_actual, "next": None, + "punctuality": None, "status": self._trips[0].status.lower(), "transfers": self._trips[0].nr_transfers, "route": route, @@ -190,6 +191,10 @@ class NSDepartureSensor(Entity): ): attributes["arrival_delay"] = True + # Punctuality attributes + if self._trips[0].punctuality is not None: + attributes["punctuality"] = self._trips[0].punctuality + # Next attributes if len(self._trips) > 1: if self._trips[1].departure_time_actual is not None: diff --git a/requirements_all.txt b/requirements_all.txt index 737f377d824..88c529c4ac3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -910,7 +910,7 @@ niko-home-control==0.2.1 niluclient==0.1.2 # homeassistant.components.nederlandse_spoorwegen -nsapi==3.0.2 +nsapi==3.0.3 # homeassistant.components.nsw_fuel_station nsw-fuel-api-client==1.0.10