I have the same trouble. If i use service notify.mobile_app, all work fine, but if i use service notify.telegram_chat message dont left and in logs i see this:
Error sending message: Can't parse entities: can't find end of the entity starting at byte offset 95. Args: (201732582, 'Battery low - MI PAD 4 Battery Level, iPhone Irina Battery Level, T-H-Balcony_battery'), kwargs: {'parse_mode': 'Markdown', 'disable_notification': False, 'disable_web_page_preview': None, 'reply_to_message_id': None, 'reply_markup': None, 'timeout': None, 'message_tag': None}
It seems that Telegram expects the message to be valid markdown and I suppose if there are e.g. an odd number of _ characters it believes this to be invalid markdown. Not sure if the underscores are the only problem here, but you could first try {{sensors|replace("_"," ")}} instead of just {{sensors}} maybe that does the trick already.
Set exclude to an empty list [ ] (e.g. remove exclude0 ⌠exclude9) and replace threshold with some number, e.g. 20 or something higher. 101 should give you all sensors.
I just got the same problem: I receive a notification (on my phone from the android application), but no sensor name in it.
Iâve tried with debug template, seems like results are correct : nothing in my case for 20%, and 2 âBattery_123xyzâ for 30% but testing script with a 30% threshold still give no sensors (tried replacing underscores and without).
Could you please in the Automation Settings for the automation from this blueprint click on the 3 dots and select Edit as YAML and post the results here?
Can you try instead of a device action instead using âCall Serviceâ with service notify.mobile_app_⌠and then putting the message there with the {{sensors}} variable?
In the data section you can put: message: 'The battery of the sensor(s) {{sensors}} is low.'
Hum⌠No, nothing in logs unfortunately
Since Iâm discovering HA since a few days only; I cannot exclude I have setup issues, most of my existing sensors has been discovered but not set up at all yet (mainly because Iâm not able to differentiate them all ).
Let me know if I can provide extra information; Iâll certainly take another look later. Thank you very much anyways, and merry x-mas!
Instead of listing out 10 sensor inputs to exclude, couldnât you just use a single target selector since that collects a list of entities of a specific type. Or I guess two target selectors, one for sensors to exclude and one for binary sensors to exclude.
I tried to but couldn´t get it to work. Do I need do copy&paste the whole raw code?
Maybe you can provide the code I have to paste filled with all the variables.
At least it´s not just me so maybe there´s a bug in the blueprint.
You need to copy the pointed code but adapt it a bit. Try with this, change threshold variable according to your needs:
{% set result = namespace(sensors=[]) %}
{% set exclude = [] %}
{% set threshold = 20 %}
{% for state in states.sensor | selectattr('attributes.device_class', '==', 'battery') %}
{% if 0 < state.state | int < threshold | int and not state.entity_id in exclude %}
{% set result.sensors = result.sensors + [state.name] %}
{% endif %}
{% endfor %}
{% for state in states.binary_sensor | selectattr('attributes.device_class', '==', 'battery') | selectattr('state', '==', 'on') %}
{% if not state.entity_id in exclude %}
{% set result.sensors = result.sensors + [state.name] %}
{% endif %}
{% endfor %}
{{result.sensors|join(', ')}}
About the issue itself, Iâve worked on my sensors configuration, names I see in debug seems to be the correct ones, but notification still miss them.
Also, with a 20% threshold, I have no results (I can confirm with debug results) but notification is sent.
I need to apologize: the blueprint is working as intended:
When I set the treshold to e. g. 90 % and trigger the automation, the devices/sensors below that treshold are reported in the notification message.
BUT when I set treshold to 20 % (or a level lower than current devices/sensors states) and trigger the automation manually I get the notification with empty text "Low battery warning for: " as reported in Low battery level detection & notification for all battery sensors
So the question is: is this a normal behaviour of automations triggered manually --> do they always run even the conditions are not met? I think so because I did not receive any notification during the last days when the automation was run at set time daily.
No problem, thanks for the reply. Yes, when manually triggering through the UI, conditions are ignored by default. You can trigger automations manually with conditions in Developer Tools - Services using skip_condition: false.