Make Start Date and Control Flag inputs optional in Periodic Notification

- Start Date: when empty, day interval is ignored and notifications fire daily
- Control Flag: when empty, notifications always fire (no toggle control)
- Update documentation to reflect optional inputs
- Fix markdown linting issues

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 12:42:59 +03:00
parent 5da986867d
commit 06177cb9f0
3 changed files with 20 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
# Periodic Notification # Periodic Notification
Sends notifications at specified times on a repeating day schedule, controlled by a toggle entity. Sends notifications at specified times on an optional repeating day schedule with optional toggle control.
## Features ## Features
@@ -8,13 +8,13 @@ Sends notifications at specified times on a repeating day schedule, controlled b
- Customizable multiline message - Customizable multiline message
- Flexible time schedule (multiple times per day) - Flexible time schedule (multiple times per day)
- Configurable day interval (every N days) - Configurable day interval (every N days)
- On/off control via input_boolean or switch entity - Optional on/off control via input_boolean or switch entity
## How It Works ## How It Works
1. The automation triggers at each configured notification time (checked every minute) 1. The automation triggers at each configured notification time (checked every minute)
2. It verifies the control flag entity is ON 2. It verifies the control flag entity is ON (if configured)
3. It calculates whether today falls on the correct day in the interval cycle, counting from the configured start date 3. It calculates whether today falls on the correct day in the interval cycle (if start date is configured)
4. If all conditions pass, the message is sent to all notification targets 4. If all conditions pass, the message is sent to all notification targets
### Day Interval Calculation ### Day Interval Calculation
@@ -28,13 +28,13 @@ Setting the day interval to **1** sends notifications every day.
## Configuration ## Configuration
| Input | Description | | Input | Description |
|---|---| | --- | --- |
| **Notification Targets** | One or more `notify` entities (e.g., `notify.mobile_app_phone`) | | **Notification Targets** | One or more `notify` entities (e.g., `notify.mobile_app_phone`) |
| **Message** | The notification text to send (supports multiline) | | **Message** | The notification text to send (supports multiline) |
| **Notification Times** | Comma-separated times in 24-hour `HH:MM` format (e.g., `08:00, 14:30, 20:00`) | | **Notification Times** | Comma-separated times in 24-hour `HH:MM` format (e.g., `08:00, 14:30, 20:00`) |
| **Day Interval** | Number of days between notification cycles (1 = daily) | | **Day Interval** | Number of days between notification cycles (1 = daily) |
| **Start Date** | Reference date for the interval calculation (optional — leave empty to send every day) | | **Start Date** | Reference date for the interval calculation (optional — leave empty to send every day) |
| **Control Flag** | `input_boolean` or `switch` entity to enable/disable notifications | | **Control Flag** | `input_boolean` or `switch` entity to enable/disable notifications (optional — leave empty to always send) |
### Time Format ### Time Format
@@ -50,4 +50,4 @@ Set the `is_debug` variable to `true` in the automation YAML to enable persisten
## Author ## Author
Alexei Dolgolyov (dolgolyov.alexei@gmail.com) Alexei Dolgolyov (<dolgolyov.alexei@gmail.com>)

View File

@@ -83,10 +83,12 @@ blueprint:
collapsed: false collapsed: false
input: input:
control_flag: control_flag:
name: Control Flag name: Control Flag (optional)
description: > description: >
Toggle entity to enable or disable notifications. Toggle entity to enable or disable notifications.
Notifications are only sent when this entity is ON. Notifications are only sent when this entity is ON.
Leave empty to always send notifications.
default: ""
selector: selector:
entity: entity:
domain: domain:
@@ -120,6 +122,7 @@ variables:
message_text: !input message message_text: !input message
interval: !input day_interval interval: !input day_interval
start_date: !input start_date start_date: !input start_date
control_flag: !input control_flag
# Debug flag - set to true to enable persistent notifications for troubleshooting # Debug flag - set to true to enable persistent notifications for troubleshooting
is_debug: false is_debug: false
@@ -128,10 +131,14 @@ variables:
# Conditions # Conditions
# ============================================================================= # =============================================================================
condition: condition:
# Control flag must be ON # Control flag must be ON (skipped if no control flag)
- condition: state - condition: template
entity_id: !input control_flag value_template: >
state: "on" {%- if control_flag | length == 0 -%}
true
{%- else -%}
{{ is_state(control_flag, 'on') }}
{%- endif -%}
# Today must fall on the correct day in the interval cycle (skipped if no start date) # Today must fall on the correct day in the interval cycle (skipped if no start date)
- condition: template - condition: template

View File

@@ -1,3 +1,3 @@
{ {
"version": "1.34.0" "version": "1.35.0"
} }