I am attempting to setup an alert where when my printer toner is low, I’ll get a notification from HASS. I dont have experience in YAML, but everything I have found here for similar things I am getting an error when I attempt to use the same code from others in my notify block. See below:
service: notify.notify
metadata: {}
data:
message: {{ trigger.to_state.attributes.friendly_name }} is at {{ trigger.to_state.state }}
When I do a run on this I get “Error rendering data template: UndefinedError: ‘trigger’ is undefined”. The trigger is setup as this when I view in yaml:
There are 4 unique triggers on this (one for each entity on the printer). Ideally I’d like to see something like “Black toner is low” when the notification triggers.
That automations and scripts callout was a great starting point. This ended up getting me fixed. If anyone else stumbles on this in the future; here’s what worked:
Which brings me back to the original question. Are we able to insert triggering entity ID’s into messages via lovelace or is that exclusively a YAML thing (for now)?
TL;DR
No, it’s not possible to setup the message without using YAML as a language.
Lovelace is how the frontend in HA is called, aka your dashboards. YAML is a language, to describe things in a human readable way (sort of). UI is where you setup your automations, scripts, helpers and all these things. Let’s call it the backend.
In the backend you have two ways of writing things, one in YAML-mode, and one in UI-mode. Sometimes things aren’t available in the UI, so you have to add some YAML code in a field in the UI, in this case this is called “code editor” (that’s what the OP named YAML) versus the “visual editor” that people normally use in the UI. You can see the “code editor” part in the picture from the OP.
Normally, if people talk about YAML, it means that you have to write the complete automation (or whatever) in YAML, not only one part of it, to paste it into the code editor in the UI.
I know that the wording is sometimes complicated in HA.
So, nope, there is no other way than using YAML in the code editor, and I doubt, that these template things will get some kind of visual editor, sorry to say!