From c6c9d235303a21c1c533c52772f530fd9fb86bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 20 Aug 2023 23:09:36 +0300 Subject: [PATCH 1/3] Remove no longer used nest binary sensor (#98714) --- homeassistant/components/nest/binary_sensor.py | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 homeassistant/components/nest/binary_sensor.py diff --git a/homeassistant/components/nest/binary_sensor.py b/homeassistant/components/nest/binary_sensor.py deleted file mode 100644 index 6d9331744ef..00000000000 --- a/homeassistant/components/nest/binary_sensor.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Support for Nest binary sensors that dispatches between API versions.""" - -from homeassistant.config_entries import ConfigEntry -from homeassistant.core import HomeAssistant -from homeassistant.helpers.entity_platform import AddEntitiesCallback - -from .const import DATA_SDM -from .legacy.binary_sensor import async_setup_legacy_entry - - -async def async_setup_entry( - hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback -) -> None: - """Set up the binary sensors.""" - assert DATA_SDM not in entry.data - await async_setup_legacy_entry(hass, entry, async_add_entities) From 53b596101bb41dadb518bad2083683aa8a018f70 Mon Sep 17 00:00:00 2001 From: tronikos Date: Sun, 20 Aug 2023 13:29:16 -0700 Subject: [PATCH 2/3] Bump opower to 0.0.31 (#98716) --- homeassistant/components/opower/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/opower/manifest.json b/homeassistant/components/opower/manifest.json index 58d642ef9a1..aff1ad2f599 100644 --- a/homeassistant/components/opower/manifest.json +++ b/homeassistant/components/opower/manifest.json @@ -7,5 +7,5 @@ "documentation": "https://www.home-assistant.io/integrations/opower", "iot_class": "cloud_polling", "loggers": ["opower"], - "requirements": ["opower==0.0.30"] + "requirements": ["opower==0.0.31"] } diff --git a/requirements_all.txt b/requirements_all.txt index ccd6fff254a..f0a8d957c34 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1368,7 +1368,7 @@ openwrt-luci-rpc==1.1.16 openwrt-ubus-rpc==0.0.2 # homeassistant.components.opower -opower==0.0.30 +opower==0.0.31 # homeassistant.components.oralb oralb-ble==0.17.6 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index ee6a47b2405..17f2e3f88e9 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1034,7 +1034,7 @@ openerz-api==0.2.0 openhomedevice==2.2.0 # homeassistant.components.opower -opower==0.0.30 +opower==0.0.31 # homeassistant.components.oralb oralb-ble==0.17.6 From a29e4a5f02074813f5f3a1bf2ba60f6a7ff23665 Mon Sep 17 00:00:00 2001 From: G Johansson Date: Sun, 20 Aug 2023 22:30:43 +0200 Subject: [PATCH 3/3] Move Workday failures to __init__ (#98651) Workday failures in init --- homeassistant/components/workday/__init__.py | 15 ++++++++++++++- homeassistant/components/workday/binary_sensor.py | 8 -------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/workday/__init__.py b/homeassistant/components/workday/__init__.py index d1ad8456bab..d8d31451567 100644 --- a/homeassistant/components/workday/__init__.py +++ b/homeassistant/components/workday/__init__.py @@ -1,15 +1,28 @@ """Sensor to indicate whether the current day is a workday.""" from __future__ import annotations +from holidays import list_supported_countries + from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant +from homeassistant.exceptions import ConfigEntryError -from .const import PLATFORMS +from .const import CONF_COUNTRY, CONF_PROVINCE, LOGGER, PLATFORMS async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Workday from a config entry.""" + country: str = entry.options[CONF_COUNTRY] + province: str | None = entry.options.get(CONF_PROVINCE) + if country and country not in list_supported_countries(): + LOGGER.error("There is no country %s", country) + raise ConfigEntryError("Selected country is not valid") + + if province and province not in list_supported_countries()[country]: + LOGGER.error("There is no subdivision %s in country %s", province, country) + raise ConfigEntryError("Selected province is not valid") + entry.async_on_unload(entry.add_update_listener(async_update_listener)) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) diff --git a/homeassistant/components/workday/binary_sensor.py b/homeassistant/components/workday/binary_sensor.py index 4c383543125..6b6dfbffa5d 100644 --- a/homeassistant/components/workday/binary_sensor.py +++ b/homeassistant/components/workday/binary_sensor.py @@ -129,14 +129,6 @@ async def async_setup_entry( workdays: list[str] = entry.options[CONF_WORKDAYS] year: int = (dt_util.now() + timedelta(days=days_offset)).year - if country and country not in list_supported_countries(): - LOGGER.error("There is no country %s", country) - return - - if province and province not in list_supported_countries()[country]: - LOGGER.error("There is no subdivision %s in country %s", province, country) - return - obj_holidays: HolidayBase = country_holidays(country, subdiv=province, years=year) # Add custom holidays