I don’t really know how to ask this question here it is and with examples. I am trying to get a specific state_attr in a notification message and I can only assume I have a formatting problem.
This works and does return the expected value: (this is value I am trying to get in my notification)
Ok, so @tom_l, yes that works although my attempt starting working also, but only when the value is >0. Now that both are working, is one of them more correct? I can use either … Also, as you and @koying have pointed out, the attribute disappears when the state is OFF. Which means 50% of my tests were not going to work anyway.
Now that I know that, can you tell me how best way to write this? An example of the message I’m hoping to receive is:
Title: Foyer Lights Message: Outside Light is ON at 15 %
and I guess for states other than “ON”, I should get a message like this:
I’m missing the percent symbol in the message when the value is >0. Where would I put that in the provided statement?
Also, for your question, the naming convention or structure I use for my device names isn’t always a friendly_name when read in a message. I name my devices based on type.area.sub-area.name which helps when searching/sorting/etc… Using the trigger.id allows me a bit of customization for readability of the message.