Enable basic type checking in template (#66222)
* Fix binary_sensor * Adjust button * Adjust fan * Adjust select * Adjust template_entity * Adjust trigger_entity * Adjust weather * Adjust init * Adjust number * Adjust None check
This commit is contained in:
parent
8760cb035a
commit
47d6f75c17
10 changed files with 31 additions and 62 deletions
|
@ -12,6 +12,7 @@ from homeassistant.const import (
|
|||
CONF_UNIT_OF_MEASUREMENT,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import TemplateError
|
||||
from homeassistant.helpers import template, update_coordinator
|
||||
|
||||
from . import TriggerUpdateCoordinator
|
||||
|
@ -36,6 +37,7 @@ class TriggerEntity(update_coordinator.CoordinatorEntity):
|
|||
|
||||
entity_unique_id = config.get(CONF_UNIQUE_ID)
|
||||
|
||||
self._unique_id: str | None
|
||||
if entity_unique_id and coordinator.unique_id:
|
||||
self._unique_id = f"{coordinator.unique_id}-{entity_unique_id}"
|
||||
else:
|
||||
|
@ -45,7 +47,7 @@ class TriggerEntity(update_coordinator.CoordinatorEntity):
|
|||
|
||||
self._static_rendered = {}
|
||||
self._to_render_simple = []
|
||||
self._to_render_complex = []
|
||||
self._to_render_complex: list[str] = []
|
||||
|
||||
for itm in (
|
||||
CONF_NAME,
|
||||
|
@ -148,7 +150,7 @@ class TriggerEntity(update_coordinator.CoordinatorEntity):
|
|||
)
|
||||
|
||||
self._rendered = rendered
|
||||
except template.TemplateError as err:
|
||||
except TemplateError as err:
|
||||
logging.getLogger(f"{__package__}.{self.entity_id.split('.')[0]}").error(
|
||||
"Error rendering %s template for %s: %s", key, self.entity_id, err
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue