From 7471bf36e3f13f3da34cd7492d448ffb8c55ae37 Mon Sep 17 00:00:00 2001 From: Nate Harris Date: Mon, 14 Dec 2020 20:10:10 -0700 Subject: [PATCH] Use new PocketCast dependency (#44007) * New PocketCast dependency * Switch to new pycketcast dependency * Update manifest.json * Alphabetized new dependency --- homeassistant/components/pocketcasts/manifest.json | 2 +- homeassistant/components/pocketcasts/sensor.py | 8 ++++---- requirements_all.txt | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/pocketcasts/manifest.json b/homeassistant/components/pocketcasts/manifest.json index 41b46ae5cb8..ad95609bd9f 100644 --- a/homeassistant/components/pocketcasts/manifest.json +++ b/homeassistant/components/pocketcasts/manifest.json @@ -2,6 +2,6 @@ "domain": "pocketcasts", "name": "Pocket Casts", "documentation": "https://www.home-assistant.io/integrations/pocketcasts", - "requirements": ["pocketcasts==0.1"], + "requirements": ["pycketcasts==1.0.0"], "codeowners": [] } diff --git a/homeassistant/components/pocketcasts/sensor.py b/homeassistant/components/pocketcasts/sensor.py index 05a8f96bda7..19f7e265438 100644 --- a/homeassistant/components/pocketcasts/sensor.py +++ b/homeassistant/components/pocketcasts/sensor.py @@ -2,7 +2,7 @@ from datetime import timedelta import logging -import pocketcasts +from pycketcasts import pocketcasts import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA @@ -29,8 +29,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None): password = config.get(CONF_PASSWORD) try: - api = pocketcasts.Api(username, password) - _LOGGER.debug("Found %d podcasts", len(api.my_podcasts())) + api = pocketcasts.PocketCast(email=username, password=password) + _LOGGER.debug("Found %d podcasts", len(api.subscriptions)) add_entities([PocketCastsSensor(api)], True) except OSError as err: _LOGGER.error("Connection to server failed: %s", err) @@ -63,7 +63,7 @@ class PocketCastsSensor(Entity): def update(self): """Update sensor values.""" try: - self._state = len(self._api.new_episodes_released()) + self._state = len(self._api.new_releases) _LOGGER.debug("Found %d new episodes", self._state) except OSError as err: _LOGGER.warning("Failed to contact server: %s", err) diff --git a/requirements_all.txt b/requirements_all.txt index 36fab4e430e..800204a2d04 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1149,9 +1149,6 @@ plumlightpad==0.0.11 # homeassistant.components.serial_pm pmsensor==0.4 -# homeassistant.components.pocketcasts -pocketcasts==0.1 - # homeassistant.components.poolsense poolsense==0.0.8 @@ -1309,6 +1306,9 @@ pychannels==1.0.0 # homeassistant.components.cast pychromecast==7.5.1 +# homeassistant.components.pocketcasts +pycketcasts==1.0.0 + # homeassistant.components.cmus pycmus==0.1.1