Releases: andrew-codechimp/HA-Battery-Notes
2.3.1
What's Changed
Ability to add battery notes to entity's as well device's.
When an entity does not have a device, or a device has multiple battery entities you can now manually add a battery note and choose the specific entity you want the battery note associated with.
Discovery will still work on a device level and guess the correct battery so with devices that have multiple battery entities you will have to add these manually.
- Updated Greek translations, thanks Thunderstrike116 via crowdin
Breaking change to automations
This new feature requires a change to the Set battery replaced
service, which now takes both an optional source_entity_id and device_id, one must be specified and source_entity_id is used if both are specified. All events now have data for the source_entity_id as well, which means you can modify your automations based on the events to call the service with both source_entity_id and device_id.
This will not break existing automations, but unless you add the source_entity_id to data any entity associated battery notes will not trigger the battery replaced service.
If you are using notification_id with the device_id this should be changed to also include the entity_id to distinguish multiple battery notes for the same device, e.g. notification_id: "{{ trigger.event.data.device_id }}-{{ trigger.event.data.source_entity_id }}"
If you are using the blueprints these will not be updated until the official release, whilst in beta create your own automations or modify the blueprint manually.
alias: Battery Replaced
description: Battery Replaced
trigger:
- platform: event
event_type: battery_notes_battery_increased
condition: []
action:
- service: battery_notes.set_battery_replaced
data:
device_id: "{{ trigger.event.data.device_id }}"
entity_id: "{{ trigger.event.data.source_entity_id }}"
mode: queued
alias: Battery Low Notification
description: Battery Low Notification with auto dismiss
trigger:
- platform: event
event_type: battery_notes_battery_threshold
event_data:
battery_low: true
id: low
alias: Battery went low
- platform: event
event_type: battery_notes_battery_threshold
event_data:
battery_low: false
id: high
alias: Battery went high
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- low
sequence:
- service: 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:
- service: persistent_notification.dismiss
data:
notification_id: "{{ trigger.event.data.device_id }}-{{ trigger.event.data.source_entity_id }}"
mode: queued
2.3.0
What's Changed
Ability to add battery notes to entity's as well device's.
When an entity does not have a device, or a device has multiple battery entities you can now manually add a battery note and choose the specific entity you want the battery note associated with.
Discovery will still work on a device level and guess the correct battery so with devices that have multiple battery entities you will have to add these manually.
Breaking change to automations
This new feature requires a change to the Set battery replaced
service, which now takes both an optional source_entity_id and device_id, one must be specified and source_entity_id is used if both are specified. All events now have data for the source_entity_id as well, which means you can modify your automations based on the events to call the service with both source_entity_id and device_id.
This will not break existing automations, but unless you add the source_entity_id to data any entity associated battery notes will not trigger the battery replaced service.
If you are using notification_id with the device_id this should be changed to also include the entity_id to distinguish multiple battery notes for the same device, e.g. notification_id: "{{ trigger.event.data.device_id }}-{{ trigger.event.data.source_entity_id }}"
If you are using the blueprints these will not be updated until the official release, whilst in beta create your own automations or modify the blueprint manually.
alias: Battery Replaced
description: Battery Replaced
trigger:
- platform: event
event_type: battery_notes_battery_increased
condition: []
action:
- service: battery_notes.set_battery_replaced
data:
device_id: "{{ trigger.event.data.device_id }}"
entity_id: "{{ trigger.event.data.source_entity_id }}"
mode: queued
alias: Battery Low Notification
description: Battery Low Notification with auto dismiss
trigger:
- platform: event
event_type: battery_notes_battery_threshold
event_data:
battery_low: true
id: low
alias: Battery went low
- platform: event
event_type: battery_notes_battery_threshold
event_data:
battery_low: false
id: high
alias: Battery went high
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- low
sequence:
- service: 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:
- service: persistent_notification.dismiss
data:
notification_id: "{{ trigger.event.data.device_id }}-{{ trigger.event.data.source_entity_id }}"
mode: queued
2.2.8
What's Changed
Add Swedish translation, thanks Daniel Goransson via Crowdin
Update German translation, thanks DJaeger via Crowdin
Update Dutch translation, thanks Jorim Tielemans via Crowdin
Minor bug fixes
2.2.7
What's Changed
Fix deprecation warning in HA 2024.5
Bump min HA version to 2024.1
Updated devcontainer to Python 3.12
Spanish and Catalan language support added, thanks to @Rabosa616 & RmG152 via Crowdin
Updated German translation, thanks to DJaeger via Crowdin
2.2.6
What's Changed
Spanish and Catalan language support added, thanks @Rabosa616
2.2.5
What's Changed
- Handle breaking change with HA 2024.4, thanks @emontnemery for the heads up and PR
- Updated German translation, thanks mikfiala via Crowdin
- Updated Urdu translation, thanks @yousaf465
2.2.4
What's Changed
- Add device_name to Battery+ attributes
- Add optional hw_version to library to differentiate duplicate models with different batteries, thanks @badnetmask for researching this
- Italian translation, thanks to Timoteo.g via Crowd-in
- Updated French translation, thanks to Timoteo.g via Crowdin
- GH Linting Improvements, thanks @bmos
2.2.3
What's Changed
- Add optional hw_version to library to differentiate duplicate models with different batteries, thanks @badnetmask for researching this
- Italian translation, thanks to Timoteo.g via Crowd-in
- Updated French translation, thanks to Timoteo.g via Crowdin
- GH Linting Improvements, thanks @bmos
2.2.1
What's Changed
- Added Check Battery Low service to be able to re-trigger battery low events as a reminder if you didn't action the original.
- Fix previous_battery_level attribute to be a float as per documentation, thanks @uvjim for reporting.
- Remove deprecated @bind_hass decorator
- Updated Russian translations thanks to skrashevich and LordArrin on CrowdIn
- Updated Greek translations thanks to Thunderstrike116 on CrowdIn
2.2.0
What's Changed
- Added Check Battery Low service to be able to re-trigger battery low events as a reminder if you didn't action the original.
- Remove deprecated @bind_hass decorator
- Updated Russian translations thanks to skrashevich on CrowdIn