I like to show the persistent_notification.create messages in Lovelace by a card.
Or any other persistant notification if possible
I can not find anything looking at Google.
Is this possible?
If yes how to create?
Thanks
I like to show the persistent_notification.create messages in Lovelace by a card.
Or any other persistant notification if possible
I can not find anything looking at Google.
Is this possible?
If yes how to create?
Thanks
Consider using this:
I know only one way to “send messages” - using a “logbook.log” service:
action: logbook.log
data:
message: message
name: name
But these messages are only displayed on a main Logbook view, they cannot be shown in a Logbook card.
But these messages are only displayed on a main Logbook view, they cannot be shown in a Logbook card.
It’s maybe a bit silly, but you can do it.
Action:
action: logbook.log
data:
entity_id: foo.not_a_real_entity
name: Hello World
message: Hello World
Card:
type: logbook
target:
entity_id:
- foo.not_a_real_entity
Dashboard:
Nice hack)
Unfortunately, result is not stable in my setup: after F5 the Logbook card is empty, and again is filled with records after a few F5…
I think logbook is just a buggy card in general. I’ve seen the same with real entities, and I think there’s a draft PR with some fixes.
I created a new way of doing this
First I use this integration to create a variable
enkama/hass-variables: Home Assistant variables component
Defined the variable as sensor.messages with the attribute history_1
then I created an automation to copy the notification into the attribute
alias: Benachrichtigungen
description: ""
triggers:
- event_type: call_service
event_data:
domain: persistent_notification
service: create
trigger: event
conditions: []
actions:
- action: variable.update_sensor
target:
entity_id: sensor.messages
data:
replace_attributes: false
value: Nachricht
attributes:
history_1: >-
{{ states.sensor.messages.attributes.history_1 }}
{{ now().strftime('%Y-%m-%d %H:%M:%S') }} - {{
trigger.event.data.service_data.title }}: {{
trigger.event.data.service_data.message }}
then I have a markdown card which shows the attribute
type: markdown
content: "{{ states.sensor.messages.attributes.history_1 }}"
and a script to clean it again
sequence:
- action: variable.update_sensor
target:
entity_id: sensor.messages
data:
replace_attributes: false
value: " "
attributes:
history_1: " "
- action: script.notify_clean_messages
metadata: {}
data: {}
alias: Benachrichtigungen leern
description: ""
Could be, I am aware of some registered issues, thanks for the feedback!
Nice way. But it only shows one notification?
No. It Shows all notifications Till you clean it
Thanks.
I’m programming in NodeRed.
So I do need to translate it.
I will give it a try
I did try to reproduce this in NodeRed.
I’m almost there.
Except that it only shows 1 message.
what I did:
You need to add the old and the new one. Like my code
ahhhhh thanks
I will try