Community Contributions#
Dashboards#
Battery State Card#
Using the excellent Battery State Card by maxwroc you can easily display devices with their batteries required where the devices battery threshold indicates it's low and show be replaced.
type: custom:battery-state-card
secondary_info: '{attributes.battery_type_and_quantity}'
round: 0
filter:
include:
- name: entity_id
value: '*_battery_plus'
exclude:
- name: attributes.battery_low
value: false
bulk_rename:
- from: "Battery+"
sort:
- state
Automations#
Battery Low Notification#
Raise a persistent notification when a battery is low, dismiss when it's not low
Note
Battery Threshold events are only raised when the device has a Battery+ entity or a Battery Low Template is added to the Battery Notes configuration.
alias: Battery Low Notification
description: Battery Low Notification with auto dismiss
mode: queued
triggers:
- trigger: event
event_type: battery_notes_battery_threshold
event_data:
battery_low: true
id: low
alias: Battery went low
- trigger: event
event_type: battery_notes_battery_threshold
event_data:
battery_low: false
id: high
alias: Battery went high
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- low
sequence:
- action: persistent_notification.create
data:
title: |
{{ trigger.event.data.device_name }} Battery Low
notification_id: "{{ trigger.event.data.device_id }}-{{ trigger.event.data.source_entity_id }}"
message: >
The device has a battery level of {{
trigger.event.data.battery_level }}% {{ '\n' -}} You need {{
trigger.event.data.battery_quantity }}× {{
trigger.event.data.battery_type }}
- conditions:
- condition: trigger
id:
- high
sequence:
- action: persistent_notification.dismiss
data:
notification_id: "{{ trigger.event.data.device_id }}-{{ trigger.event.data.source_entity_id }}"
Check Battery Low daily reminder#
Call the check battery low action every day to raise events for those that are still low.
To be used in conjunction with a Battery Low Notification or similar.
alias: Daily Battery Low Check
description: Check whether a battery is low
mode: single
triggers:
- trigger: time
at: "09:00:00"
conditions: []
actions:
- action: battery_notes.check_battery_low
Check Battery Low weekly reminder#
Weekly reminders are a little trickier, you will need to create a Schedule Helper for when you want the battery check to occur then use this automation for when the helper is on.
Below I am referencing a schedule helper called maintenance which I have set to come on weekly.
To be used in conjunction with a Battery Low Notification or similar.
alias: Battery Low Check
description: Check whether a battery is low
mode: single
triggers:
- trigger: state
entity_id:
- schedule.maintenance
to: "on"
conditions: []
actions:
- action: battery_notes.check_battery_low
data: {}
Battery Replaced#
Mark a battery as replaced when there is an increase in battery level.
Note
Battery Increased events are only raised when the device has a Battery+ entity or a Battery Low Template is added to the Battery Notes configuration.
alias: Battery Replaced
description: Battery Replaced
mode: queued
triggers:
- trigger: event
event_type: battery_notes_battery_increased
conditions: []
actions:
- action: battery_notes.set_battery_replaced
data:
device_id: "{{ trigger.event.data.device_id }}"
source_entity_id: "{{ trigger.event.data.source_entity_id }}"
Send a notification when there is an increase in battery level.
alias: Battery Increased Notification
description: Battery Increased Notification
mode: queued
triggers:
- trigger: event
event_type: battery_notes_battery_increased
conditions: []
actions:
- action: persistent_notification.create
data:
title: |
{{ trigger.event.data.device_name }} Battery Increased
message: >
The device has increased its battery level, you probably want to mark it as replaced
Check Battery Last Reported Daily#
Call the check battery last reported action every day to raise events for those not reported in the last two days.
To be used in conjunction with a Battery Not Reported automation.
alias: Daily Battery Not Reported Check
description: Check whether a battery has reported
mode: single
triggers:
- platform: time
at: "09:00:00"
conditions: []
actions:
- action: battery_notes.check_battery_last_reported
data:
days_last_reported: 2
Battery Not Reported#
Respond to events raised by the check_battery_last_reported action and create notifications.
Note this cannot be run manually as it examines event triggers, use it with the Check Battery Last Reported Daily or similar.
alias: Battery Not Reported
description: Battery not reported
mode: queued
max: 30
triggers:
- trigger: event
event_type: battery_notes_battery_not_reported
conditions: []
actions:
- action: persistent_notification.create
data:
title: |
{{ trigger.event.data.device_name }} Battery Not Reported
message: >
The device has not reported its battery level for {{
trigger.event.data.battery_last_reported_days }} days {{ '\n'
-}} Its last reported level was {{
trigger.event.data.battery_last_reported_level }}% {{ '\n' -}} You need
{{ trigger.event.data.battery_quantity }}× {{
trigger.event.data.battery_type }}
Automation Tips#
To call the battery replaced action from an entity trigger you will need the device_id, here's an easy way to get this
actions:
- action: battery_notes.set_battery_replaced
data:
device_id: "{{ device_id(trigger.entity_id) }}"
Blueprints#
Blueprints are an excellent way to get you up and running with the integration quickly. They can also be used as a guide for setting up new automations which you can tailor to your needs.
Battery Threshold#
This blueprint will allow notifications to be raised and/or custom actions to be performed when the battery threshold is met. It is extended from the example Battery Low Notification automation yaml above for those who'd prefer an easy way to get started.
Battery Replaced#
This blueprint will automatically update the battery replaced sensor and custom actions to be performed when the battery increases. It is extended from the example Battery Replaced automation yaml above for those who'd prefer an easy way to get started.
Battery Not Reported#
This blueprint will allow notifications to be raised and/or custom actions to be performed when the battery not reported event is fired.
It is extended from the example Battery Not Reported automation yaml above for those who'd prefer an easy way to get started.
You must trigger the check_battery_not_reported action via an automation to raise events, see Check Battery Last Reported Daily above.
Contributing#
If you want to contribute then fork the repository, edit this page which is in the docs folder and submit a pull request.