Im trying to create an event log Card that will show important events during absence, like shown in the attached screenshot.
The decision, what is relevant and how its displayed, can be done by node red (i already started to create the flows)
Node Red puts the events in a .txt file. To show this Log on my Dashboard, i tried the following: A command sensor is putting the content of the .txt in a sensor.
command_line:
- sensor:
command: 'cat /share/test.txt'
name: awaylog
The .txt file already includs the formating for the text to be shown as alert-types (colored row with related icon). The sensor is then used in a Markdown Card.
Problem is, the sensor only seems to be capable of storing 255 characters. This limit exeeds quickly. (one alert-type command is already >50 characters) . If it is exeeded the result is shown as "unknown" (screenshot at the top)
Is anybody aware of a solution to avoid this chracter limit. Any other ideas to achiev such an event log ?
#Edit/Solution: Thanks to @[email protected] I just put the log entries in the json_attributes of the sensor and used the actual sensor value (because only this is limited to 255 char.) to just count up the number of log entries. Also i skipped the step creating a command sensor in Home assistant config.yaml, instead i used the sensor node to change it directly with node red.
Node-red sensor node config:
state = msg.logcount
json_attributes = msg.payload (formated log entry list)
Markdown card
type: markdown
entity_id:
- sensor.absencelog_2
content: |
## Absence Events
{{state_attr('sensor.absencelog_2', 'json_attributes')}}
*This list will be deleted when Marge is home again*
ps. Marge got a new phonenumber :P
Marge was doxxed*