diff --git a/homeassistant/components/postnl/manifest.json b/homeassistant/components/postnl/manifest.json index d07f9746ee8..c45eea0610d 100644 --- a/homeassistant/components/postnl/manifest.json +++ b/homeassistant/components/postnl/manifest.json @@ -3,7 +3,7 @@ "name": "Postnl", "documentation": "https://www.home-assistant.io/integrations/postnl", "requirements": [ - "postnl_api==1.0.2" + "postnl_api==1.2.2" ], "dependencies": [], "codeowners": [] diff --git a/homeassistant/components/postnl/sensor.py b/homeassistant/components/postnl/sensor.py index cd190c09d87..6155f58519a 100644 --- a/homeassistant/components/postnl/sensor.py +++ b/homeassistant/components/postnl/sensor.py @@ -58,7 +58,7 @@ class PostNLSensor(Entity): def __init__(self, api, name): """Initialize the PostNL sensor.""" self._name = name - self._attributes = {ATTR_ATTRIBUTION: ATTRIBUTION} + self._attributes = {ATTR_ATTRIBUTION: ATTRIBUTION, "shipments": []} self._state = None self._api = api @@ -90,6 +90,11 @@ class PostNLSensor(Entity): @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): """Update device state.""" - shipments = self._api.get_relevant_shipments() - self._attributes["shipments"] = shipments + shipments = self._api.get_relevant_deliveries() + + self._attributes["shipments"] = [] + + for shipment in shipments: + self._attributes["shipments"].append(vars(shipment)) + self._state = len(shipments) diff --git a/requirements_all.txt b/requirements_all.txt index 4e95af20556..ac41e7b1e46 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -999,7 +999,7 @@ pmsensor==0.4 pocketcasts==0.1 # homeassistant.components.postnl -postnl_api==1.0.2 +postnl_api==1.2.2 # homeassistant.components.reddit praw==6.4.0