Just checking, is it still not possible to use wildcards?
Hi, congratulations on the project, Iām using custom actions to receive notifications on Telegram, it only reports sensors with battery below the threshold but not unavailable sensors. on UI Notification are reported regularly. this yaml custom actions
if:
- condition: template
value_template: "{{ not all_sensors == '' }}"
then:
- action: notify.telegram
metadata: {}
data:
title: šŖ«Batterie Scariche
message: |-
ā¢ {{all_sensors|replace(', ', '
ā¢ ')}}
else:
- action: notify.telegram
metadata: {}
data:
message: Tutte le Batterie sono OK
enabled: true
Welcome to the community and thanks for your kind words.
I cant see what you have selected but maybe you need to select the option to use it
If this is not it then could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on ā</>ā and paste code in there.
Blacky
No still not possible.
Blacky
Thanks for kind wordsā¦ try the code below.
if:
- condition: template
value_template: "{{ all_sensors == '' }}"
then:
- action: notify.telegram
metadata: {}
data:
message: Tutte le Batterie sono OK
else:
- action: notify.telegram
metadata: {}
data:
title: šŖ«Batterie Scariche
message: |-
ā¢ {{all_sensors|replace(', ', '
ā¢ ')}}
Blacky
@Blacky
thanks for your quick response.
I had already tried without the not, tried again with the code you sent but nothing. even the sensors with battery below the set threshold do not arrive. if I send to Google ad it works regularly. Even with simple:
action: notify.telegram
data:
message: ...Battery "{{all_sensors}}".
or
action: notify.telegram
data:
title: Low Battery Notification
message: "{{all_sensors}}"
I only receive a messageā¦ Battery without the names of the sensors.
I believe that ā{{all_sensors}}ā is not valued in the telegram in other automations I receive values āāof a single sensor in the telegram with
message: >-
Alert Temperatura Acqua {{
states.sensor.sonoff_acquario_ds18b20_temperature.state }} CĀ°
Maybe try it without the bullet point.
if:
- condition: template
value_template: "{{ all_sensors == '' }}"
then:
- action: notify.telegram
metadata: {}
data:
message: Tutte le Batterie sono OK
else:
- action: notify.telegram
metadata: {}
data:
title: šŖ«Batterie Scariche
message: |-
{{all_sensors|replace(', ', '
')}}
or the emoji
if:
- condition: template
value_template: "{{ all_sensors == '' }}"
then:
- action: notify.telegram
metadata: {}
data:
message: Tutte le Batterie sono OK
else:
- action: notify.telegram
metadata: {}
data:
title: Batterie Scariche
message: |-
ā¢ {{all_sensors|replace(', ', '
ā¢ ')}}
or both
if:
- condition: template
value_template: "{{ all_sensors == '' }}"
then:
- action: notify.telegram
metadata: {}
data:
message: Tutte le Batterie sono OK
else:
- action: notify.telegram
metadata: {}
data:
title: Batterie Scariche
message: |-
{{all_sensors|replace(', ', '
')}}
or this one
"{{all_sensors|replace("_"," ")}}"
Let us know if any work as I donāt have telegram and once we work it out I will put it into the FAQ.
Blacky
ok by modifying code you sent I was able to make it work with code
if:
- condition: template
value_template: "{{ all_sensors == '' }}"
then:
- action: notify.telegram
metadata: {}
data:
message: Tutte le Batterie sono OK
else:
- action: notify.telegram
metadata: {}
data:
title: šŖ«Batterie Scariche
message: |
ā¢"{{all_sensors|replace("_","
ā¢ ")}}"
but I canāt fix the lines these are sensors in the Notification UI
this is what I see on telegram
We are getting there. Could you try this as it not really listing them correctly.
message: "{{ all_sensors|replace(\"_\", \" \")|replace(\",\", \"\\n\") }}"
If you go into a sensor you will find your friendly names have all the ā_ā. If you look at this post you can edit the names that suits you better and you just may find that it works better. Try one that is in the notification and see if it works better.
Blacky
@Blacky
by entering this
message: "{{ all_sensors|replace(\"_\", \" \")|replace(\",\", \"\\n\") }}"
mi da errore "template value should be a string for dictionary value @ data[0][ādataā] " quindi modificato come segue
message: >
"{{ all_sensors|replace("_", " ")|replace(",", "n") }}"
this is how I get it now
I also changed the names of the sensors by shortening them even if they didnāt have āā
Try this.
message: >
{{ all_sensors|replace("_", " ")|replace(",", "\n") }}
And also this
message: |
ā¢ {{all_sensors|replace("_"," ")|replace(",", "
ā¢ ")}}
ok here we go but with this code
message: |
"{{ all_sensors|replace("_", " ")|replace(",", "\n") }}"
the " " beginning and end of the instruction are necessarily required otherwise they will cause an error
this is the result
while this works better and without touching anything
message: |
ā¢ {{all_sensors|replace("_"," ")|replace(",", "
ā¢ ")}}
this is the result
now it works correctly with telegram
here is the complete code
if:
- condition: template
value_template: "{{ all_sensors == '' }}"
then:
- action: notify.telegram
metadata: {}
data:
message: šTutte le Batterie sono OK
else:
- action: notify.telegram
metadata: {}
data:
title: šŖ«Batterie Scariche
message: |
ā¢ {{all_sensors|replace("_"," ")|replace(",", "
ā¢ ")}}
action notify.telegram it must be replaced with the name of your Telegram notification
It would be interesting to insert directly into to-do from Instagram with Telegramās callback function. Iāll do some tests for this.
Thank you for the work you do and for your help
Nice one, glad you got it working, your welcome.
I will make a FAQ on this tomorrow so everyone can get the info.
Thanks for doing all the testing.
Blacky
It was a pleasure to have been of help even if only with simple tests
Hi,
I have zero coding experience and I am very new HA user. I just found this out and thought that this would be easy way to maintain batteries. Unfortunately I got stuck and I have no idea what to do, if someone could help I would be very thankful.
Welcome to the community.
Could you please update your Home Assistant and it should work.
Let us know how you go.
Blacky
Quick question and confirmation for my sanityā¦ As new devices get added with batteries, will the existing configured blueprint auto inherit them or do we have to add them or re-configure it?
Hi Lee, as you add devices or remove devices form HA, the blueprint will look for all your current devices with batteries as long as the device has a battery entity.
Blacky
Stay Charged, Stay Smart! Customize it your way and letās automate your battery maintenance!
New Feature For iOS
- Notification Sound - The Home Assistant app for iOS includes built-in notification sounds, and you can import sounds from your iOS device into the app. Custom sounds can also be added via iTunes or from your cloud storage.
For more information on using sounds in the Home Assistant app, click here.
If you like this blueprint? Consider hitting the button in the top post
If you like my blueprints, and would like to show your support or just say thank you? Click Here
Enjoy
Blacky
Hi thank you for this blueprint. It was exactly what i was looking for.
Just a problem on my side. it is not notify me if a battery is in āUnknowā status.
It work with anavailable, but not with unknow.
Is there a waz of solving this ?
Regards.