Add availability to command_line (#105300)

* Add availability to command_line

* Add tests

* freezer
This commit is contained in:
G Johansson
2024-01-15 18:20:34 +01:00
committed by GitHub
parent 6a9fdaae7a
commit 749ef45727
8 changed files with 225 additions and 5 deletions

View File

@@ -20,7 +20,10 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.event import async_track_time_interval
from homeassistant.helpers.template import Template
from homeassistant.helpers.trigger_template_entity import ManualTriggerEntity
from homeassistant.helpers.trigger_template_entity import (
CONF_AVAILABILITY,
ManualTriggerEntity,
)
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.util import dt as dt_util, slugify
@@ -48,6 +51,7 @@ async def async_setup_platform(
CONF_UNIQUE_ID: device_config.get(CONF_UNIQUE_ID),
CONF_NAME: Template(device_config.get(CONF_NAME, object_id), hass),
CONF_ICON: device_config.get(CONF_ICON),
CONF_AVAILABILITY: device_config.get(CONF_AVAILABILITY),
}
value_template: Template | None = device_config.get(CONF_VALUE_TEMPLATE)