I use the below automation to advise me if windows are still open when either I leave the house or window blinds close.
However, for some reason, a space is being placed in front of the comma. I can’t figure out why so if anyone could maybe please point out what may be wrong with the automation that’s causing this?
try this template approach. it cleans up a lot of what you have, and i think makes it much easier to read. you should take advantage of the > and | to not have to do all the \ escaping you’re doing.
action:
- service: notify.mobile_app_iphone_m
data:
title: Windows are OPEN!!
message: >
{{ expand('binary_sensor.windows') | selectattr('state', 'eq', 'on') |
map(attribute='name') | list | join(',\n') }}
i’m not sure if this removes the extra space tho. i am guessing that you have something like
“Kitchen Window”. or “Kitchen Sensor”. so when you repalce “Sensor” and “Window” with “” you end up with "Kitchen ". if my guess is right, then you need to also replace that space before Sensor and Window. try this: