the trigger object is an object, not a string. When you wrap text in quotes you turn it into a string. Once that happens, only string things can be done with it.
So in these lines of code, you’re changing the trigger object into a string, basically making it useless.
The next thing is, you’re using is_state(). This function takes entity_id’s and entity_id’s only as the first argument. Is this an entity_id?
Lastly, you shouldn’t use from_state. It’s the previous state, you should be using to_state. This is the resulting state of the state change. There are cases when from_state does not exist and to_state does.
To recap:
We can’t use is_state.
We need to keep it a trigger object.
We need to use to_state.
That would result in your if statements looking a bit like this:
{% if trigger.to_state.attributes.friendly_name == 'ZW Bedroom Eye Motion Detector' %}
didn’t work, as far as I can see from the docs the is_state/attr is what is recommended and from the docs the first two values are single quoted, e.g. is_state_attr(‘device_tracker.paulus’, ‘battery’, 40), now their example tests against a numeric so it isn’t quoted (the 40), since I’m testing against a string I quoted it. I guess the trigger.to_state doesn’t return the entity_id?
because the first argument that’s required is an entity_id. You’re feeding it 'trigger.to_state’ which is not an entity_id. trigger.to_state is a state object. Take a look at this post to help you understand what a state object is: