Skip to content

Instantly share code, notes, and snippets.

@tube0013
Last active October 3, 2021 20:45
Show Gist options
  • Select an option

  • Save tube0013/fbf33e4b425fcd7632dd0a253317ae03 to your computer and use it in GitHub Desktop.

Select an option

Save tube0013/fbf33e4b425fcd7632dd0a253317ae03 to your computer and use it in GitHub Desktop.
blueprint:
name: Battery Level Notification 10
description:
Send a notification to a device when battery drops below a specified
value - Pick 10 devices
domain: automation
input:
battery_entity_0:
name: "Entity_01"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_1:
name: "Entity_02"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_2:
name: "Entity_03"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_3:
name: "Entity_04"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_4:
name: "Entity_05"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_5:
name: "Entity_06"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_6:
name: "Entity_07"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_7:
name: "Entity_08"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_8:
name: "Entity_09"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_9:
name: "Entity_10"
selector:
entity:
domain: sensor
device_class: battery
battery_level:
name: Battery level
description: What level the device should be to trigger the notification.
default: 50
selector:
number:
min: 1.0
max: 100.0
unit_of_measurement: "%"
step: 1.0
mode: slider
notify_device:
name: Device to notify
description:
Device needs to run the official Home Assistant app to receive
notifications.
selector:
device:
integration: mobile_app
message:
name: Message
description: 'Default: " {{ entity_name }} battery has dropped to {{ battery_level }}% "'
default: " {{ entity_name }} battery has dropped to {{ battery_level }}% "
trigger:
- platform: numeric_state
entity_id: !input "battery_entity_0"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_1"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_2"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_3"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_4"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_5"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_6"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_7"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_8"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_9"
below: !input "battery_level"
variables:
entity_name: "{{ states[trigger.entity_id].name }}"
battery_level: "{{ states(trigger.entity_id) }}"
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: !input "battery_entity_0"
below: !input "battery_level"
sequence:
domain: mobile_app
type: notify
device_id: !input "notify_device"
message: !input "message"
- conditions:
- condition: numeric_state
entity_id: !input "battery_entity_1"
below: !input "battery_level"
sequence:
domain: mobile_app
type: notify
device_id: !input "notify_device"
message: !input "message"
- conditions:
- condition: numeric_state
entity_id: !input "battery_entity_2"
below: !input "battery_level"
sequence:
domain: mobile_app
type: notify
device_id: !input "notify_device"
message: !input "message"
- conditions:
- condition: numeric_state
entity_id: !input "battery_entity_3"
below: !input "battery_level"
sequence:
domain: mobile_app
type: notify
device_id: !input "notify_device"
message: !input "message"
- conditions:
- condition: numeric_state
entity_id: !input "battery_entity_4"
below: !input "battery_level"
sequence:
domain: mobile_app
type: notify
device_id: !input "notify_device"
message: !input "message"
- conditions:
- condition: numeric_state
entity_id: !input "battery_entity_5"
below: !input "battery_level"
sequence:
domain: mobile_app
type: notify
device_id: !input "notify_device"
message: !input "message"
- conditions:
- condition: numeric_state
entity_id: !input "battery_entity_6"
below: !input "battery_level"
sequence:
domain: mobile_app
type: notify
device_id: !input "notify_device"
message: !input "message"
- conditions:
- condition: numeric_state
entity_id: !input "battery_entity_7"
below: !input "battery_level"
sequence:
domain: mobile_app
type: notify
device_id: !input "notify_device"
message: !input "message"
- conditions:
- condition: numeric_state
entity_id: !input "battery_entity_8"
below: !input "battery_level"
sequence:
domain: mobile_app
type: notify
device_id: !input "notify_device"
message: !input "message"
- conditions:
- condition: numeric_state
entity_id: !input "battery_entity_9"
below: !input "battery_level"
sequence:
domain: mobile_app
type: notify
device_id: !input "notify_device"
message: !input "message"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment