mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Loop load Jewish Calendar platforms (#70714)
This commit is contained in:
parent
d907eb2810
commit
70e8f81be1
@ -11,6 +11,7 @@ from homeassistant.helpers.discovery import async_load_platform
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
DOMAIN = "jewish_calendar"
|
||||
PLATFORMS: list[Platform] = [Platform.SENSOR, Platform.BINARY_SENSOR]
|
||||
|
||||
CONF_DIASPORA = "diaspora"
|
||||
CONF_LANGUAGE = "language"
|
||||
@ -67,6 +68,9 @@ def get_unique_prefix(
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Jewish Calendar component."""
|
||||
if DOMAIN not in config:
|
||||
return True
|
||||
|
||||
name = config[DOMAIN][CONF_NAME]
|
||||
language = config[DOMAIN][CONF_LANGUAGE]
|
||||
|
||||
@ -97,12 +101,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"prefix": prefix,
|
||||
}
|
||||
|
||||
hass.async_create_task(
|
||||
async_load_platform(hass, Platform.SENSOR, DOMAIN, {}, config)
|
||||
)
|
||||
|
||||
hass.async_create_task(
|
||||
async_load_platform(hass, Platform.BINARY_SENSOR, DOMAIN, {}, config)
|
||||
)
|
||||
for platform in PLATFORMS:
|
||||
hass.async_create_task(async_load_platform(hass, platform, DOMAIN, {}, config))
|
||||
|
||||
return True
|
||||
|
@ -24,7 +24,7 @@ from . import DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DATA_SENSORS = (
|
||||
INFO_SENSORS = (
|
||||
SensorEntityDescription(
|
||||
key="date",
|
||||
name="Date",
|
||||
@ -143,7 +143,7 @@ async def async_setup_platform(
|
||||
|
||||
sensors = [
|
||||
JewishCalendarSensor(hass.data[DOMAIN], description)
|
||||
for description in DATA_SENSORS
|
||||
for description in INFO_SENSORS
|
||||
]
|
||||
sensors.extend(
|
||||
JewishCalendarTimeSensor(hass.data[DOMAIN], description)
|
||||
|
Loading…
x
Reference in New Issue
Block a user