mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
remove PostNL component as it is no longer working (#30902)
This commit is contained in:
parent
847196dbe8
commit
196bf2f3a0
@ -539,7 +539,6 @@ omit =
|
|||||||
homeassistant/components/plum_lightpad/*
|
homeassistant/components/plum_lightpad/*
|
||||||
homeassistant/components/pocketcasts/sensor.py
|
homeassistant/components/pocketcasts/sensor.py
|
||||||
homeassistant/components/point/*
|
homeassistant/components/point/*
|
||||||
homeassistant/components/postnl/sensor.py
|
|
||||||
homeassistant/components/prezzibenzina/sensor.py
|
homeassistant/components/prezzibenzina/sensor.py
|
||||||
homeassistant/components/proliphix/climate.py
|
homeassistant/components/proliphix/climate.py
|
||||||
homeassistant/components/prometheus/*
|
homeassistant/components/prometheus/*
|
||||||
|
@ -1 +0,0 @@
|
|||||||
"""The postnl component."""
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"domain": "postnl",
|
|
||||||
"name": "PostNL",
|
|
||||||
"documentation": "https://www.home-assistant.io/integrations/postnl",
|
|
||||||
"requirements": ["postnl_api==1.2.2"],
|
|
||||||
"dependencies": [],
|
|
||||||
"codeowners": []
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
"""Sensor for PostNL packages."""
|
|
||||||
from datetime import timedelta
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from postnl_api import PostNL_API, UnauthorizedException
|
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
|
||||||
from homeassistant.const import (
|
|
||||||
ATTR_ATTRIBUTION,
|
|
||||||
CONF_NAME,
|
|
||||||
CONF_PASSWORD,
|
|
||||||
CONF_USERNAME,
|
|
||||||
)
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.util import Throttle
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
ATTRIBUTION = "Information provided by PostNL"
|
|
||||||
|
|
||||||
DEFAULT_NAME = "postnl"
|
|
||||||
|
|
||||||
ICON = "mdi:package-variant-closed"
|
|
||||||
|
|
||||||
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=30)
|
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|
||||||
{
|
|
||||||
vol.Required(CONF_USERNAME): cv.string,
|
|
||||||
vol.Required(CONF_PASSWORD): cv.string,
|
|
||||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
|
||||||
"""Set up the PostNL sensor platform."""
|
|
||||||
|
|
||||||
username = config.get(CONF_USERNAME)
|
|
||||||
password = config.get(CONF_PASSWORD)
|
|
||||||
name = config.get(CONF_NAME)
|
|
||||||
|
|
||||||
try:
|
|
||||||
api = PostNL_API(username, password)
|
|
||||||
|
|
||||||
except UnauthorizedException:
|
|
||||||
_LOGGER.exception("Can't connect to the PostNL webservice")
|
|
||||||
return
|
|
||||||
|
|
||||||
add_entities([PostNLSensor(api, name)], True)
|
|
||||||
|
|
||||||
|
|
||||||
class PostNLSensor(Entity):
|
|
||||||
"""Representation of a PostNL sensor."""
|
|
||||||
|
|
||||||
def __init__(self, api, name):
|
|
||||||
"""Initialize the PostNL sensor."""
|
|
||||||
self._name = name
|
|
||||||
self._attributes = {ATTR_ATTRIBUTION: ATTRIBUTION, "shipments": []}
|
|
||||||
self._state = None
|
|
||||||
self._api = api
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the name of the sensor."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def state(self):
|
|
||||||
"""Return the state of the sensor."""
|
|
||||||
return self._state
|
|
||||||
|
|
||||||
@property
|
|
||||||
def unit_of_measurement(self):
|
|
||||||
"""Return the unit of measurement of this entity, if any."""
|
|
||||||
return "packages"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def device_state_attributes(self):
|
|
||||||
"""Return the state attributes."""
|
|
||||||
return self._attributes
|
|
||||||
|
|
||||||
@property
|
|
||||||
def icon(self):
|
|
||||||
"""Icon to use in the frontend."""
|
|
||||||
return ICON
|
|
||||||
|
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
|
||||||
def update(self):
|
|
||||||
"""Update device state."""
|
|
||||||
shipments = self._api.get_relevant_deliveries()
|
|
||||||
|
|
||||||
self._attributes["shipments"] = []
|
|
||||||
|
|
||||||
for shipment in shipments:
|
|
||||||
self._attributes["shipments"].append(vars(shipment))
|
|
||||||
|
|
||||||
self._state = len(shipments)
|
|
@ -1021,9 +1021,6 @@ pmsensor==0.4
|
|||||||
# homeassistant.components.pocketcasts
|
# homeassistant.components.pocketcasts
|
||||||
pocketcasts==0.1
|
pocketcasts==0.1
|
||||||
|
|
||||||
# homeassistant.components.postnl
|
|
||||||
postnl_api==1.2.2
|
|
||||||
|
|
||||||
# homeassistant.components.reddit
|
# homeassistant.components.reddit
|
||||||
praw==6.5.0
|
praw==6.5.0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user