To send a notification which includes information about the name of the device that has triggered it, and its state:
alias: "Motion sensors low battery notification"
description: "Creates persistent notification when motion sensor battery is low, including name of sensor and battery level."
trigger:
- platform: numeric_state
entity_id:
- sensor.bedroom_motion_sensor_battery
- sensor.bathroom_motion_sensor_battery
- sensor.hallway_motion_sensor_battery
- sensor.kitchen_motion_sensor_battery
- sensor.landing_motion_sensor_battery
below: 30
condition: []
action:
- service: persistent_notification.create
data:
title: Low battery!
message: "{{ trigger.to_state.name }} low: {{ trigger.to_state.state }}%"
This will give you:
To send a notification with a timestamp:
alias: Security notification with timestamp
description: Creates persistent notification when back door opens, with timestamp
trigger:
- platform: state
entity_id:
- binary_sensor.back_door_contact_sensor_open
to: "on"
condition: []
action:
- service: persistent_notification.create
data:
title: Security alert!!
message: "{{ as_timestamp(now()) | timestamp_custom('%I:%M%p', true) }}: back door is open."
mode: single
This will give you: