mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 18:57:57 +00:00

* Template domain blueprints * Default blueprint for templates * Some linting * Template entity updates * Load and use blueprints in config * Added missing mapping methods for templates * Linting * Added tests * Wrong schema type * Hassfest errors * More linting issues * Refactor based on desired schema In the [architecture discussion](https://github.com/home-assistant/architecture/discussions/1027), the template blueprint instance did not specify the platform (e.g. `binary_sensor`), but the initial implementation assumed that schema. * Create default template blueprints on first run * Moved TemplateConfig definition This is to avoid circular references * Corrected methods to find templates based on blueprints * Corrected missing entity config information * Added tests * Don't use hass.data Address comments https://github.com/home-assistant/core/pull/126971/#discussion_r1780097187 * Prevent creating blueprints during testing * Combine 2 ifs Address comment https://github.com/home-assistant/core/pull/126971/#discussion_r1780160870 * Improve test coverage * Prevent template component from dirtying test env * Remove useless hard-coded validation * Improve code coverage to 100% * Address review comments * Moved helpers in helpers.py As per comment https://github.com/home-assistant/core/pull/126971#discussion_r1786539889 * Fix blueprint source URL --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
"""Constants for the Template Platform Components."""
|
|
|
|
from homeassistant.components.blueprint import BLUEPRINT_SCHEMA
|
|
from homeassistant.const import Platform
|
|
from homeassistant.helpers.typing import ConfigType
|
|
|
|
CONF_ACTION = "action"
|
|
CONF_ATTRIBUTE_TEMPLATES = "attribute_templates"
|
|
CONF_ATTRIBUTES = "attributes"
|
|
CONF_AVAILABILITY = "availability"
|
|
CONF_AVAILABILITY_TEMPLATE = "availability_template"
|
|
CONF_CONDITION = "condition"
|
|
CONF_MAX = "max"
|
|
CONF_MIN = "min"
|
|
CONF_OBJECT_ID = "object_id"
|
|
CONF_PICTURE = "picture"
|
|
CONF_PRESS = "press"
|
|
CONF_STEP = "step"
|
|
CONF_TRIGGER = "trigger"
|
|
CONF_TURN_OFF = "turn_off"
|
|
CONF_TURN_ON = "turn_on"
|
|
|
|
DOMAIN = "template"
|
|
|
|
PLATFORM_STORAGE_KEY = "template_platforms"
|
|
|
|
PLATFORMS = [
|
|
Platform.ALARM_CONTROL_PANEL,
|
|
Platform.BINARY_SENSOR,
|
|
Platform.BUTTON,
|
|
Platform.COVER,
|
|
Platform.FAN,
|
|
Platform.IMAGE,
|
|
Platform.LIGHT,
|
|
Platform.LOCK,
|
|
Platform.NUMBER,
|
|
Platform.SELECT,
|
|
Platform.SENSOR,
|
|
Platform.SWITCH,
|
|
Platform.VACUUM,
|
|
Platform.WEATHER,
|
|
]
|
|
|
|
TEMPLATE_BLUEPRINT_SCHEMA = BLUEPRINT_SCHEMA
|
|
|
|
|
|
class TemplateConfig(dict):
|
|
"""Dummy class to allow adding attributes."""
|
|
|
|
raw_config: ConfigType | None = None
|
|
raw_blueprint_inputs: ConfigType | None = None
|