Skip to content

Instantly share code, notes, and snippets.

@ThePrincelle
Created January 5, 2021 17:59
Show Gist options
  • Save ThePrincelle/b9b1a0fe5c9a881da895411ceb71f38b to your computer and use it in GitHub Desktop.
Save ThePrincelle/b9b1a0fe5c9a881da895411ceb71f38b to your computer and use it in GitHub Desktop.
Home Assistant Blueprint (check battery level on 25 chosen devices and send notification)
blueprint:
name: Battery Level Notification (25)
description:
Send a notification to a device when battery drops below a specified
value - Pick 25 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_entity_10:
name: "Entity_11"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_11:
name: "Entity_12"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_12:
name: "Entity_13"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_13:
name: "Entity_14"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_14:
name: "Entity_15"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_15:
name: "Entity_16"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_16:
name: "Entity_17"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_17:
name: "Entity_18"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_18:
name: "Entity_19"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_19:
name: "Entity_20"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_20:
name: "Entity_21"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_21:
name: "Entity_22"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_22:
name: "Entity_23"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_23:
name: "Entity_24"
selector:
entity:
domain: sensor
device_class: battery
battery_entity_24:
name: "Entity_25"
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"
- platform: numeric_state
entity_id: !input "battery_entity_10"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_11"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_12"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_13"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_14"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_15"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_16"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_17"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_18"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_19"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_20"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_21"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_22"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_23"
below: !input "battery_level"
- platform: numeric_state
entity_id: !input "battery_entity_24"
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"
- conditions:
- condition: numeric_state
entity_id: !input "battery_entity_10"
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_11"
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_12"
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_13"
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_14"
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_15"
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_16"
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_17"
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_18"
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_19"
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_20"
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_21"
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_22"
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_23"
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_24"
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