1915 lines
99 KiB
YAML
1915 lines
99 KiB
YAML
blueprint:
|
|
name: Low Battery Notifications & Actions
|
|
description: "# \U0001FAAB Low Battery Notifications & Actions\n**Version: 3.3**\n\n\U0001F680
|
|
Stay Charged, Stay Smart! Let's automate and take charge of your battery maintenance!\U0001F50B⚡\n\n**If
|
|
you like my blueprints, and would like to show your support or just say thank
|
|
you?** [Click Here](https://www.paypal.com/donate/?hosted_button_id=WAZS3QSDTPGA8)
|
|
\U0001F642\n\n<details> <summary><b>The Automation Process:</b> \U0001F448</summary>\n\n
|
|
\ - **Trigger Options:**\n - **Button Helper:** Press a button in the user
|
|
interface (UI) to check battery levels.\n - **Time & Day:** Automatically periodically
|
|
checks battery levels on any given time and day.\n\n - **Battery Sensors:**\n
|
|
\ - Automatically detects all battery sensors used in Home Assistant.\n -
|
|
Choose one or more battery sensor fields to include in notifications — e.g., Friendly
|
|
Name, Floor, Area, Device, or Entity ID.\n - Set a battery low warning percentage
|
|
to identify all batteries below this level.\n - Detects Low, unavailable &
|
|
unknown batteries.\n - Excludes specific battery sensors from notifications.\n
|
|
\ - Create a custom group of battery sensors with its own independent low battery
|
|
warning percentage.\n\n - **Notification Options:**\n - Opt to send messages
|
|
to one or multiple devices.\n - Opt to display your notifications directly
|
|
within the Home Assistant user interface (UI).\n - Opt to display your low
|
|
battery alerts and status on a dashboard.\n - Choose which battery sensors
|
|
to use, and then select their states from one of three preset messages:\n -
|
|
Battery Low % Level + Low Battery Level + Unavailable + Unknown.\n - Battery
|
|
Low % Level & Low Battery Level.\n - Unavailable or Unknown Sensors.\n
|
|
\ - Opt to receive a confirmation message if all batteries are okay.\n -
|
|
Opt to use action buttons in your device notification that allows you to add your
|
|
low batteries to a To-Do list.\n - Compatible with Apple iOS and Android devices.\n\n
|
|
\ - **Custom Actions:**\n - Customize actions to suit your preferences and
|
|
needs, enhancing the automations functionality.\n - Utilize 10 custom predetermined
|
|
battery templates within the blueprint for more tailored and precise actions.\n
|
|
\ - Configure custom actions to include features like customizing notifications
|
|
or playing announcements on platforms like The Voice (HA), Google, Alexa, TTS,
|
|
etc.\n\n - **Custom Conditions:**\n - Enter any custom conditions to further
|
|
customize the automation process.\n</details>\n\nNeed help? \n- FAQ: [Click Here](https://community.home-assistant.io/t/653754/2?u=blacky)\n-
|
|
Community Support Including Updates: [Click Here](https://community.home-assistant.io/t/653754)\n\nRequired
|
|
= *\n"
|
|
domain: automation
|
|
input:
|
|
trigger_settings:
|
|
name: Triggers *
|
|
icon: mdi:cog-outline
|
|
description: 'You must select at least one trigger *
|
|
|
|
'
|
|
collapsed: true
|
|
input:
|
|
include_button:
|
|
name: Use The Button Helper Trigger (Optional)
|
|
description: 'Select if you would like a button helper to trigger the automation.
|
|
This is useful if you would like to check the battery levels by pressing
|
|
a button in the UI.
|
|
|
|
|
|
For more information on how to create a button helper [Click Here](https://community.home-assistant.io/t/653754/4)
|
|
|
|
'
|
|
default: disable_button_trigger
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Use a button trigger
|
|
value: enable_button_trigger
|
|
- label: Dont use a button trigger
|
|
value: disable_button_trigger
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
button_entity:
|
|
name: Button Helper
|
|
description: 'Input your button helper.
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
entity:
|
|
filter:
|
|
- domain:
|
|
- input_button
|
|
multiple: false
|
|
reorder: false
|
|
include_time:
|
|
name: Use The Time Trigger (Optional)
|
|
description: 'Select if you would like to use the time trigger. This is
|
|
useful if you would like to periodically check the battery levels on any
|
|
given time and day.
|
|
|
|
'
|
|
default: time_disabled
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Enable the time options
|
|
value: time_enabled
|
|
- label: Disable the time options
|
|
value: time_disabled
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
time:
|
|
name: Time
|
|
description: 'Set the time you would like to run the automation.
|
|
|
|
'
|
|
default: 00:00:00
|
|
selector:
|
|
time: {}
|
|
weekday_options:
|
|
name: Weekdays
|
|
description: 'Select the days of the week you would like the automation
|
|
to run.
|
|
|
|
'
|
|
default:
|
|
- mon
|
|
- tue
|
|
- wed
|
|
- thu
|
|
- fri
|
|
- sat
|
|
- sun
|
|
selector:
|
|
select:
|
|
multiple: true
|
|
mode: list
|
|
options:
|
|
- label: Monday
|
|
value: mon
|
|
- label: Tuesday
|
|
value: tue
|
|
- label: Wednesday
|
|
value: wed
|
|
- label: Thursday
|
|
value: thu
|
|
- label: Friday
|
|
value: fri
|
|
- label: Saturday
|
|
value: sat
|
|
- label: Sunday
|
|
value: sun
|
|
custom_value: false
|
|
sort: false
|
|
battery_settings:
|
|
name: Battery Settings
|
|
icon: mdi:battery-alert-variant-outline
|
|
collapsed: true
|
|
input:
|
|
battery_sensor_report_fields:
|
|
name: Battery Sensors - Report Fields
|
|
description: 'Select which fields to include when reporting your battery
|
|
sensors. You can choose multiple options, but you must select at least
|
|
one. It''s recommended to select the **Friendly Name** option for clear
|
|
identification. If not, select **Entity ID**, as **Floors**, **Areas**,
|
|
or **Devices** alone may not be assigned to every battery sensor.
|
|
|
|
|
|
**The fields will be reported in this format**
|
|
|
|
|
|
`Friendly Name {Floor} (Area) [Device] - Entity ID`
|
|
|
|
|
|
***Note** - If many sensors are low, selecting all fields may make your
|
|
notifications very long. Some notifications may be cut off and not show
|
|
the full low battery report. It''s recommended to select only the fields
|
|
you need.*
|
|
|
|
'
|
|
default:
|
|
- friendly_name
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Friendly Name
|
|
value: friendly_name
|
|
- label: Floor
|
|
value: floor
|
|
- label: Area
|
|
value: area
|
|
- label: Device
|
|
value: device
|
|
- label: Entity ID
|
|
value: entity_id
|
|
multiple: true
|
|
custom_value: false
|
|
sort: false
|
|
battery_level:
|
|
name: Battery Low Warning Level
|
|
description: 'Set the battery low warning percentage to identify all batteries
|
|
below this level.
|
|
|
|
'
|
|
default: 20
|
|
selector:
|
|
number:
|
|
min: 1.0
|
|
max: 100.0
|
|
step: 1.0
|
|
unit_of_measurement: '%'
|
|
mode: slider
|
|
exclude_sensors:
|
|
name: Excluded Battery Sensors (Optional)
|
|
description: 'Choose the battery sensors to exclude when the automation
|
|
runs.
|
|
|
|
|
|
The automation will attempt to detect all battery sensors in Home Assistant,
|
|
including those of your phones, tablets, smartwatches, and more. However,
|
|
it may not always be necessary or desirable to monitor all of these batteries.
|
|
Selecting those battery sensors here will exclude them from your notifications.
|
|
|
|
'
|
|
default:
|
|
entity_id: []
|
|
selector:
|
|
target:
|
|
entity:
|
|
- device_class:
|
|
- battery
|
|
exclude_hidden_entities:
|
|
name: Exclude Hidden Battery Sensors (Optional)
|
|
description: 'Enable this option to exclude all hidden battery sensors.
|
|
This is useful if you''ve hidden sensors from phones, tablets, smartwatches,
|
|
or other devices you don''t want included in the low battery report.
|
|
|
|
'
|
|
default: hidden_disabled
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Enable - Hidden battery sensors will be excluded
|
|
value: hidden_enabled
|
|
- label: Disable - Hidden battery sensors will be included
|
|
value: hidden_disabled
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
custom_group:
|
|
name: Battery Sensors - Custom Group (Optional)
|
|
description: 'You can select a custom group of battery sensors to be include
|
|
in your notifications, with its own independent `Battery Low Warning Level`
|
|
setting below. This allows you to either set a different warning level
|
|
for devices that require more power (for example, roller blinds) or monitor
|
|
your own custom group of batteries.
|
|
|
|
|
|
When using any **Easy Notify** option and selecting **Use All Battery
|
|
Sensors Minus Excluded Battery Sensors + Custom Group**, it is recommended
|
|
to exclude your custom group of batteries above in the `Excluded Battery
|
|
Sensors` input. This prevents any chance of receiving the same entity
|
|
multiple times in your notifications.
|
|
|
|
|
|
***Note** - All excluded battery sensors are not linked to this custom
|
|
group.*
|
|
|
|
'
|
|
default:
|
|
entity_id: []
|
|
selector:
|
|
target:
|
|
entity:
|
|
- device_class:
|
|
- battery
|
|
custom_group_battery_level:
|
|
name: Custom Group - Battery Low Warning Level
|
|
description: 'Set the battery low warning percentage to identify all batteries
|
|
below this level.
|
|
|
|
'
|
|
default: 20
|
|
selector:
|
|
number:
|
|
min: 1.0
|
|
max: 100.0
|
|
step: 1.0
|
|
unit_of_measurement: '%'
|
|
mode: slider
|
|
easy_notify_device:
|
|
name: Easy Notify - Device
|
|
icon: mdi:devices
|
|
collapsed: true
|
|
input:
|
|
include_easy_notify:
|
|
name: Use The Easy Notify - Device Notification Options (Optional)
|
|
description: 'Enabling this option will send notifications to the selected
|
|
devices below. It allows you to choose which battery sensors to use, and
|
|
then select their states from one of three preset messages. You can also
|
|
opt to receive a confirmation message if all batteries are okay.
|
|
|
|
|
|
To customize your automation further or integrate with voice assistants
|
|
such as The Voice (HA), Google Assistant, Alexa, or TTS, check out the
|
|
custom action options below.
|
|
|
|
'
|
|
default: disabled_easy_notify
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Enable Device Notification
|
|
value: enable_easy_notify
|
|
- label: Enable Device Notification + Okay Confirmation Message
|
|
value: enable_easy_okay_notify
|
|
- label: Disable Device Notification
|
|
value: disabled_easy_notify
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
sensor_selection:
|
|
name: Sensor Selection
|
|
description: 'Select which battery sensors you''d like to include in your
|
|
devices notifications.
|
|
|
|
'
|
|
default: enable_all_sensors
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Use Battery Sensors - Custom Group
|
|
value: enable_battery_sensors_custom_group
|
|
- label: Use All Battery Sensors Minus Excluded Battery Sensors
|
|
value: enable_all_sensors
|
|
- label: Use All Battery Sensors Minus Excluded Battery Sensors + Custom
|
|
Group
|
|
value: enable_all_and_custom_group_sensors
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
notify_device:
|
|
name: Devices Notified (Optional)
|
|
description: 'If you''ve enabled device notifications above, please select
|
|
the devices to receive the notifications.
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
device:
|
|
filter:
|
|
- integration: mobile_app
|
|
multiple: true
|
|
notify_title:
|
|
name: Title
|
|
description: 'Enter in the notification title of your message.
|
|
|
|
'
|
|
default: Low Battery Notification
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
notify_message:
|
|
name: Message
|
|
description: 'Choose one of the three preset messages from the dropdown
|
|
menu.
|
|
|
|
|
|
**1 - Battery Low % Level + Low Battery Level + Unavailable + Unknown**
|
|
Includes sensors with battery percentages below the low warning level,
|
|
in a low battery state, or marked as unavailable or unknown.
|
|
|
|
|
|
**2 - Battery Low % Level & Low Battery Level** Includes sensors with
|
|
battery percentages below the low warning level or in a low battery state.
|
|
|
|
|
|
**3 - Unavailable or Unknown Sensors** Includes sensors that are unavailable
|
|
or have an unknown state.
|
|
|
|
'
|
|
default: all_sensors
|
|
selector:
|
|
select:
|
|
mode: dropdown
|
|
options:
|
|
- label: 1 - Battery Low % Level + Low Battery Level + Unavailable +
|
|
Unknown
|
|
value: all_sensors
|
|
- label: 2 - Battery Low % Level & Low Battery Level
|
|
value: sensors
|
|
- label: 3 - Unavailable or Unknown Sensors
|
|
value: unavailable_sensors
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
notify_okay_message:
|
|
name: Okay Confirmation Message
|
|
description: 'Enter in the notification message you would like to receive
|
|
when all your batteries are okay.
|
|
|
|
'
|
|
default: YES! All batteries are okay :)
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
notify_tag:
|
|
name: Device Notification Tag
|
|
description: 'You can use a tag to keep your notifications organized. When
|
|
a new notification with the same tag is sent, it replaces the old one,
|
|
so you won''t get cluttered with duplicates.
|
|
|
|
|
|
If this input is left blank, no tag will be applied and each notification
|
|
will be treated as separate.
|
|
|
|
|
|
For best results, use short, unique tags for each automation - for example:
|
|
`low-batteries`, `low-batteries-custom-group`, `critical-low-batteries`,
|
|
etc.
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
notify_interruption_level:
|
|
name: Interruption Level - iOS Only
|
|
description: 'On devices running iOS 15 and later, you can configure the
|
|
interruption level for your notifications to ensure they are delivered
|
|
according to your preferences. Choose the desired interruption level from
|
|
the dropdown list. Critical and time-sensitive notifications must be turned
|
|
ON within the Home Assistant App, and time-sensitive notifications must
|
|
be allowed in your Focus settings.
|
|
|
|
|
|
For more information on interruption levels [Click Here](https://community.home-assistant.io/t/653754/192?u=blacky)
|
|
|
|
'
|
|
default: active
|
|
selector:
|
|
select:
|
|
mode: dropdown
|
|
options:
|
|
- label: Default
|
|
value: active
|
|
- label: Critical Notifications
|
|
value: critical
|
|
- label: Time Sensitive Notifications
|
|
value: time-sensitive
|
|
- label: Quiet Notifications Without Waking Screen
|
|
value: passive
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
notify_sound:
|
|
name: Notification Sound - iOS Only
|
|
description: 'The Home Assistant app for iOS includes built-in notification
|
|
sounds, and you can import sounds from your iOS device into the app. Custom
|
|
sounds can also be added via iTunes or from your cloud storage. When entering
|
|
a sound, ensure you use the full filename, including the extension.
|
|
|
|
|
|
For more information on using sounds in the Home Assistant app, [Click
|
|
Here](https://community.home-assistant.io/t/653754/192?u=blacky)
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
notify_data:
|
|
name: Android Only Options (Optional)
|
|
description: '**High Priority** notifications ensure that you receive important
|
|
alerts immediately. These notifications bypass normal delivery delays
|
|
and are delivered instantly to your device.
|
|
|
|
|
|
**Sticky Notification** ensure that important alerts are not dismissed
|
|
when selected. They remain on your notification screen until you actively
|
|
clear or swipe them away, ensuring that critical information stays visible
|
|
until addressed.
|
|
|
|
|
|
**Notification Channel** allow you to easily organize different notification
|
|
settings, including notification sounds, vibrations, and other device-specific
|
|
features. If you choose this option, please enter your desired channel
|
|
name below.
|
|
|
|
|
|
**Icon** allows you to replace the default Home Assistant icon with one
|
|
of your choice. If selected, choose your preferred icon using the **Icon
|
|
- Android Only** option below, and set the icon colour using **Icon Colour
|
|
- Android Only**.
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
select:
|
|
multiple: true
|
|
options:
|
|
- label: High Priority
|
|
value: high_priority
|
|
- label: Sticky Notification
|
|
value: sticky
|
|
- label: Notification Channel
|
|
value: channel
|
|
- label: Icon
|
|
value: icon
|
|
custom_value: false
|
|
sort: false
|
|
notify_channel:
|
|
name: Notification Channel - Android Only
|
|
description: 'If you have chosen to use a notification channel, simply enter
|
|
the name of an existing channel to apply its pre-configured settings.
|
|
If you don''t have a channel yet, you can create a new one by entering
|
|
a name here. When your automation sends the first notification, it will
|
|
create the channel on your device. After the channel is created, you can
|
|
customize its notification settings to your preference directly on your
|
|
device.
|
|
|
|
|
|
For more information on notification channels [Click Here](https://community.home-assistant.io/t/653754/192?u=blacky)
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
notify_icon:
|
|
name: Icon - Android Only
|
|
description: 'Select a custom icon to replace the default Home Assistant
|
|
icon in the notification. This setting applies only if the **Icon** option
|
|
is selected in **Android Only Options** above.
|
|
|
|
'
|
|
default: mdi:emoticon-happy-outline
|
|
selector:
|
|
icon: {}
|
|
notify_icon_colour:
|
|
name: Icon Colour - Android Only
|
|
description: 'Choose a colour for your custom notification icon. This setting
|
|
applies only if the **Icon** option is selected in **Android Only Options**
|
|
above.
|
|
|
|
'
|
|
default:
|
|
- 244
|
|
- 67
|
|
- 54
|
|
selector:
|
|
color_rgb: {}
|
|
easy_notify_device_action_buttons:
|
|
name: Easy Notify - Device Action Buttons
|
|
icon: mdi:gesture-tap-button
|
|
collapsed: true
|
|
input:
|
|
notify_action_buttons:
|
|
name: Easy Notify - Action Buttons (Optional)
|
|
description: 'Add interactive buttons to your **device notifications**,
|
|
allowing you to send items from a low-battery alert directly to one of
|
|
your To-Do lists.
|
|
|
|
|
|
When pressing an action or cancel button, you can choose to do nothing,
|
|
receive a confirmation message, or automatically clear the notification
|
|
from all selected devices.
|
|
|
|
|
|
***Note** - If you select **Add To-Do List Action Buttons + Clear on Action**,
|
|
make sure to set the **Device Notification Tag** in the **Easy Notify
|
|
- Device** section above for this option to work properly.*
|
|
|
|
'
|
|
default: disabled_notify_action_buttons
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Add To-Do List Action Buttons
|
|
value: enable_to_do_list_button
|
|
- label: Add To-Do List Action Buttons + Confirmation Message
|
|
value: enable_to_do_list_button_and_confirmation
|
|
- label: Add To-Do List Action Buttons + Clear on Action
|
|
value: enable_to_do_list_button_and_clear
|
|
- label: Disable Action Buttons
|
|
value: disabled_notify_action_buttons
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
to_do_list:
|
|
name: Easy Notify Action Buttons - To-Do List Selection
|
|
description: 'Choose the To-Do list where you''d like to add your task.
|
|
|
|
|
|
***Note** - The default Shopping List is not compatible because it doesn''t
|
|
support task descriptions.* All other To-Do lists are fully supported.
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
entity:
|
|
filter:
|
|
- domain:
|
|
- todo
|
|
multiple: false
|
|
reorder: false
|
|
to_do_task_title:
|
|
name: Easy Notify Action Buttons - Task Title
|
|
description: 'When the action button is pressed, a new task will be added
|
|
to your selected To-Do list. Enter the title you''d like to use for the
|
|
To-Do task.
|
|
|
|
'
|
|
default: Batteries To Be Replaced
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
action_button_to_do:
|
|
name: Easy Notify Action Buttons - Action Button
|
|
description: 'Specify the label for the action button that will appear in
|
|
your notification. When pressed, this button will add a task to your selected
|
|
To-Do list.
|
|
|
|
'
|
|
default: Add To To-Do List!
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
action_button_cancel:
|
|
name: Easy Notify Action Buttons - Cancel Button
|
|
description: 'Specify the label for the cancel button that will appear in
|
|
your notification. When pressed, this button cancels the task addition
|
|
process.
|
|
|
|
'
|
|
default: Cancel
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
action_button_confirmation_title:
|
|
name: Easy Notify Action Buttons - Action & Cancel Button Confirmation Title
|
|
description: 'Enter the title for the confirmation notification shown when
|
|
either the action or cancel button is pressed.
|
|
|
|
'
|
|
default: Low Battery Confirmation
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
action_button_confirmation_message:
|
|
name: Easy Notify Action Buttons - Action Button Confirmation Message
|
|
description: 'Enter the message for the confirmation notification shown
|
|
when the action button is pressed.
|
|
|
|
'
|
|
default: Your low batteries have been added to your To-Do list
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
cancel_action_button_confirmation_message:
|
|
name: Easy Notify Action Buttons - Cancel Button Confirmation Message
|
|
description: 'Enter the message for the confirmation notification shown
|
|
when the cancel button is pressed.
|
|
|
|
'
|
|
default: Cancelled - Nothing was added to your To-Do list
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
easy_notify_ui:
|
|
name: Easy Notify - UI
|
|
icon: mdi:bell-check-outline
|
|
collapsed: true
|
|
input:
|
|
include_persistent_notification:
|
|
name: Use The Easy Notify - UI Notification Options (Optional)
|
|
description: 'Enabling this option will display notifications directly within
|
|
the Home Assistant user interface (UI). It allows you to choose which
|
|
battery sensors to use, and then select their states from one of three
|
|
preset messages. You can also opt to receive a confirmation message in
|
|
the UI if all batteries are okay.
|
|
|
|
|
|
To customize your automation further or integrate with voice assistants
|
|
such as The Voice (HA), Google Assistant, Alexa, or TTS, check out the
|
|
custom action options below.
|
|
|
|
'
|
|
default: disabled_persistent_notification
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Enable UI Notification
|
|
value: enable_persistent_notification
|
|
- label: Enable UI Notification + Okay Confirmation Message
|
|
value: enable_persistent_okay_notification
|
|
- label: Disable UI Notification
|
|
value: disabled_persistent_notification
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
persistent_sensor_selection:
|
|
name: Sensor Selection
|
|
description: 'Select which battery sensors you''d like to include in your
|
|
UI notifications.
|
|
|
|
'
|
|
default: enable_all_sensors
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Use Battery Sensors - Custom Group
|
|
value: enable_battery_sensors_custom_group
|
|
- label: Use All Battery Sensors Minus Excluded Battery Sensors
|
|
value: enable_all_sensors
|
|
- label: Use All Battery Sensors Minus Excluded Battery Sensors + Custom
|
|
Group
|
|
value: enable_all_and_custom_group_sensors
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
persistent_notify_title:
|
|
name: Title
|
|
description: 'Enter in the notification title of your message.
|
|
|
|
'
|
|
default: "\U0001FAAB Low Battery Notification"
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
persistent_notify_message:
|
|
name: Message
|
|
description: 'Choose one of the three preset messages from the dropdown
|
|
menu.
|
|
|
|
|
|
**1 - Battery Low % Level + Low Battery Level + Unavailable + Unknown**
|
|
Includes sensors with battery percentages below the low warning level,
|
|
in a low battery state, or marked as unavailable or unknown.
|
|
|
|
|
|
**2 - Battery Low % Level & Low Battery Level** Includes sensors with
|
|
battery percentages below the low warning level or in a low battery state.
|
|
|
|
|
|
**3 - Unavailable or Unknown Sensors** Includes sensors that are unavailable
|
|
or have an unknown state.
|
|
|
|
'
|
|
default: all_sensors
|
|
selector:
|
|
select:
|
|
mode: dropdown
|
|
options:
|
|
- label: 1 - Battery Low % Level + Low Battery Level + Unavailable +
|
|
Unknown
|
|
value: all_sensors
|
|
- label: 2 - Battery Low % Level & Low Battery Level
|
|
value: sensors
|
|
- label: 3 - Unavailable or Unknown Sensors
|
|
value: unavailable_sensors
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
persistent_notify_okay_message:
|
|
name: Okay Confirmation Message
|
|
description: 'Enter in the notification message you would like to receive
|
|
when all your batteries are okay.
|
|
|
|
'
|
|
default: YES! All batteries are okay :)
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
persistent_notify_id:
|
|
name: Notification ID
|
|
description: 'You can use a notification ID to keep your notifications organized.
|
|
When a new notification with the same notification ID is sent, it replaces
|
|
the old one, so you won''t get cluttered with duplicates.
|
|
|
|
|
|
If this input is left blank, no notification ID will be applied and each
|
|
notification will be treated as separate.
|
|
|
|
|
|
For best results, use short, unique ID''s for each automation - for example:
|
|
`low-batteries`, `low-batteries-custom-group`, `critical-low-batteries`,
|
|
etc.
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
easy_notify_dashboard:
|
|
name: Easy Notify - Dashboard
|
|
icon: mdi:view-dashboard-variant-outline
|
|
collapsed: true
|
|
input:
|
|
include_dashboard_notification:
|
|
name: Use The Easy Notify - Dashboard Notification Option (Optional)
|
|
description: 'Display your low battery alerts and status on a dashboard
|
|
so everyone can easily see the latest updates at a glance.
|
|
|
|
|
|
For more information on how to use this option and add it to a dashboard,
|
|
[Click Here](https://community.home-assistant.io/t/653754/494)
|
|
|
|
'
|
|
default: disabled_dashboard_notification
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Enable Dashboard Notification + Okay Confirmation Message
|
|
value: enable_dashboard_okay_notification
|
|
- label: Disable Dashboard Notification
|
|
value: disabled_dashboard_notification
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
dashboard_notification_text_helper:
|
|
name: Dashboard Notification - Text Helper
|
|
description: 'Select the **Text Helper** that will store the notification
|
|
message, which can then be shown on a dashboard. This helper will contain
|
|
both the timestamp and the message (up to 255 characters).
|
|
|
|
|
|
***Note** - If there are too many batteries, some may not be displayed.*
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
entity:
|
|
filter:
|
|
- domain:
|
|
- input_text
|
|
multiple: false
|
|
reorder: false
|
|
dashboard_sensor_selection:
|
|
name: Sensor Selection
|
|
description: 'Select which battery sensors you''d like to include in your
|
|
dashboard notifications.
|
|
|
|
'
|
|
default: enable_all_sensors
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Use Battery Sensors - Custom Group
|
|
value: enable_battery_sensors_custom_group
|
|
- label: Use All Battery Sensors Minus Excluded Battery Sensors
|
|
value: enable_all_sensors
|
|
- label: Use All Battery Sensors Minus Excluded Battery Sensors + Custom
|
|
Group
|
|
value: enable_all_and_custom_group_sensors
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
dashboard_notify_message:
|
|
name: Message
|
|
description: 'Choose one of the three preset messages from the dropdown
|
|
menu.
|
|
|
|
|
|
**1 - Battery Low % Level + Low Battery Level + Unavailable + Unknown**
|
|
Includes sensors with battery percentages below the low warning level,
|
|
in a low battery state, or marked as unavailable or unknown.
|
|
|
|
|
|
**2 - Battery Low % Level & Low Battery Level** Includes sensors with
|
|
battery percentages below the low warning level or in a low battery state.
|
|
|
|
|
|
**3 - Unavailable or Unknown Sensors** Includes sensors that are unavailable
|
|
or have an unknown state.
|
|
|
|
'
|
|
default: all_sensors
|
|
selector:
|
|
select:
|
|
mode: dropdown
|
|
options:
|
|
- label: 1 - Battery Low % Level + Low Battery Level + Unavailable +
|
|
Unknown
|
|
value: all_sensors
|
|
- label: 2 - Battery Low % Level & Low Battery Level
|
|
value: sensors
|
|
- label: 3 - Unavailable or Unknown Sensors
|
|
value: unavailable_sensors
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
dashboard_notify_okay_message:
|
|
name: Okay Confirmation Message
|
|
description: 'Enter in the notification message you would like to receive
|
|
when all your batteries are okay.
|
|
|
|
'
|
|
default: YES! All batteries are okay :)
|
|
selector:
|
|
text:
|
|
multiple: false
|
|
multiline: false
|
|
custom_actions_settings:
|
|
name: Custom Actions
|
|
icon: mdi:code-tags
|
|
collapsed: true
|
|
input:
|
|
include_custom_actions:
|
|
name: Use The Custom Action Options (Optional)
|
|
description: 'You can add any custom actions you''d like to run when the
|
|
automation is triggered. This can include sending custom notifications
|
|
or playing voice announcements through The Voice (HA), Google Assistant,
|
|
Alexa, TTS, and more.
|
|
|
|
'
|
|
default: disabled_custom_actions
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: Enable Custom Actions
|
|
value: enable_custom_actions
|
|
- label: Disable Custom Actions
|
|
value: disabled_custom_actions
|
|
multiple: false
|
|
custom_value: false
|
|
sort: false
|
|
custom_actions:
|
|
name: Custom Actions
|
|
description: 'Add your own custom actions to run when the automation is
|
|
triggered.
|
|
|
|
|
|
Below are 10 templates you can use in your actions to control how your
|
|
battery information is displayed or spoken.
|
|
|
|
|
|
**All Battery Sensors Minus Excluded**
|
|
|
|
1 - Use "{{all_sensors}}" for - Battery Low % Level + Low Battery Level
|
|
+ Unavailable + Unknown.
|
|
|
|
2 - Use "{{sensors}}" for - Battery Low % Level & Low Battery Level.
|
|
|
|
3 - Use "{{unavailable_sensors}}" for - Unavailable or Unknown Sensors.
|
|
|
|
4 - Use "{{sensors_names}}" for - Battery Low % Level & Low Battery Level
|
|
- Sensor friendly name only.
|
|
|
|
5 - Use "{{unavailable_sensors_names}}" for - Unavailable or Unknown Sensors
|
|
- Sensor friendly name only.
|
|
|
|
|
|
**Battery Sensors - Custom Group**
|
|
|
|
1 - Use "{{all_sensors_custom_group}}" for - Battery Low % Level + Low
|
|
Battery Level + Unavailable + Unknown.
|
|
|
|
2 - Use "{{sensors_custom_group}}" for - Battery Low % Level & Low Battery
|
|
Level.
|
|
|
|
3 - Use "{{unavailable_sensors_custom_group}}" for - Unavailable or Unknown
|
|
Sensors.
|
|
|
|
4 - Use "{{sensors_names_custom_group}}" for - Battery Low % Level & Low
|
|
Battery Level - Sensor friendly name only.
|
|
|
|
5 - Use "{{unavailable_sensors_names_custom_group}}" for - Unavailable
|
|
or Unknown Sensors - Sensor friendly name only.
|
|
|
|
|
|
For more information on how to use these sensors in your actions [Click
|
|
Here](https://community.home-assistant.io/t/653754/21)
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
action: {}
|
|
global_conditions_settings:
|
|
name: Global Conditions
|
|
icon: mdi:earth
|
|
collapsed: true
|
|
input:
|
|
global_conditions:
|
|
name: Global Conditions
|
|
description: 'Enter any global conditions you would like to apply to the
|
|
automation.
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
condition: {}
|
|
source_url: https://gist.github.com/Blackshome/4010fb83bb8c19b5fa1425526c6ff0e2
|
|
mode: restart
|
|
max_exceeded: silent
|
|
variables:
|
|
include_button: !input include_button
|
|
button_entity: !input button_entity
|
|
include_time: !input include_time
|
|
time: !input time
|
|
weekday_options: !input weekday_options
|
|
battery_sensor_report_fields: !input battery_sensor_report_fields
|
|
battery_level: !input battery_level
|
|
exclude_sensors: !input exclude_sensors
|
|
exclude_hidden_entities: !input exclude_hidden_entities
|
|
custom_group: !input custom_group
|
|
custom_group_battery_level: !input custom_group_battery_level
|
|
include_easy_notify: !input include_easy_notify
|
|
sensor_selection: !input sensor_selection
|
|
notify_device: !input notify_device
|
|
notify_title: !input notify_title
|
|
notify_message: !input notify_message
|
|
notify_tag: !input notify_tag
|
|
notify_okay_message: !input notify_okay_message
|
|
notify_interruption_level: !input notify_interruption_level
|
|
notify_sound: !input notify_sound
|
|
notify_data: !input notify_data
|
|
notify_channel: !input notify_channel
|
|
notify_icon: !input notify_icon
|
|
notify_icon_colour: !input notify_icon_colour
|
|
notify_action_buttons: !input notify_action_buttons
|
|
to_do_list: !input to_do_list
|
|
to_do_task_title: !input to_do_task_title
|
|
action_button_to_do: !input action_button_to_do
|
|
action_button_cancel: !input action_button_cancel
|
|
action_button_confirmation_title: !input action_button_confirmation_title
|
|
action_button_confirmation_message: !input action_button_confirmation_message
|
|
cancel_action_button_confirmation_message: !input cancel_action_button_confirmation_message
|
|
include_persistent_notification: !input include_persistent_notification
|
|
persistent_sensor_selection: !input persistent_sensor_selection
|
|
persistent_notify_title: !input persistent_notify_title
|
|
persistent_notify_message: !input persistent_notify_message
|
|
persistent_notify_okay_message: !input persistent_notify_okay_message
|
|
persistent_notify_id: !input persistent_notify_id
|
|
include_dashboard_notification: !input include_dashboard_notification
|
|
dashboard_notification_text_helper: !input dashboard_notification_text_helper
|
|
dashboard_sensor_selection: !input dashboard_sensor_selection
|
|
dashboard_notify_message: !input dashboard_notify_message
|
|
dashboard_notify_okay_message: !input dashboard_notify_okay_message
|
|
include_custom_actions: !input include_custom_actions
|
|
custom_actions: !input custom_actions
|
|
global_conditions: !input global_conditions
|
|
all_exclude_sensors: "{% set areas = exclude_sensors.area_id if exclude_sensors.area_id
|
|
is defined else [] %} {% if areas is string %}\n {% set areas = [areas] %}\n{%
|
|
endif %} {% set area_entities_list = areas | map('area_entities') | sum(start=[])
|
|
%} {% set devices = exclude_sensors.device_id if exclude_sensors.device_id is
|
|
defined else [] %} {% if devices is string %}\n {% set devices = [devices] %}\n{%
|
|
endif %} {% set device_entities_list = devices | map('device_entities') | sum(start=[])
|
|
%} {% set entity_list = exclude_sensors.entity_id if exclude_sensors.entity_id
|
|
is defined else [] %} {% if entity_list is string %}\n {% set entity_list = [entity_list]
|
|
%}\n{% endif %} {% set labels = exclude_sensors.label_id if exclude_sensors.label_id
|
|
is defined else [] %} {% if labels is string %}\n {% set labels = [labels] %}\n{%
|
|
endif %} {% set label_entities_list = labels | map('label_entities') | sum(start=[])
|
|
| unique | list %} {% if exclude_hidden_entities == 'hidden_enabled' %}\n {%
|
|
set hidden_entities = states | map(attribute='entity_id') | reject('none') | select('is_hidden_entity')
|
|
| unique | list %}\n{% else %}\n {% set hidden_entities = [] %}\n{% endif %}
|
|
{% set all_exclude_sensors = (area_entities_list + device_entities_list + entity_list
|
|
+ label_entities_list + hidden_entities) | unique | list %} {{ all_exclude_sensors
|
|
}}"
|
|
custom_group_sensors: "{% set areas = custom_group.area_id if custom_group.area_id
|
|
is defined else [] %} {% if areas is string %}\n {% set areas = [areas] %}\n{%
|
|
endif %} {% set area_entities_list = areas | map('area_entities') | sum(start=[])
|
|
%} {% set devices = custom_group.device_id if custom_group.device_id is defined
|
|
else [] %} {% if devices is string %}\n {% set devices = [devices] %}\n{% endif
|
|
%} {% set device_entities_list = devices | map('device_entities') | sum(start=[])
|
|
%} {% set entity_list = custom_group.entity_id if custom_group.entity_id is defined
|
|
else [] %} {% if entity_list is string %}\n {% set entity_list = [entity_list]
|
|
%}\n{% endif %} {% set labels = custom_group.label_id if custom_group.label_id
|
|
is defined else [] %} {% if labels is string %}\n {% set labels = [labels] %}\n{%
|
|
endif %} {% set label_entities_list = labels | map('label_entities') | sum(start=[])
|
|
| unique | list %} {% set custom_group_sensors = (area_entities_list + device_entities_list
|
|
+ entity_list + label_entities_list) | unique | list %} {{ custom_group_sensors
|
|
}}"
|
|
device_message_data: "{% set message = namespace(data={}) %} {% set push = namespace(data={})
|
|
%} {% if notify_interruption_level in ['active', 'critical', 'time-sensitive',
|
|
'passive'] %}\n {% set push.data = dict(push.data, **{ 'interruption-level':
|
|
notify_interruption_level }) %}\n{% endif %} {% if notify_sound != [] %}\n {%
|
|
set push.data = dict(push.data, **{ 'sound': notify_sound }) %}\n{% endif %} {%
|
|
if push.data %}\n {% set message.data = dict(message.data, **{ 'push': push.data
|
|
}) %}\n{% endif %} {% if 'high_priority' in notify_data %}\n {% set message.data
|
|
= dict(message.data, **{ 'ttl': 0, 'priority': 'high' }) %}\n{% endif %} {% if
|
|
'channel' in notify_data %}\n {% set message.data = dict(message.data, **{ 'channel':
|
|
notify_channel }) %}\n{% endif %} {% if 'sticky' in notify_data %}\n {% set message.data
|
|
= dict(message.data, **{ 'sticky': \"true\" }) %}\n{% endif %} {% if 'icon' in
|
|
notify_data %}\n {% set message.data = dict(message.data, **{ 'notification_icon':
|
|
notify_icon }) %}\n {% if notify_icon_colour | length == 3 %}\n {% set icon_colour
|
|
= '#%02x%02x%02x' | format(notify_icon_colour[0], notify_icon_colour[1], notify_icon_colour[2])
|
|
%}\n {% set message.data = dict(message.data, **{ 'color': icon_colour }) %}\n
|
|
\ {% endif %}\n{% endif %} {% if notify_tag != [] %}\n {% set message.data =
|
|
dict(message.data, **{ 'tag': notify_tag }) %}\n{% endif %} {{ message.data }}"
|
|
device_message_data_action_button: "{% set message = namespace(data={}) %} {% set
|
|
push = namespace(data={}) %} {% if notify_interruption_level in ['active', 'critical',
|
|
'time-sensitive', 'passive'] %}\n {% set push.data = dict(push.data, **{ 'interruption-level':
|
|
notify_interruption_level }) %}\n{% endif %} {% if notify_sound != [] %}\n {%
|
|
set push.data = dict(push.data, **{ 'sound': notify_sound }) %}\n{% endif %} {%
|
|
if push.data %}\n {% set message.data = dict(message.data, **{ 'push': push.data
|
|
}) %}\n{% endif %} {% if 'high_priority' in notify_data %}\n {% set message.data
|
|
= dict(message.data, **{ 'ttl': 0, 'priority': 'high' }) %}\n{% endif %} {% if
|
|
'channel' in notify_data %}\n {% set message.data = dict(message.data, **{ 'channel':
|
|
notify_channel }) %}\n{% endif %} {% if 'sticky' in notify_data %}\n {% set message.data
|
|
= dict(message.data, **{ 'sticky': \"true\" }) %}\n{% endif %} {% if 'icon' in
|
|
notify_data %}\n {% set message.data = dict(message.data, **{ 'notification_icon':
|
|
notify_icon }) %}\n {% if notify_icon_colour | length == 3 %}\n {% set icon_colour
|
|
= '#%02x%02x%02x' | format(notify_icon_colour[0], notify_icon_colour[1], notify_icon_colour[2])
|
|
%}\n {% set message.data = dict(message.data, **{ 'color': icon_colour }) %}\n
|
|
\ {% endif %}\n{% endif %} {% if notify_tag != [] %}\n {% set message.data =
|
|
dict(message.data, **{ 'tag': notify_tag }) %}\n{% endif %} {% set actions = [\n
|
|
\ {'action': action_button_to_do, 'title': action_button_to_do},\n {'action':
|
|
action_button_cancel, 'title': action_button_cancel}\n] %}\n {% set message.data
|
|
= dict(message.data, **{ 'actions': actions }) %}\n{{ message.data }}"
|
|
device_confirmation_message_data: "{% set message = namespace(data={}) %} {% set
|
|
push = namespace(data={}) %} {% if notify_interruption_level in ['active', 'critical',
|
|
'time-sensitive', 'passive'] %}\n {% set push.data = dict(push.data, **{ 'interruption-level':
|
|
notify_interruption_level }) %}\n{% endif %} {% if notify_sound != [] %}\n {%
|
|
set push.data = dict(push.data, **{ 'sound': notify_sound }) %}\n{% endif %} {%
|
|
if push.data %}\n {% set message.data = dict(message.data, **{ 'push': push.data
|
|
}) %}\n{% endif %} {% if 'high_priority' in notify_data %}\n {% set message.data
|
|
= dict(message.data, **{ 'ttl': 0, 'priority': 'high' }) %}\n{% endif %} {% if
|
|
'channel' in notify_data %}\n {% set message.data = dict(message.data, **{ 'channel':
|
|
notify_channel }) %}\n{% endif %} {% if 'sticky' in notify_data %}\n {% set message.data
|
|
= dict(message.data, **{ 'sticky': \"true\" }) %}\n{% endif %} {% if 'icon' in
|
|
notify_data %}\n {% set message.data = dict(message.data, **{ 'notification_icon':
|
|
notify_icon }) %}\n {% if notify_icon_colour | length == 3 %}\n {% set icon_colour
|
|
= '#%02x%02x%02x' | format(notify_icon_colour[0], notify_icon_colour[1], notify_icon_colour[2])
|
|
%}\n {% set message.data = dict(message.data, **{ 'color': icon_colour }) %}\n
|
|
\ {% endif %}\n{% endif %} {% if notify_tag != [] %}\n {% set message.data =
|
|
dict(message.data, **{ 'tag': notify_tag }) %}\n{% endif %}\n {% set message.data
|
|
= dict(message.data, **{ 'url': \"/todo?entity_id=\" ~ to_do_list, 'clickAction':
|
|
\"/todo?entity_id=\" ~ to_do_list }) %}\n{{ message.data }}"
|
|
all_sensors: "{% set low_battery = namespace(sensors=[]) %} {% for state in states.sensor\n
|
|
\ | rejectattr('attributes.device_class', 'undefined')\n | selectattr('attributes.device_class',
|
|
'==', 'battery') %}\n {% if 0 <= state.state | int(-1) <= battery_level | int
|
|
and state.entity_id not in all_exclude_sensors %}\n {% if 'friendly_name' in
|
|
battery_sensor_report_fields %}\n {% set friendly_name_text = state.name
|
|
%}\n {% else %}\n {% set friendly_name_text = '' %}\n {% endif %}\n
|
|
\ {% if 'floor' in battery_sensor_report_fields %}\n {% set floor = floor_name(state.entity_id)
|
|
%}\n {% set floor_text = ' {' ~ floor ~ '}' if floor is not none else ''
|
|
%}\n {% else %}\n {% set floor_text = '' %}\n {% endif %}\n {% if
|
|
'area' in battery_sensor_report_fields %}\n {% set area = area_name(state.entity_id)
|
|
%}\n {% set area_text = ' (' ~ area ~ ')' if area is not none else '' %}\n
|
|
\ {% else %}\n {% set area_text = '' %}\n {% endif %}\n {% if 'device'
|
|
in battery_sensor_report_fields %}\n {% set dev_id = device_id(state.entity_id)
|
|
%}\n {% if dev_id is not none %}\n {% set dev_name = device_attr(dev_id,
|
|
'name_by_user') or device_attr(dev_id, 'name') %}\n {% set device_text
|
|
= ' [' ~ dev_name ~ ']' if dev_name %}\n {% else %}\n {% set device_text
|
|
= '' %}\n {% endif %}\n {% else %}\n {% set device_text = '' %}\n
|
|
\ {% endif %}\n {% if 'entity_id' in battery_sensor_report_fields %}\n {%
|
|
set entity_id_text = state.entity_id %}\n {% else %}\n {% set entity_id_text
|
|
= '' %}\n {% endif %}\n {% set report_fields = [\n friendly_name_text
|
|
~ floor_text ~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto',
|
|
'') | join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' @ ' ~ state.state ~ '%'] %}\n {% endif %}\n{% endfor %} {% for state in states.binary_sensor\n
|
|
\ | rejectattr('attributes.device_class', 'undefined')\n | selectattr('attributes.device_class',
|
|
'==', 'battery')\n | selectattr('state', 'in', ['on', 'low']) %}\n {% if state.entity_id
|
|
not in all_exclude_sensors %}\n {% if 'friendly_name' in battery_sensor_report_fields
|
|
%}\n {% set friendly_name_text = state.name %}\n {% else %}\n {%
|
|
set friendly_name_text = '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields
|
|
%}\n {% set floor = floor_name(state.entity_id) %}\n {% set floor_text
|
|
= ' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {%
|
|
set floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is low!'] %}\n {% endif %}\n{% endfor %} {% for state in states.sensor\n
|
|
\ | rejectattr('attributes.device_class', 'undefined')\n | selectattr('attributes.device_class',
|
|
'==', 'battery')\n | selectattr('state', 'in', ['unavailable', 'unknown']) %}\n
|
|
\ {% if state.entity_id not in all_exclude_sensors %}\n {% if 'friendly_name'
|
|
in battery_sensor_report_fields %}\n {% set friendly_name_text = state.name
|
|
%}\n {% else %}\n {% set friendly_name_text = '' %}\n {% endif %}\n
|
|
\ {% if 'floor' in battery_sensor_report_fields %}\n {% set floor = floor_name(state.entity_id)
|
|
%}\n {% set floor_text = ' {' ~ floor ~ '}' if floor is not none else ''
|
|
%}\n {% else %}\n {% set floor_text = '' %}\n {% endif %}\n {% if
|
|
'area' in battery_sensor_report_fields %}\n {% set area = area_name(state.entity_id)
|
|
%}\n {% set area_text = ' (' ~ area ~ ')' if area is not none else '' %}\n
|
|
\ {% else %}\n {% set area_text = '' %}\n {% endif %}\n {% if 'device'
|
|
in battery_sensor_report_fields %}\n {% set dev_id = device_id(state.entity_id)
|
|
%}\n {% if dev_id is not none %}\n {% set dev_name = device_attr(dev_id,
|
|
'name_by_user') or device_attr(dev_id, 'name') %}\n {% set device_text
|
|
= ' [' ~ dev_name ~ ']' if dev_name %}\n {% else %}\n {% set device_text
|
|
= '' %}\n {% endif %}\n {% else %}\n {% set device_text = '' %}\n
|
|
\ {% endif %}\n {% if 'entity_id' in battery_sensor_report_fields %}\n {%
|
|
set entity_id_text = state.entity_id %}\n {% else %}\n {% set entity_id_text
|
|
= '' %}\n {% endif %}\n {% set report_fields = [\n friendly_name_text
|
|
~ floor_text ~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto',
|
|
'') | join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is ' ~ state.state ~ '!'] %}\n {% endif %}\n{% endfor %} {% for state in
|
|
states.binary_sensor\n | rejectattr('attributes.device_class', 'undefined')\n
|
|
\ | selectattr('attributes.device_class', '==', 'battery')\n | selectattr('state',
|
|
'in', ['unavailable', 'unknown']) %}\n {% if state.entity_id not in all_exclude_sensors
|
|
%}\n {% if 'friendly_name' in battery_sensor_report_fields %}\n {% set
|
|
friendly_name_text = state.name %}\n {% else %}\n {% set friendly_name_text
|
|
= '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields %}\n
|
|
\ {% set floor = floor_name(state.entity_id) %}\n {% set floor_text =
|
|
' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {% set
|
|
floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is ' ~ state.state ~ '!'] %}\n {% endif %}\n{% endfor %} {{ low_battery.sensors
|
|
| join(', ') }}"
|
|
sensors: "{% set low_battery = namespace(sensors=[]) %} {% for state in states.sensor\n
|
|
\ | rejectattr('attributes.device_class', 'undefined')\n | selectattr('attributes.device_class',
|
|
'==', 'battery') %}\n {% if 0 <= state.state | int(-1) <= battery_level | int
|
|
and state.entity_id not in all_exclude_sensors %}\n {% if 'friendly_name' in
|
|
battery_sensor_report_fields %}\n {% set friendly_name_text = state.name
|
|
%}\n {% else %}\n {% set friendly_name_text = '' %}\n {% endif %}\n
|
|
\ {% if 'floor' in battery_sensor_report_fields %}\n {% set floor = floor_name(state.entity_id)
|
|
%}\n {% set floor_text = ' {' ~ floor ~ '}' if floor is not none else ''
|
|
%}\n {% else %}\n {% set floor_text = '' %}\n {% endif %}\n {% if
|
|
'area' in battery_sensor_report_fields %}\n {% set area = area_name(state.entity_id)
|
|
%}\n {% set area_text = ' (' ~ area ~ ')' if area is not none else '' %}\n
|
|
\ {% else %}\n {% set area_text = '' %}\n {% endif %}\n {% if 'device'
|
|
in battery_sensor_report_fields %}\n {% set dev_id = device_id(state.entity_id)
|
|
%}\n {% if dev_id is not none %}\n {% set dev_name = device_attr(dev_id,
|
|
'name_by_user') or device_attr(dev_id, 'name') %}\n {% set device_text
|
|
= ' [' ~ dev_name ~ ']' if dev_name %}\n {% else %}\n {% set device_text
|
|
= '' %}\n {% endif %}\n {% else %}\n {% set device_text = '' %}\n
|
|
\ {% endif %}\n {% if 'entity_id' in battery_sensor_report_fields %}\n {%
|
|
set entity_id_text = state.entity_id %}\n {% else %}\n {% set entity_id_text
|
|
= '' %}\n {% endif %}\n {% set report_fields = [\n friendly_name_text
|
|
~ floor_text ~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto',
|
|
'') | join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' @ ' ~ state.state ~ '%'] %}\n {% endif %}\n{% endfor %} {% for state in states.binary_sensor\n
|
|
\ | rejectattr('attributes.device_class', 'undefined')\n | selectattr('attributes.device_class',
|
|
'==', 'battery')\n | selectattr('state', 'in', ['on', 'low']) %}\n {% if state.entity_id
|
|
not in all_exclude_sensors %}\n {% if 'friendly_name' in battery_sensor_report_fields
|
|
%}\n {% set friendly_name_text = state.name %}\n {% else %}\n {%
|
|
set friendly_name_text = '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields
|
|
%}\n {% set floor = floor_name(state.entity_id) %}\n {% set floor_text
|
|
= ' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {%
|
|
set floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is low!'] %}\n {% endif %}\n{% endfor %} {{ low_battery.sensors | join(',
|
|
') }}"
|
|
unavailable_sensors: "{% set low_battery = namespace(sensors=[]) %} {% for state
|
|
in states.sensor\n | rejectattr('attributes.device_class', 'undefined')\n |
|
|
selectattr('attributes.device_class', '==', 'battery')\n | selectattr('state',
|
|
'in', ['unavailable', 'unknown']) %}\n {% if state.entity_id not in all_exclude_sensors
|
|
%}\n {% if 'friendly_name' in battery_sensor_report_fields %}\n {% set
|
|
friendly_name_text = state.name %}\n {% else %}\n {% set friendly_name_text
|
|
= '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields %}\n
|
|
\ {% set floor = floor_name(state.entity_id) %}\n {% set floor_text =
|
|
' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {% set
|
|
floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is ' ~ state.state ~ '!'] %}\n {% endif %}\n{% endfor %} {% for state in
|
|
states.binary_sensor\n | rejectattr('attributes.device_class', 'undefined')\n
|
|
\ | selectattr('attributes.device_class', '==', 'battery')\n | selectattr('state',
|
|
'in', ['unavailable', 'unknown']) %}\n {% if state.entity_id not in all_exclude_sensors
|
|
%}\n {% if 'friendly_name' in battery_sensor_report_fields %}\n {% set
|
|
friendly_name_text = state.name %}\n {% else %}\n {% set friendly_name_text
|
|
= '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields %}\n
|
|
\ {% set floor = floor_name(state.entity_id) %}\n {% set floor_text =
|
|
' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {% set
|
|
floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is ' ~ state.state ~ '!'] %}\n {% endif %}\n{% endfor %} {{ low_battery.sensors
|
|
| join(', ') }}"
|
|
sensors_names: "{% set low_battery = namespace(sensors=[]) %} {% for state in states.sensor\n
|
|
\ | rejectattr('attributes.device_class', 'undefined')\n | selectattr('attributes.device_class',
|
|
'==', 'battery') %}\n {% if 0 <= state.state | int(-1) <= battery_level | int
|
|
and state.entity_id not in all_exclude_sensors %}\n {% set low_battery.sensors
|
|
= low_battery.sensors + [state.name] %}\n {% endif %}\n{% endfor %} {% for state
|
|
in states.binary_sensor\n | rejectattr('attributes.device_class', 'undefined')\n
|
|
\ | selectattr('attributes.device_class', '==', 'battery')\n | selectattr('state',
|
|
'in', ['on', 'low']) %}\n {% if state.entity_id not in all_exclude_sensors %}\n
|
|
\ {% set low_battery.sensors = low_battery.sensors + [state.name] %}\n {% endif
|
|
%}\n{% endfor %} {{low_battery.sensors | join(', ')}}"
|
|
unavailable_sensors_names: "{% set low_battery = namespace(sensors=[]) %} {% for
|
|
state in states.sensor\n | rejectattr('attributes.device_class', 'undefined')\n
|
|
\ | selectattr('attributes.device_class', '==', 'battery')\n | selectattr('state',
|
|
'in', ['unavailable', 'unknown']) %}\n {% if state.entity_id not in all_exclude_sensors
|
|
%}\n {% set low_battery.sensors = low_battery.sensors + [state.name] %}\n {%
|
|
endif %}\n{% endfor %} {% for state in states.binary_sensor\n | rejectattr('attributes.device_class',
|
|
'undefined')\n | selectattr('attributes.device_class', '==', 'battery')\n |
|
|
selectattr('state', 'in', ['unavailable', 'unknown']) %}\n {% if state.entity_id
|
|
not in all_exclude_sensors %}\n {% set low_battery.sensors = low_battery.sensors
|
|
+ [state.name] %}\n {% endif %}\n{% endfor %} {{low_battery.sensors | join(',
|
|
')}}"
|
|
all_sensors_custom_group: "{% set low_battery = namespace(sensors=[]) %} {% for
|
|
state in states.sensor\n | rejectattr('attributes.device_class', 'undefined')\n
|
|
\ | selectattr('attributes.device_class', '==', 'battery') %}\n {% if 0 <= state.state
|
|
| int(-1) <= custom_group_battery_level | int and state.entity_id in custom_group_sensors
|
|
%}\n {% if 'friendly_name' in battery_sensor_report_fields %}\n {% set
|
|
friendly_name_text = state.name %}\n {% else %}\n {% set friendly_name_text
|
|
= '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields %}\n
|
|
\ {% set floor = floor_name(state.entity_id) %}\n {% set floor_text =
|
|
' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {% set
|
|
floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' @ ' ~ state.state ~ '%'] %}\n {% endif %}\n{% endfor %} {% for state in states.binary_sensor\n
|
|
\ | rejectattr('attributes.device_class', 'undefined')\n | selectattr('attributes.device_class',
|
|
'==', 'battery')\n | selectattr('state', 'in', ['on', 'low']) %}\n {% if state.entity_id
|
|
in custom_group_sensors %}\n {% if 'friendly_name' in battery_sensor_report_fields
|
|
%}\n {% set friendly_name_text = state.name %}\n {% else %}\n {%
|
|
set friendly_name_text = '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields
|
|
%}\n {% set floor = floor_name(state.entity_id) %}\n {% set floor_text
|
|
= ' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {%
|
|
set floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is low!'] %}\n {% endif %}\n{% endfor %} {% for state in states.sensor\n
|
|
\ | rejectattr('attributes.device_class', 'undefined')\n | selectattr('attributes.device_class',
|
|
'==', 'battery')\n | selectattr('state', 'in', ['unavailable', 'unknown']) %}\n
|
|
\ {% if state.entity_id in custom_group_sensors %}\n {% if 'friendly_name'
|
|
in battery_sensor_report_fields %}\n {% set friendly_name_text = state.name
|
|
%}\n {% else %}\n {% set friendly_name_text = '' %}\n {% endif %}\n
|
|
\ {% if 'floor' in battery_sensor_report_fields %}\n {% set floor = floor_name(state.entity_id)
|
|
%}\n {% set floor_text = ' {' ~ floor ~ '}' if floor is not none else ''
|
|
%}\n {% else %}\n {% set floor_text = '' %}\n {% endif %}\n {% if
|
|
'area' in battery_sensor_report_fields %}\n {% set area = area_name(state.entity_id)
|
|
%}\n {% set area_text = ' (' ~ area ~ ')' if area is not none else '' %}\n
|
|
\ {% else %}\n {% set area_text = '' %}\n {% endif %}\n {% if 'device'
|
|
in battery_sensor_report_fields %}\n {% set dev_id = device_id(state.entity_id)
|
|
%}\n {% if dev_id is not none %}\n {% set dev_name = device_attr(dev_id,
|
|
'name_by_user') or device_attr(dev_id, 'name') %}\n {% set device_text
|
|
= ' [' ~ dev_name ~ ']' if dev_name %}\n {% else %}\n {% set device_text
|
|
= '' %}\n {% endif %}\n {% else %}\n {% set device_text = '' %}\n
|
|
\ {% endif %}\n {% if 'entity_id' in battery_sensor_report_fields %}\n {%
|
|
set entity_id_text = state.entity_id %}\n {% else %}\n {% set entity_id_text
|
|
= '' %}\n {% endif %}\n {% set report_fields = [\n friendly_name_text
|
|
~ floor_text ~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto',
|
|
'') | join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is ' ~ state.state ~ '!'] %}\n {% endif %}\n{% endfor %} {% for state in
|
|
states.binary_sensor\n | rejectattr('attributes.device_class', 'undefined')\n
|
|
\ | selectattr('attributes.device_class', '==', 'battery')\n | selectattr('state',
|
|
'in', ['unavailable', 'unknown']) %}\n {% if state.entity_id in custom_group_sensors
|
|
%}\n {% if 'friendly_name' in battery_sensor_report_fields %}\n {% set
|
|
friendly_name_text = state.name %}\n {% else %}\n {% set friendly_name_text
|
|
= '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields %}\n
|
|
\ {% set floor = floor_name(state.entity_id) %}\n {% set floor_text =
|
|
' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {% set
|
|
floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is ' ~ state.state ~ '!'] %}\n {% endif %}\n{% endfor %} {{ low_battery.sensors
|
|
| join(', ') }}"
|
|
sensors_custom_group: "{% set low_battery = namespace(sensors=[]) %} {% for state
|
|
in states.sensor\n | rejectattr('attributes.device_class', 'undefined')\n |
|
|
selectattr('attributes.device_class', '==', 'battery') %}\n {% if 0 <= state.state
|
|
| int(-1) <= custom_group_battery_level | int and state.entity_id in custom_group_sensors
|
|
%}\n {% if 'friendly_name' in battery_sensor_report_fields %}\n {% set
|
|
friendly_name_text = state.name %}\n {% else %}\n {% set friendly_name_text
|
|
= '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields %}\n
|
|
\ {% set floor = floor_name(state.entity_id) %}\n {% set floor_text =
|
|
' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {% set
|
|
floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' @ ' ~ state.state ~ '%'] %}\n {% endif %}\n{% endfor %} {% for state in states.binary_sensor\n
|
|
\ | rejectattr('attributes.device_class', 'undefined')\n | selectattr('attributes.device_class',
|
|
'==', 'battery')\n | selectattr('state', 'in', ['on', 'low']) %}\n {% if state.entity_id
|
|
in custom_group_sensors %}\n {% if 'friendly_name' in battery_sensor_report_fields
|
|
%}\n {% set friendly_name_text = state.name %}\n {% else %}\n {%
|
|
set friendly_name_text = '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields
|
|
%}\n {% set floor = floor_name(state.entity_id) %}\n {% set floor_text
|
|
= ' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {%
|
|
set floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is low!'] %}\n {% endif %}\n{% endfor %} {{ low_battery.sensors | join(',
|
|
') }}"
|
|
unavailable_sensors_custom_group: "{% set low_battery = namespace(sensors=[]) %}
|
|
{% for state in states.sensor\n | rejectattr('attributes.device_class', 'undefined')\n
|
|
\ | selectattr('attributes.device_class', '==', 'battery')\n | selectattr('state',
|
|
'in', ['unavailable', 'unknown']) %}\n {% if state.entity_id in custom_group_sensors
|
|
%}\n {% if 'friendly_name' in battery_sensor_report_fields %}\n {% set
|
|
friendly_name_text = state.name %}\n {% else %}\n {% set friendly_name_text
|
|
= '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields %}\n
|
|
\ {% set floor = floor_name(state.entity_id) %}\n {% set floor_text =
|
|
' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {% set
|
|
floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is ' ~ state.state ~ '!'] %}\n {% endif %}\n{% endfor %} {% for state in
|
|
states.binary_sensor\n | rejectattr('attributes.device_class', 'undefined')\n
|
|
\ | selectattr('attributes.device_class', '==', 'battery')\n | selectattr('state',
|
|
'in', ['unavailable', 'unknown']) %}\n {% if state.entity_id in custom_group_sensors
|
|
%}\n {% if 'friendly_name' in battery_sensor_report_fields %}\n {% set
|
|
friendly_name_text = state.name %}\n {% else %}\n {% set friendly_name_text
|
|
= '' %}\n {% endif %}\n {% if 'floor' in battery_sensor_report_fields %}\n
|
|
\ {% set floor = floor_name(state.entity_id) %}\n {% set floor_text =
|
|
' {' ~ floor ~ '}' if floor is not none else '' %}\n {% else %}\n {% set
|
|
floor_text = '' %}\n {% endif %}\n {% if 'area' in battery_sensor_report_fields
|
|
%}\n {% set area = area_name(state.entity_id) %}\n {% set area_text
|
|
= ' (' ~ area ~ ')' if area is not none else '' %}\n {% else %}\n {% set
|
|
area_text = '' %}\n {% endif %}\n {% if 'device' in battery_sensor_report_fields
|
|
%}\n {% set dev_id = device_id(state.entity_id) %}\n {% if dev_id is
|
|
not none %}\n {% set dev_name = device_attr(dev_id, 'name_by_user') or
|
|
device_attr(dev_id, 'name') %}\n {% set device_text = ' [' ~ dev_name ~
|
|
']' if dev_name %}\n {% else %}\n {% set device_text = '' %}\n {%
|
|
endif %}\n {% else %}\n {% set device_text = '' %}\n {% endif %}\n
|
|
\ {% if 'entity_id' in battery_sensor_report_fields %}\n {% set entity_id_text
|
|
= state.entity_id %}\n {% else %}\n {% set entity_id_text = '' %}\n {%
|
|
endif %}\n {% set report_fields = [\n friendly_name_text ~ floor_text
|
|
~ area_text ~ device_text,\n entity_id_text\n ] | reject('equalto', '')
|
|
| join(' - ') %}\n {% set low_battery.sensors = low_battery.sensors + [report_fields
|
|
~ ' is ' ~ state.state ~ '!'] %}\n {% endif %}\n{% endfor %} {{ low_battery.sensors
|
|
| join(', ') }}"
|
|
sensors_names_custom_group: "{% set low_battery = namespace(sensors=[]) %} {% for
|
|
state in states.sensor\n | rejectattr('attributes.device_class', 'undefined')\n
|
|
\ | selectattr('attributes.device_class', '==', 'battery') %}\n {% if 0 <= state.state
|
|
| int(-1) <= custom_group_battery_level | int and state.entity_id in custom_group_sensors
|
|
%}\n {% set low_battery.sensors = low_battery.sensors + [state.name] %}\n {%
|
|
endif %}\n{% endfor %} {% for state in states.binary_sensor\n | rejectattr('attributes.device_class',
|
|
'undefined')\n | selectattr('attributes.device_class', '==', 'battery')\n |
|
|
selectattr('state', 'in', ['on', 'low']) %}\n {% if state.entity_id in custom_group_sensors
|
|
%}\n {% set low_battery.sensors = low_battery.sensors + [state.name] %}\n {%
|
|
endif %}\n{% endfor %} {{ low_battery.sensors | join(', ') }}"
|
|
unavailable_sensors_names_custom_group: "{% set low_battery = namespace(sensors=[])
|
|
%} {% for state in states.sensor\n | rejectattr('attributes.device_class', 'undefined')\n
|
|
\ | selectattr('attributes.device_class', '==', 'battery')\n | selectattr('state',
|
|
'in', ['unavailable', 'unknown']) %}\n {% if state.entity_id in custom_group_sensors
|
|
%}\n {% set low_battery.sensors = low_battery.sensors + [state.name] %}\n {%
|
|
endif %}\n{% endfor %} {% for state in states.binary_sensor\n | rejectattr('attributes.device_class',
|
|
'undefined')\n | selectattr('attributes.device_class', '==', 'battery')\n |
|
|
selectattr('state', 'in', ['unavailable', 'unknown']) %}\n {% if state.entity_id
|
|
in custom_group_sensors %}\n {% set low_battery.sensors = low_battery.sensors
|
|
+ [state.name] %}\n {% endif %}\n{% endfor %} {{ low_battery.sensors | join(',
|
|
') }}"
|
|
easy_notify_message: "{% set low_battery = namespace(sensors=[]) %} {% if sensor_selection
|
|
== 'enable_battery_sensors_custom_group' and notify_message == 'all_sensors' %}\n
|
|
\ {{all_sensors_custom_group|replace(', ', '\\n')}}\n{% elif sensor_selection
|
|
== 'enable_battery_sensors_custom_group' and notify_message == 'sensors'%}\n {{sensors_custom_group|replace(',
|
|
', '\\n')}}\n{% elif sensor_selection == 'enable_battery_sensors_custom_group'
|
|
and notify_message == 'unavailable_sensors'%}\n {{unavailable_sensors_custom_group|replace(',
|
|
', '\\n')}}\n{% elif sensor_selection == 'enable_all_sensors' and notify_message
|
|
== 'all_sensors' %}\n {{all_sensors|replace(', ', '\\n')}}\n{% elif sensor_selection
|
|
== 'enable_all_sensors' and notify_message == 'sensors'%}\n {{sensors|replace(',
|
|
', '\\n')}}\n{% elif sensor_selection == 'enable_all_sensors' and notify_message
|
|
== 'unavailable_sensors'%}\n {{unavailable_sensors|replace(', ', '\\n')}}\n{%
|
|
elif sensor_selection == 'enable_all_and_custom_group_sensors' and notify_message
|
|
== 'all_sensors' %}\n {{all_sensors|replace(', ', '\\n')}}{{'\\n'}}{{all_sensors_custom_group|replace(',
|
|
', '\\n')}}\n{% elif sensor_selection == 'enable_all_and_custom_group_sensors'
|
|
and notify_message == 'sensors'%}\n {{sensors|replace(', ', '\\n')}}{{'\\n'}}{{sensors_custom_group|replace(',
|
|
', '\\n')}}\n{% elif sensor_selection == 'enable_all_and_custom_group_sensors'
|
|
and notify_message == 'unavailable_sensors'%}\n {{unavailable_sensors|replace(',
|
|
', '\\n')}}{{'\\n'}}{{unavailable_sensors_custom_group|replace(', ', '\\n')}}\n{%
|
|
else %}\n []\n{% endif %}"
|
|
persistent_easy_notify_message: "{% set low_battery = namespace(sensors=[]) %} {%
|
|
if persistent_sensor_selection == 'enable_battery_sensors_custom_group' and persistent_notify_message
|
|
== 'all_sensors' %}\n {{all_sensors_custom_group|replace(', ', '\\n')}}\n{% elif
|
|
persistent_sensor_selection == 'enable_battery_sensors_custom_group' and persistent_notify_message
|
|
== 'sensors'%}\n {{sensors_custom_group|replace(', ', '\\n')}}\n{% elif persistent_sensor_selection
|
|
== 'enable_battery_sensors_custom_group' and persistent_notify_message == 'unavailable_sensors'%}\n
|
|
\ {{unavailable_sensors_custom_group|replace(', ', '\\n')}}\n{% elif persistent_sensor_selection
|
|
== 'enable_all_sensors' and persistent_notify_message == 'all_sensors' %}\n {{all_sensors|replace(',
|
|
', '\\n')}}\n{% elif persistent_sensor_selection == 'enable_all_sensors' and persistent_notify_message
|
|
== 'sensors'%}\n {{sensors|replace(', ', '\\n')}}\n{% elif persistent_sensor_selection
|
|
== 'enable_all_sensors' and persistent_notify_message == 'unavailable_sensors'%}\n
|
|
\ {{unavailable_sensors|replace(', ', '\\n')}}\n{% elif persistent_sensor_selection
|
|
== 'enable_all_and_custom_group_sensors' and persistent_notify_message == 'all_sensors'
|
|
%}\n {{all_sensors|replace(', ', '\\n')}}{{'\\n'}}{{all_sensors_custom_group|replace(',
|
|
', '\\n')}}\n{% elif persistent_sensor_selection == 'enable_all_and_custom_group_sensors'
|
|
and persistent_notify_message == 'sensors'%}\n {{sensors|replace(', ', '\\n')}}{{'\\n'}}{{sensors_custom_group|replace(',
|
|
', '\\n')}}\n{% elif persistent_sensor_selection == 'enable_all_and_custom_group_sensors'
|
|
and persistent_notify_message == 'unavailable_sensors'%}\n {{unavailable_sensors|replace(',
|
|
', '\\n')}}{{'\\n'}}{{unavailable_sensors_custom_group|replace(', ', '\\n')}}\n{%
|
|
else %}\n []\n{% endif %}"
|
|
persistent_message_data: "{% set message = namespace(data={}) %} {% set message.data
|
|
= dict(message.data, title=persistent_notify_title, message=persistent_easy_notify_message)
|
|
%} {% if persistent_notify_id != [] %}\n {% set message.data = dict(message.data,
|
|
**{ 'notification_id': persistent_notify_id }) %}\n{% endif %} {{ message.data
|
|
}}"
|
|
persistent_okay_message_data: "{% set message = namespace(data={}) %} {% set message.data
|
|
= dict(message.data, title=persistent_notify_title, message=persistent_notify_okay_message)
|
|
%} {% if persistent_notify_id != [] %}\n {% set message.data = dict(message.data,
|
|
**{ 'notification_id': persistent_notify_id }) %}\n{% endif %} {{ message.data
|
|
}}"
|
|
dashboard_easy_notify_message: "{% set low_battery = namespace(sensors=[]) %} {%
|
|
if dashboard_sensor_selection == 'enable_battery_sensors_custom_group' and dashboard_notify_message
|
|
== 'all_sensors' %}\n {{all_sensors_custom_group|replace(', ', '\\n')}}\n{% elif
|
|
dashboard_sensor_selection == 'enable_battery_sensors_custom_group' and dashboard_notify_message
|
|
== 'sensors'%}\n {{sensors_custom_group|replace(', ', '\\n')}}\n{% elif dashboard_sensor_selection
|
|
== 'enable_battery_sensors_custom_group' and dashboard_notify_message == 'unavailable_sensors'%}\n
|
|
\ {{unavailable_sensors_custom_group|replace(', ', '\\n')}}\n{% elif dashboard_sensor_selection
|
|
== 'enable_all_sensors' and dashboard_notify_message == 'all_sensors' %}\n {{all_sensors|replace(',
|
|
', '\\n')}}\n{% elif dashboard_sensor_selection == 'enable_all_sensors' and dashboard_notify_message
|
|
== 'sensors'%}\n {{sensors|replace(', ', '\\n')}}\n{% elif dashboard_sensor_selection
|
|
== 'enable_all_sensors' and dashboard_notify_message == 'unavailable_sensors'%}\n
|
|
\ {{unavailable_sensors|replace(', ', '\\n')}}\n{% elif dashboard_sensor_selection
|
|
== 'enable_all_and_custom_group_sensors' and dashboard_notify_message == 'all_sensors'
|
|
%}\n {{all_sensors|replace(', ', '\\n')}}{{'\\n'}}{{all_sensors_custom_group|replace(',
|
|
', '\\n')}}\n{% elif dashboard_sensor_selection == 'enable_all_and_custom_group_sensors'
|
|
and dashboard_notify_message == 'sensors'%}\n {{sensors|replace(', ', '\\n')}}{{'\\n'}}{{sensors_custom_group|replace(',
|
|
', '\\n')}}\n{% elif dashboard_sensor_selection == 'enable_all_and_custom_group_sensors'
|
|
and dashboard_notify_message == 'unavailable_sensors'%}\n {{unavailable_sensors|replace(',
|
|
', '\\n')}}{{'\\n'}}{{unavailable_sensors_custom_group|replace(', ', '\\n')}}\n{%
|
|
else %}\n []\n{% endif %}"
|
|
triggers:
|
|
- trigger: state
|
|
entity_id: !input button_entity
|
|
id: t0
|
|
- trigger: time
|
|
at: !input time
|
|
id: t1
|
|
condition:
|
|
- condition: or
|
|
conditions:
|
|
- condition: and
|
|
conditions:
|
|
- condition: trigger
|
|
id: t0
|
|
- '{{ include_button == ''enable_button_trigger'' }}'
|
|
- condition: and
|
|
conditions:
|
|
- condition: trigger
|
|
id: t1
|
|
- '{{ include_time == ''time_enabled'' }}'
|
|
- condition: or
|
|
conditions:
|
|
- '{{ include_time == ''time_disabled'' }}'
|
|
- condition: and
|
|
conditions:
|
|
- condition: time
|
|
weekday: !input weekday_options
|
|
- '{{ include_time == ''time_enabled'' }}'
|
|
- condition: trigger
|
|
id: t0
|
|
- condition: and
|
|
conditions: !input global_conditions
|
|
action:
|
|
- choose:
|
|
- alias: Perform the custom actions
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ include_custom_actions == ''enable_custom_actions'' }}'
|
|
sequence: !input custom_actions
|
|
- choose:
|
|
- alias: Use the easy notify device options
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ (include_easy_notify == ''enable_easy_notify'') or (include_easy_notify
|
|
== ''enable_easy_okay_notify'') }}'
|
|
- condition: template
|
|
value_template: '{{ notify_device | length > 0 }}'
|
|
sequence:
|
|
- alias: Send a notification to each device
|
|
repeat:
|
|
for_each: !input notify_device
|
|
sequence:
|
|
- choose:
|
|
- alias: Sensors have been found
|
|
conditions:
|
|
- '{{ easy_notify_message != '''' }}'
|
|
sequence:
|
|
- choose:
|
|
- alias: Easy notify with no action button
|
|
conditions:
|
|
- '{{ notify_action_buttons == ''disabled_notify_action_buttons''
|
|
}}'
|
|
sequence:
|
|
- action: notify.mobile_app_{{ device_attr(repeat.item, 'name') |
|
|
slugify }}
|
|
data:
|
|
title: !input notify_title
|
|
message: '{{easy_notify_message}}'
|
|
data: '{{ device_message_data }}'
|
|
continue_on_error: true
|
|
- alias: Easy notify with action button
|
|
conditions:
|
|
- '{{ notify_action_buttons != ''disabled_notify_action_buttons''
|
|
}}'
|
|
sequence:
|
|
- action: notify.mobile_app_{{ device_attr(repeat.item, 'name') |
|
|
slugify }}
|
|
data:
|
|
title: !input notify_title
|
|
message: '{{easy_notify_message}}'
|
|
data: '{{ device_message_data_action_button }}'
|
|
continue_on_error: true
|
|
- alias: No sensors have been found
|
|
conditions:
|
|
- '{{ easy_notify_message == '''' }}'
|
|
- '{{ include_easy_notify == ''enable_easy_okay_notify'' }}'
|
|
sequence:
|
|
- action: notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify
|
|
}}
|
|
data:
|
|
title: !input notify_title
|
|
message: !input notify_okay_message
|
|
data: '{{ device_message_data }}'
|
|
continue_on_error: true
|
|
- choose:
|
|
- alias: Use the easy notify persistent notification options
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ (include_persistent_notification == ''enable_persistent_notification'')
|
|
or (include_persistent_notification == ''enable_persistent_okay_notification'')
|
|
}}'
|
|
sequence:
|
|
- choose:
|
|
- alias: Sensors have been found
|
|
conditions:
|
|
- '{{ persistent_easy_notify_message != '''' }}'
|
|
sequence:
|
|
- action: persistent_notification.create
|
|
data: '{{ persistent_message_data }}'
|
|
- alias: No sensors have been found
|
|
conditions:
|
|
- '{{ persistent_easy_notify_message == '''' }}'
|
|
- '{{ include_persistent_notification == ''enable_persistent_okay_notification''
|
|
}}'
|
|
sequence:
|
|
- action: persistent_notification.create
|
|
data: '{{ persistent_okay_message_data }}'
|
|
- choose:
|
|
- alias: Use the easy notify dashboard notification options
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ include_dashboard_notification == ''enable_dashboard_okay_notification''
|
|
}}
|
|
|
|
'
|
|
sequence:
|
|
- choose:
|
|
- alias: Sensors have been found
|
|
conditions:
|
|
- '{{ dashboard_easy_notify_message != '''' }}'
|
|
sequence:
|
|
- action: input_text.set_value
|
|
target:
|
|
entity_id: !input dashboard_notification_text_helper
|
|
data_template:
|
|
value: '{{ now().strftime(''%d %b %Y'') }} - {{ now().strftime(''%I'')|int
|
|
}}:{{ now().strftime(''%M %p'') ~ ''
|
|
|
|
|
|
'' ~ dashboard_easy_notify_message[:228] }}'
|
|
- alias: No sensors have been found
|
|
conditions:
|
|
- '{{ dashboard_easy_notify_message == '''' }}'
|
|
sequence:
|
|
- action: input_text.set_value
|
|
target:
|
|
entity_id: !input dashboard_notification_text_helper
|
|
data_template:
|
|
value: '{{ now().strftime(''%d %b %Y'') }} - {{ now().strftime(''%I'')|int
|
|
}}:{{ now().strftime(''%M %p'') ~ ''
|
|
|
|
|
|
'' ~ dashboard_notify_okay_message[:228] }}'
|
|
- choose:
|
|
- alias: Check if the easy notify - device To-Do action button is enabled
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ (include_easy_notify == ''enable_easy_notify'') or (include_easy_notify
|
|
== ''enable_easy_okay_notify'') }}'
|
|
- condition: template
|
|
value_template: '{{(notify_action_buttons == ''enable_to_do_list_button'') or
|
|
(notify_action_buttons == ''enable_to_do_list_button_and_confirmation'') or
|
|
(notify_action_buttons == ''enable_to_do_list_button_and_clear'')}}'
|
|
- condition: template
|
|
value_template: '{{ notify_device | length > 0 }}'
|
|
sequence:
|
|
- alias: Wait for a response from the action buttons
|
|
wait_for_trigger:
|
|
- trigger: event
|
|
event_type: mobile_app_notification_action
|
|
event_data:
|
|
action: '{{ action_button_to_do }}'
|
|
- trigger: event
|
|
event_type: mobile_app_notification_action
|
|
event_data:
|
|
action: '{{ action_button_cancel }}'
|
|
- choose:
|
|
- alias: Check if confirmation message is disabled
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ notify_action_buttons == ''enable_to_do_list_button''
|
|
}}'
|
|
sequence:
|
|
- if:
|
|
- alias: Confirmation from the action buttons
|
|
condition: template
|
|
value_template: '{{ wait.trigger.idx is defined }}'
|
|
then:
|
|
- alias: Perform the chosen actions
|
|
choose:
|
|
- conditions: '{{ wait.trigger.event.data.action == action_button_to_do
|
|
}}'
|
|
sequence:
|
|
- alias: Add task to To-Do list
|
|
action: todo.add_item
|
|
metadata: {}
|
|
data:
|
|
item: !input to_do_task_title
|
|
description: '{{easy_notify_message}}'
|
|
target:
|
|
entity_id: !input to_do_list
|
|
- conditions: '{{ wait.trigger.event.data.action == action_button_cancel
|
|
}}'
|
|
sequence:
|
|
- stop: Stop the automation
|
|
- alias: Check if confirmation message is enabled
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ (notify_action_buttons == ''enable_to_do_list_button_and_confirmation'')
|
|
or (notify_action_buttons == ''enable_to_do_list_button_and_clear'') }}'
|
|
sequence:
|
|
- if:
|
|
- alias: Confirmation from the action buttons
|
|
condition: template
|
|
value_template: '{{ wait.trigger.idx is defined }}'
|
|
then:
|
|
- alias: Perform the chosen actions
|
|
choose:
|
|
- conditions: '{{ wait.trigger.event.data.action == action_button_to_do
|
|
}}'
|
|
sequence:
|
|
- alias: Add task to To-Do list
|
|
action: todo.add_item
|
|
metadata: {}
|
|
data:
|
|
item: !input to_do_task_title
|
|
description: '{{easy_notify_message}}'
|
|
target:
|
|
entity_id: !input to_do_list
|
|
- choose:
|
|
- alias: Check if confirmation message is enabled
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ notify_action_buttons == ''enable_to_do_list_button_and_confirmation''
|
|
}}'
|
|
sequence:
|
|
- alias: Send a notification to each device
|
|
repeat:
|
|
for_each: !input notify_device
|
|
sequence:
|
|
- action: notify.mobile_app_{{ device_attr(repeat.item, 'name')
|
|
| slugify }}
|
|
data:
|
|
title: !input action_button_confirmation_title
|
|
message: !input action_button_confirmation_message
|
|
data: '{{ device_confirmation_message_data }}'
|
|
continue_on_error: true
|
|
- alias: Check if clear when done is enabled
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ notify_action_buttons == ''enable_to_do_list_button_and_clear''
|
|
}}'
|
|
sequence:
|
|
- alias: Send a notification to each device
|
|
repeat:
|
|
for_each: !input notify_device
|
|
sequence:
|
|
- action: notify.mobile_app_{{ device_attr(repeat.item, 'name')
|
|
| slugify }}
|
|
data:
|
|
message: clear_notification
|
|
data:
|
|
tag: !input notify_tag
|
|
continue_on_error: true
|
|
- conditions: '{{ wait.trigger.event.data.action == action_button_cancel
|
|
}}'
|
|
sequence:
|
|
- choose:
|
|
- alias: Check if confirmation message is enabled
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ notify_action_buttons == ''enable_to_do_list_button_and_confirmation''
|
|
}}'
|
|
sequence:
|
|
- alias: Send a notification to each device
|
|
repeat:
|
|
for_each: !input notify_device
|
|
sequence:
|
|
- action: notify.mobile_app_{{ device_attr(repeat.item, 'name')
|
|
| slugify }}
|
|
data:
|
|
title: !input action_button_confirmation_title
|
|
message: !input cancel_action_button_confirmation_message
|
|
data: '{{ device_message_data }}'
|
|
continue_on_error: true
|
|
- alias: Check if clear when done is enabled
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ notify_action_buttons == ''enable_to_do_list_button_and_clear''
|
|
}}'
|
|
sequence:
|
|
- alias: Send a notification to each device
|
|
repeat:
|
|
for_each: !input notify_device
|
|
sequence:
|
|
- action: notify.mobile_app_{{ device_attr(repeat.item, 'name')
|
|
| slugify }}
|
|
data:
|
|
message: clear_notification
|
|
data:
|
|
tag: !input notify_tag
|
|
continue_on_error: true
|