mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Remove unnecessary assignment of Template.hass from command_line (#123664)
This commit is contained in:
parent
840d9a0923
commit
ecc308c326
@ -51,9 +51,7 @@ async def async_setup_platform(
|
||||
scan_interval: timedelta = binary_sensor_config.get(
|
||||
CONF_SCAN_INTERVAL, SCAN_INTERVAL
|
||||
)
|
||||
|
||||
if value_template := binary_sensor_config.get(CONF_VALUE_TEMPLATE):
|
||||
value_template.hass = hass
|
||||
value_template: Template | None = binary_sensor_config.get(CONF_VALUE_TEMPLATE)
|
||||
|
||||
data = CommandSensorData(hass, command, command_timeout)
|
||||
|
||||
|
@ -45,9 +45,6 @@ async def async_setup_platform(
|
||||
}
|
||||
|
||||
for device_name, cover_config in entities.items():
|
||||
if value_template := cover_config.get(CONF_VALUE_TEMPLATE):
|
||||
value_template.hass = hass
|
||||
|
||||
trigger_entity_config = {
|
||||
CONF_NAME: Template(cover_config.get(CONF_NAME, device_name), hass),
|
||||
**{k: v for k, v in cover_config.items() if k in TRIGGER_ENTITY_OPTIONS},
|
||||
@ -60,7 +57,7 @@ async def async_setup_platform(
|
||||
cover_config[CONF_COMMAND_CLOSE],
|
||||
cover_config[CONF_COMMAND_STOP],
|
||||
cover_config.get(CONF_COMMAND_STATE),
|
||||
value_template,
|
||||
cover_config.get(CONF_VALUE_TEMPLATE),
|
||||
cover_config[CONF_COMMAND_TIMEOUT],
|
||||
cover_config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL),
|
||||
)
|
||||
|
@ -57,11 +57,9 @@ async def async_setup_platform(
|
||||
json_attributes: list[str] | None = sensor_config.get(CONF_JSON_ATTRIBUTES)
|
||||
json_attributes_path: str | None = sensor_config.get(CONF_JSON_ATTRIBUTES_PATH)
|
||||
scan_interval: timedelta = sensor_config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL)
|
||||
value_template: Template | None = sensor_config.get(CONF_VALUE_TEMPLATE)
|
||||
data = CommandSensorData(hass, command, command_timeout)
|
||||
|
||||
if value_template := sensor_config.get(CONF_VALUE_TEMPLATE):
|
||||
value_template.hass = hass
|
||||
|
||||
trigger_entity_config = {
|
||||
CONF_NAME: Template(sensor_config[CONF_NAME], hass),
|
||||
**{k: v for k, v in sensor_config.items() if k in TRIGGER_ENTITY_OPTIONS},
|
||||
|
@ -46,9 +46,6 @@ async def async_setup_platform(
|
||||
}
|
||||
|
||||
for object_id, switch_config in entities.items():
|
||||
if value_template := switch_config.get(CONF_VALUE_TEMPLATE):
|
||||
value_template.hass = hass
|
||||
|
||||
trigger_entity_config = {
|
||||
CONF_NAME: Template(switch_config.get(CONF_NAME, object_id), hass),
|
||||
**{k: v for k, v in switch_config.items() if k in TRIGGER_ENTITY_OPTIONS},
|
||||
@ -61,7 +58,7 @@ async def async_setup_platform(
|
||||
switch_config[CONF_COMMAND_ON],
|
||||
switch_config[CONF_COMMAND_OFF],
|
||||
switch_config.get(CONF_COMMAND_STATE),
|
||||
value_template,
|
||||
switch_config.get(CONF_VALUE_TEMPLATE),
|
||||
switch_config[CONF_COMMAND_TIMEOUT],
|
||||
switch_config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user