Hi,
since 2021.6.2 my sensor to read the log file doesn’t work anymore.
I get:
Error adding entities for domain sensor with platform file
Error while setting up file platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 383, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 588, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 615, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 368, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 494, in _async_write_ha_state
self.hass.states.async_set(
File "/usr/src/homeassistant/homeassistant/core.py", line 1218, in async_set
state = State(
File "/usr/src/homeassistant/homeassistant/core.py", line 906, in __init__
raise InvalidStateError(
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.log_tail. State max length is 255 characters.
This is my configuration on the sensor.yaml
- platform: file
file_path: /config/home-assistant.log
name: Log tail
value_template: >
{{value|truncate(255,True)}}
1 post - 1 participant