various tidyups

This commit is contained in:
zorruno
2026-07-29 23:18:11 +12:00
parent adb533d6a3
commit dd13f52feb
22 changed files with 6837 additions and 4057 deletions
@@ -2,8 +2,8 @@
# PACKAGE: Appliance Monitor Processor
################################################################################
#
# Version: 1.3
# Date: 2026-07-11
# Version: 1.5
# Date: 2026-07-26
#
# Purpose:
# Shared appliance power monitoring processor.
@@ -41,6 +41,15 @@
# Finished
#
# Notes:
# Version 1.5:
# - Standardized Sony TV and Pushover appliance notification titles as
# "Appliance Notification".
#
# Version 1.4:
# - Added power_available field and state machine guard.
# - Prevents false Operating→Finished transitions when power sensor is
# unavailable (e.g. during Home Assistant startup).
#
# Version 1.3:
# - Updated completion announcements to support all current View Road
# announcement router channels.
@@ -213,6 +222,12 @@ script:
selector:
text:
power_available:
name: Power Available
description: Whether the power sensor reported a valid numeric state.
selector:
boolean:
sequence:
##########################################################################
# CORE DEFAULTS AND PASSED VALUES
@@ -239,6 +254,8 @@ script:
am_max_sample_gap_seconds: "{{ max_sample_gap_seconds | default(900, true) | int(900) }}"
am_min_cycle_notify_seconds: "{{ min_cycle_notify_seconds | default(300, true) | int(300) }}"
am_power_available: "{{ power_available | default(true, true) | bool(true) }}"
##########################################################################
# ANNOUNCEMENT DEFAULTS AND PASSED VALUES
##########################################################################
@@ -280,7 +297,7 @@ script:
{{ long_announcement | default('', true) | string }}
am_announcement_title: >-
{{ title | default(am_appliance_name ~ ' Notification', true) | string }}
Appliance Notification
am_announcement_payload: >-
{% if announcement_payload is defined %}
@@ -394,7 +411,9 @@ script:
{% set standby = am_standby_power | float(2) %}
{% set operate = am_operating_power_min | float(12) %}
{% set prev = am_previous_state | string %}
{% if prev == 'Operating' and avg < operate %}
{% if prev == 'Operating' and not am_power_available %}
{{ prev }}
{% elif prev == 'Operating' and avg < operate %}
Finished
{% elif avg < standby %}
Off
@@ -51,6 +51,10 @@
# matrix_indicator.
#
# VERSION HISTORY:
# V1.6 2026-07-24
# - Added startup delay guard to prevent false completion announcements.
# - Added power_available field for the processor availability check.
#
# V1.5 2026-07-11
# - Added full View Road announcement router parameter support.
# - Added per-appliance announcement_enabled.
@@ -421,6 +425,15 @@ automation:
mqtt_feed: "3d_printer"
action:
# On startup, wait for power sensors to report real values before processing.
- choose:
- conditions:
- condition: trigger
id:
- ha_start
sequence:
- delay: "00:01:00"
#:####################################################################################:#
# PUBLISH / REFRESH MQTT DISCOVERY CONFIG #
#:####################################################################################:#
@@ -574,6 +587,9 @@ automation:
am_power_w: >-
{{ states(repeat.item.power_entity) | float(0) }}
am_power_available: >-
{{ states(repeat.item.power_entity) not in ['unknown', 'unavailable'] }}
- action: script.appliance_monitor_process_sample
data:
appliance_id: "{{ repeat.item.appliance_id }}"
@@ -581,6 +597,7 @@ automation:
appliance_action: "{{ repeat.item.appliance_action }}"
power_w: "{{ am_power_w }}"
power_available: "{{ am_power_available }}"
monitor_sensor: "{{ am_monitor_sensor }}"
state_topic: "{{ am_state_topic }}"