I’m building my notification card using GitHub - royto/logbook-card: Logbook card for Home Assistant UI Lovelace. so that I can display the notifications that I sent to my script notifications How to listen to an MQTT topic in automation - #7 by 123.
I called input_text helper at the end of the script to store the state. Since, I can’t customise the icon of the input_text helper, I had to create a new template sensor that is updated from the input_helper state change.
template:
- sensor:
- name: "notification log"
state: " {{ states('input_text.log_notification') }} "
icon: >
{% if 'Garage' in this.state %}
mdi:garage
{% elif 'Washing' in this.state %}
mdi:washing-machine
{% else %}
mdi:bell
{% endif %}
The idea is so that I can also show the icon along with notification by picking up a string from the notification which is a state.
Unfortunately, the icon update has a lag so the change in state of the sensor is registered first and icon later so the log card shows the icon of the previous state and not of the current state which has triggered the log activity.
I know it is such a convoluted way… unless someone can advise a neat solution.