mirror of
https://github.com/home-assistant/core.git
synced 2025-08-06 22:25:13 +02:00
Merge branch 'dev' into AddClimate_MideaCCM15
This commit is contained in:
@@ -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)
|
|
@@ -7,5 +7,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/opower",
|
"documentation": "https://www.home-assistant.io/integrations/opower",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"loggers": ["opower"],
|
"loggers": ["opower"],
|
||||||
"requirements": ["opower==0.0.30"]
|
"requirements": ["opower==0.0.31"]
|
||||||
}
|
}
|
||||||
|
@@ -1,15 +1,28 @@
|
|||||||
"""Sensor to indicate whether the current day is a workday."""
|
"""Sensor to indicate whether the current day is a workday."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from holidays import list_supported_countries
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
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:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Workday from a config entry."""
|
"""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))
|
entry.async_on_unload(entry.add_update_listener(async_update_listener))
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
@@ -129,14 +129,6 @@ async def async_setup_entry(
|
|||||||
workdays: list[str] = entry.options[CONF_WORKDAYS]
|
workdays: list[str] = entry.options[CONF_WORKDAYS]
|
||||||
year: int = (dt_util.now() + timedelta(days=days_offset)).year
|
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)
|
obj_holidays: HolidayBase = country_holidays(country, subdiv=province, years=year)
|
||||||
|
|
||||||
# Add custom holidays
|
# Add custom holidays
|
||||||
|
@@ -1368,7 +1368,7 @@ openwrt-luci-rpc==1.1.16
|
|||||||
openwrt-ubus-rpc==0.0.2
|
openwrt-ubus-rpc==0.0.2
|
||||||
|
|
||||||
# homeassistant.components.opower
|
# homeassistant.components.opower
|
||||||
opower==0.0.30
|
opower==0.0.31
|
||||||
|
|
||||||
# homeassistant.components.oralb
|
# homeassistant.components.oralb
|
||||||
oralb-ble==0.17.6
|
oralb-ble==0.17.6
|
||||||
|
@@ -1034,7 +1034,7 @@ openerz-api==0.2.0
|
|||||||
openhomedevice==2.2.0
|
openhomedevice==2.2.0
|
||||||
|
|
||||||
# homeassistant.components.opower
|
# homeassistant.components.opower
|
||||||
opower==0.0.30
|
opower==0.0.31
|
||||||
|
|
||||||
# homeassistant.components.oralb
|
# homeassistant.components.oralb
|
||||||
oralb-ble==0.17.6
|
oralb-ble==0.17.6
|
||||||
|
Reference in New Issue
Block a user