Fixes
This commit is contained in:
parent
cfe681f441
commit
f09cea640e
2 changed files with 6 additions and 3 deletions
|
@ -23,6 +23,7 @@ from homeassistant.const import (
|
|||
CONF_NAME,
|
||||
CONF_UNIQUE_ID,
|
||||
CONF_UNIT_OF_MEASUREMENT,
|
||||
MAX_LENGTH_STATE_STATE,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, State, callback
|
||||
from homeassistant.exceptions import TemplateError
|
||||
|
@ -238,10 +239,12 @@ class ManualTriggerEntity(TriggerBaseEntity):
|
|||
attr.update(state_attributes)
|
||||
if extra_state_attributes := self.extra_state_attributes:
|
||||
attr.update(extra_state_attributes)
|
||||
|
||||
entity_state = str(self.state)
|
||||
if len(entity_state) > MAX_LENGTH_STATE_STATE:
|
||||
entity_state = entity_state[:MAX_LENGTH_STATE_STATE]
|
||||
state = State(
|
||||
self.entity_id,
|
||||
str(value),
|
||||
str(entity_state),
|
||||
attr,
|
||||
now,
|
||||
now,
|
||||
|
|
|
@ -564,7 +564,7 @@ async def test_templating(hass: HomeAssistant) -> None:
|
|||
"command_off": f"echo 0 > {path}",
|
||||
"value_template": '{{ value=="1" }}',
|
||||
"icon": (
|
||||
'{% if states("switch.test2")=="on" %} mdi:on {% else %} mdi:off {% endif %}'
|
||||
'{% if states("switch.test")=="on" %} mdi:on {% else %} mdi:off {% endif %}'
|
||||
),
|
||||
"name": "Test2",
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue