various tidyups
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
# PACKAGE: Appliance Monitor Processor
|
||||
################################################################################
|
||||
#
|
||||
# Version: 1.5
|
||||
# Date: 2026-07-26
|
||||
# Version: 1.7
|
||||
# Date: 2026-08-17
|
||||
#
|
||||
# Purpose:
|
||||
# Shared appliance power monitoring processor.
|
||||
@@ -29,7 +29,7 @@
|
||||
# operating_power_min: 12
|
||||
# paid_tariff_start: "00:00"
|
||||
# paid_tariff_end: "21:00"
|
||||
# paid_tariff_cost: 0.2023
|
||||
# paid_tariff_cost: sensor.electricity_paid_rate (fallback 0.33235)
|
||||
# offpeak_tariff_cost: 0.0
|
||||
# max_sample_gap_seconds: 900
|
||||
# min_cycle_notify_seconds: 300
|
||||
@@ -41,6 +41,14 @@
|
||||
# Finished
|
||||
#
|
||||
# Notes:
|
||||
# Version 1.7:
|
||||
# - Use the central GST-inclusive electricity paid-rate sensor.
|
||||
# - Update the fallback tariff from NZ$0.2023/kWh to NZ$0.33235/kWh.
|
||||
#
|
||||
# Version 1.6:
|
||||
# - Preserve an explicit false power_available value instead of replacing
|
||||
# it with the default true value.
|
||||
#
|
||||
# Version 1.5:
|
||||
# - Standardized Sony TV and Pushover appliance notification titles as
|
||||
# "Appliance Notification".
|
||||
@@ -248,13 +256,21 @@ script:
|
||||
|
||||
am_paid_tariff_start: "{{ paid_tariff_start | default('00:00', true) | string }}"
|
||||
am_paid_tariff_end: "{{ paid_tariff_end | default('21:00', true) | string }}"
|
||||
am_paid_tariff_cost: "{{ paid_tariff_cost | default(0.2023, true) | float(0.2023) }}"
|
||||
am_paid_tariff_cost: >-
|
||||
{{
|
||||
paid_tariff_cost
|
||||
| default(
|
||||
states('sensor.electricity_paid_rate') | float(0.33235),
|
||||
true
|
||||
)
|
||||
| float(0.33235)
|
||||
}}
|
||||
am_offpeak_tariff_cost: "{{ offpeak_tariff_cost | default(0.0, true) | float(0.0) }}"
|
||||
|
||||
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) }}"
|
||||
am_power_available: "{{ power_available | default(true) | bool(true) }}"
|
||||
|
||||
##########################################################################
|
||||
# ANNOUNCEMENT DEFAULTS AND PASSED VALUES
|
||||
@@ -537,7 +553,7 @@ script:
|
||||
|
||||
am_tariff_rate: >-
|
||||
{% if am_is_paid_interval | bool(false) %}
|
||||
{{ am_paid_tariff_cost | float(0.2023) }}
|
||||
{{ am_paid_tariff_cost | float(0.33235) }}
|
||||
{% else %}
|
||||
{{ am_offpeak_tariff_cost | float(0.0) }}
|
||||
{% endif %}
|
||||
@@ -679,7 +695,7 @@ script:
|
||||
{% endif %}
|
||||
|
||||
am_cycle_offpeak_savings: >-
|
||||
{% set val = ((am_cycle_energy_new_kwh | float(0)) * (am_paid_tariff_cost | float(0.2023))) - (am_cycle_cost_new | float(0)) %}
|
||||
{% set val = ((am_cycle_energy_new_kwh | float(0)) * (am_paid_tariff_cost | float(0.33235))) - (am_cycle_cost_new | float(0)) %}
|
||||
{{ ([0, val] | max) | round(4) }}
|
||||
|
||||
am_cycle_offpeak_savings_formatted: >-
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# appliances_status_monitoring.yaml
|
||||
#
|
||||
# VERSION:
|
||||
# V1.5 2026-07-11
|
||||
# V1.8 2026-08-15
|
||||
#
|
||||
# PURPOSE:
|
||||
# Appliance status monitoring package for multiple appliances.
|
||||
@@ -51,6 +51,11 @@
|
||||
# matrix_indicator.
|
||||
#
|
||||
# VERSION HISTORY:
|
||||
# V1.8 2026-08-15
|
||||
# - Skip appliance processing while its power source is unavailable.
|
||||
# - Preserve retained cycle state and rolling samples across HA restarts and
|
||||
# source reconnects instead of treating missing measurements as zero.
|
||||
#
|
||||
# V1.7 2026-08-12
|
||||
# - Enabled MQTT activity-feed publication for every monitored appliance.
|
||||
#
|
||||
@@ -593,28 +598,32 @@ automation:
|
||||
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 }}"
|
||||
appliance_name: "{{ repeat.item.appliance_name }}"
|
||||
appliance_action: "{{ repeat.item.appliance_action }}"
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ am_power_available | bool(false) }}"
|
||||
then:
|
||||
- action: script.appliance_monitor_process_sample
|
||||
data:
|
||||
appliance_id: "{{ repeat.item.appliance_id }}"
|
||||
appliance_name: "{{ repeat.item.appliance_name }}"
|
||||
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 }}"
|
||||
power_w: "{{ am_power_w }}"
|
||||
power_available: "{{ am_power_available }}"
|
||||
monitor_sensor: "{{ am_monitor_sensor }}"
|
||||
state_topic: "{{ am_state_topic }}"
|
||||
|
||||
debug_flow: "{{ am_debug_flow }}"
|
||||
resolution: "{{ am_resolution }}"
|
||||
standby_power: "{{ am_standby_power }}"
|
||||
operating_power_min: "{{ am_operating_power_min }}"
|
||||
min_cycle_notify_seconds: "{{ am_min_cycle_notify_seconds }}"
|
||||
debug_flow: "{{ am_debug_flow }}"
|
||||
resolution: "{{ am_resolution }}"
|
||||
standby_power: "{{ am_standby_power }}"
|
||||
operating_power_min: "{{ am_operating_power_min }}"
|
||||
min_cycle_notify_seconds: "{{ am_min_cycle_notify_seconds }}"
|
||||
|
||||
announcement_enabled: "{{ am_announcement_enabled }}"
|
||||
announcement_channels: "{{ am_announcement_channels }}"
|
||||
title: "{{ am_title }}"
|
||||
short_announcement: "{{ am_short_announcement }}"
|
||||
long_announcement: "{{ am_long_announcement }}"
|
||||
announcement_payload: "{{ am_announcement_payload }}"
|
||||
matrix_indicator: "{{ am_matrix_indicator }}"
|
||||
mqtt_feed: "{{ am_mqtt_feed }}"
|
||||
announcement_enabled: "{{ am_announcement_enabled }}"
|
||||
announcement_channels: "{{ am_announcement_channels }}"
|
||||
title: "{{ am_title }}"
|
||||
short_announcement: "{{ am_short_announcement }}"
|
||||
long_announcement: "{{ am_long_announcement }}"
|
||||
announcement_payload: "{{ am_announcement_payload }}"
|
||||
matrix_indicator: "{{ am_matrix_indicator }}"
|
||||
mqtt_feed: "{{ am_mqtt_feed }}"
|
||||
|
||||
Reference in New Issue
Block a user