Showing error messages

In lovelace, I need to show some error/status messages.
These should be displayed on the device you’re using.
What’s the easiest way to do this? Is it some sort of conditional card with a text sensor that I can set to a string value?
How do you guys do this?

you have a specific set of errors, or would the log suffice:

# https://home-assistant.io/components/sensor.file/
  - platform: file
    file_path: /config/home-assistant.log
    name: Log tail
    value_template: >
      {{value|truncate(255,True)}}

and use a lovelace card ro show the sensor.logtail

One situation is this:
On my hallway wall panel, I have a button to lock all doors.
I’d like a confirmation on that panel that says if the doors were really locked, or a friendly message that says “Unable to lock the kitchen door, please check it”.
I know I can send a notification to my iPhone about it (from Node Red), but I need it directly in the UI.

persistent_notifications

Looks like this creates a notification that you’ll se when you select notifications in the ui left panel. Will this work with lovelace and a hidden left side panel?
I was thinking maybe an mqtt sensor that I can set from Node Red, and a conditional-card in Lovelace that’s visible only when that sensor’s state != “”. And some button and maybe a timer to clear it. Is this a good solution?

Don’t know.

It’s not a bad solution but it has drawbacks. You’ll be limited to 254 characters.

My wife never reads more than the first line of an error message anyway :wink:, so I’ll give it a try

Maybe the popup-card is what your are looking for:

as @petro says, that’s what persistent notifications are for. Even though they can be tucked away in the sidebar…and will show a number besides the bell icon:

55

you can always use an automation to have the persistent notifications be filed to a file, and display that file in the frontend.

  - alias: 'Notify of persistent notifications'
    id: 'Notify of persistent notifications'
    initial_state: 'off'
    trigger:
      platform: event
      event_type: call_service
      event_data:
        domain: persistent_notification
        service: create
    condition: []

and then use a service

    service: notify.filed_persistent_notifications
    data_template:
      message: >
        {% set message = trigger.event.data.service_data.message %}
           {{ as_timestamp(now()) | timestamp_custom("%d %b: %X") }}: {{ message }}

you can use a conditional card on the condition a persistent_notification is notifying.

example:

type: conditional
conditions:
  - entity: persistent_notification.trash_notification
    state: notifying
1 Like

use the persistent notification along with the custom lovelace “Home Feed Card”:

You can set it up to only show when there is a persistent notification active.

1 Like

cool!
didn’t know this one yet, and it might just relieve me of a lot of customized sensors/cards/notifications…
thanks for the pointer!