🪫 Low Battery Notifications & Actions

I am not sure what I am doing wrong.
here is the code i am using from your blueprint:

alias: Low Battery Notifications & Actions
description: ""
use_blueprint:
  path: Blackshome/low-battery-notifications-and-actions.yaml
  input:
    include_easy_notify: enable_easy_okay_notify
    include_persistent_notification: enable_persistent_okay_notification
    notify_data:
      - high_priority
    include_custom_actions: enable_custom_actions
    custom_actions:
      - metadata: {}
        data:
          title: 🪫Low Battery Notification
          message: |-
            • {{all_sensors|replace(', ', '
            • ')}}
        action: notify.persistent_notification
    notify_device:
      - 31d893c533db9c662f9e57514c218c20
      - 5ddb8d3c54ea7565725c5b352d731368
    sensor_selection: enable_all_sensors
    battery_level: 100
    custom_group_battery_level: 100

I’ve set the battery % to 100% since all my sensors are at 100 just to check the notifications.
On iphone i get "YES! All batteries are okay :slight_smile:
On the UI i get 1 bullet point with nothing else.

I even created the following in configuration yaml to fix it but still nothing:

- sensor:
      - name: "All Sensors"
        unique_id: all_sensors
        state: >
          {% set sensor_list = [
              {'name': 'Amazon Fire Tablet Battery Level', 'entity': 'sensor.amazon_fire_tablet_battery_level'},
              {'name': 'Andreas’s iPhone Battery Level', 'entity': 'sensor.andreass_iphone_battery_level'},
              {'name': 'Button for TV Light Battery', 'entity': 'sensor.button_for_tv_light_battery'},
              {'name': 'Entrance Door Battery', 'entity': 'sensor.entrance_door_battery'},
              {'name': 'Entrance Motion Battery', 'entity': 'sensor.entrance_motion_battery'},
              {'name': 'Freezer Temperature Sensor Battery', 'entity': 'sensor.freezer_temperature_sensor_battery'},
              {'name': 'MAR-LX1A Battery Level', 'entity': 'sensor.mar_lx1a_battery_level'},
              {'name': 'Temperature and Humidity Sensor Battery', 'entity': 'sensor.temperature_and_humidity_sensor_battery'}
          ] %}
          {% set output = [] %}
          {% for sensor in sensor_list %}
            {% set state = states(sensor.entity) %}
            {% if state is not none %}
              {% set output = output + [sensor.name ~ ': ' ~ state] %}
            {% endif %}
          {% endfor %}
          {{ output | join(', ') if output | length > 0 else 'No sensor data available' }}
        attributes:
          amazon_fire_tablet_battery_level: "{{ states('sensor.amazon_fire_tablet_battery_level') }}"
          andreass_iphone_battery_level: "{{ states('sensor.andreass_iphone_battery_level') }}"
          button_for_tv_light_battery: "{{ states('sensor.button_for_tv_light_battery') }}"
          entrance_door_battery: "{{ states('sensor.entrance_door_battery') }}"
          entrance_motion_battery: "{{ states('sensor.entrance_motion_battery') }}"
          freezer_temperature_sensor_battery: "{{ states('sensor.freezer_temperature_sensor_battery') }}"
          mar_lx1a_battery_level: "{{ states('sensor.mar_lx1a_battery_level') }}"
          temperature_and_humidity_sensor_battery: "{{ states('sensor.temperature_and_humidity_sensor_battery') }}

Can you help? I am trying to get a list of my sensors names in bullet form + their battery percent either when I manually run it through the blueprint or when the automation runs on its own

Thanks a lot!

For some reason it is working now but I am not sure if I should delete the configuration yaml code or not. Can you help please?

@derMicro

Yeah, it is not a bug it is just how Spook works. You can ether ignore it or add to-do. To-do is home assistant and is supported by them so it will always be there.

Blacky :smiley:

@Sporbillis

You do not need to ad anything to your configuration yaml file so you can remove it and would be best to do so.

Looks like you got it working… nice one.

Blacky :smiley:

@Eniste

Hi Ralph, I have tested your yaml and everything works. I will do a FAQ on it so you can see how it works.

EDIT: Below is a FAQ now.

Blacky :smiley:

FAQ - How to Use the To-Do Option Action Buttons

:warning: Note: The To-Do list option can only be added when you receive a notification on a device. It will not work with UI Notifications. Ensure you have a device and enable the option in Easy Notify as shown below.

How to Use the To-Do Option Action Buttons: Follow these steps:

  1. Start by adding the Local To-Do integration. Click here to visit the official Home Assistant website for instructions, or simply click the Add Integration button below.

  2. Once you have installed the Local To-Do integration, you’ll need to create an integration entry.

    Note - The default shopping list isn’t compatible due to its lack of description capability. However, all other To-Do lists are fully supported.

    1. Navigate to Settings > Devices & Services > Integrations.
    2. Click on the Local To-Do integration.

    1

    1. Select Add Entry and choose a name for your entry. For example, I named mine Blueprints and Maintenance List, as shown below. This will be the To-Do list where you can add your tasks.

  3. Now that you have an Entry, you can use it in the blueprint. In the Action Button section of the blueprint, enable the To-Do List by selecting one of the top two options. I chose Add To-Do List Action Buttons + Confirmation Message because I prefer to receive a confirmation message.

    The input highlighted by the red box is where I’ve selected my Maintenance List Entry. You should select the entry you created by following the steps above.

    Next, edit the default text inputs to suit your preferences and language. Ensure that all inputs contain some text.

  4. Now, when you receive a low battery notification on your device, you’ll have the option to add the low batteries to your selected To-Do List Entry. The appearance of these options may vary depending on whether your device is iOS or Android…

    iOS

    When you receive the message, tap and hold, then release to view the action buttons. If you tap quickly and it disappears, that’s just how iOS functions, and unfortunately, I can’t change it.

    Below is an example of how it looks when I tap and hold, then release.

    7

    Since I opted for a confirmation message, I receive this message after selecting the Add To To-Do List! button.

    If you tap on the confirmation message, it will take you directly to your chosen Entry To-Do List, displaying the entry from your action button. You can then edit it by tapping on the entry and setting a date if you wish.

    This is what you see when you tap on the To-Do list heading.

    Android

    Depending on your Android settings, this is what it looks like when you receive the notification.

    or

    Since I opted for a confirmation message, I receive this message after selecting the Add To To-Do List! button.

    If you tap on the confirmation message, it will take you directly to your chosen Entry To-Do List, displaying the entry from your action button. You can then edit it by tapping on the entry and setting a date if you wish.

    UI

    In To-Do List Integration in the UI.

Conclusion: I hope this provides a clearer understanding of how to use the To-Do list action buttons.

Enjoy

Back to FAQ: Click Here

Blacky :smiley:

@Blacky

Hi Blacky,
hopefully you enjoyed your holidays!
Thank you for checking my config file! But unfortunately there were no to-do’s added to my to-do list, when I run the task manually…

I created and configured my To-Do List as you described in the FAQ with the name in my YAML.
For the test I set the battery level to 50 % and then I click on run on right 3 dots in the blueprint.
Result: I received the notification on my iPhone and also the notifcation in HO but no entry in the To-Do List…

Where’s my mistake?

Kind regards and thank you in advance,
Ralph

@Eniste

Yea it was a nice break.

Could you again provide us your yaml so I can check it and a screen shot of your to-do list in the UI like mine in the FAQ

Blacky :smiley:

Hey Hoping someone can help me, I’m still a little new to HA and Blueprints.
I have this low battery Blueprint working for most of my battery devices that have a battery entity. However I cannot get my abode sensors to provide a notification when they are low. The sensors have an attribute for “low Battery” true/false but they are the only devices that do not provide a notification in the application
image

Is this supported? or is this User error?

@leitenky

Could you look at maybe take a screen shot of your abode battery in developer tools. See if it provides a state when the battery is low. I can see you have Battery low = true so we need to see what that is reporting to HA in developer tools. Also check to see what another sensor reports when Battery low = false. Form there we can help and worse case you can create another template sensor that will look at the state and then report the state the blueprint will need to be included in the notification.

I can walk you through how to do this but lets see a screen shot from within developer tools of your sensor entity. If you can give me one that Battery low = false and one that Battery low = true.

Blacky :smiley:

@Blacky
Here are the two screenshots you requested.
Thanks again! I’ll have to do it in 2 posts as I’m a new user and there is limits I guess

And the second image

@leitenky

As expected… you will need to create a template binary sensor for your abode sensors. One template binary sensor for each sensor.

To create a Template binary sensor, follow these steps:

  1. Navigate to Settings > Device & Services > Helpers tab at the top.
  2. Click the Create helper button.
  3. Select Template and then choose Template a binary sensor.

Next, provide a Name of your choice. The Device class is battery. You can also link this template to your device so it appears under that device’s details.

In the State template field, add the code below. This one is for your Bar Motion so you would change the entity ID (binary_sensor.bassment_kitchen) for the other sensors.

When you enter this one in you should see Low as the battery status because this one is true. Run the low battery blueprint automation again once done and you should see it in your notification.

{{ state_attr('binary_sensor.bassment_kitchen', 'battery_low') == 'true' }}

Let us know how you go.

Blacky :smiley:

Thanks I’ll try this tonight and report back!

1 Like

I was able to use your suggestion and it resolved my issue, thanks for your help!
Note: I did have to change the "== ‘true’ " to just "== true "

@leitenky

Thanks for letting us know… glad you got it all working now. I sure this post will help others and I may even do a FAQ for it.

Blacky :smiley:

can you allow hidden entities to be ignored please, see below screenshots I am using Battery Notes (GitHub - andrew-codechimp/HA-Battery-Notes: A Home Assistant integration to provide battery notes of devices) which allows you to track when batteries where changed etc, but it uses it own Battery+ entity, and allow you to hide the original entity.

But when using this integration your blueprint finds both battery entities and show them both in the messages.


@andyblac

Thanks for your suggestion, I will put it on the list.

Blacky :smiley:

1 Like

Great blueprint! Didn’t find if it is possible to add sensor location to the low battery message

@romka1977

Welcome to the community.

You would have to do this in the custom actions. I will put it on the list of feature requests.

Blacky :smiley:

1 Like