esphome devices & packages

This commit is contained in:
root
2026-06-04 13:36:49 +12:00
parent f9759ca391
commit a2a7a6710f
46 changed files with 5383 additions and 15833 deletions
+255 -26
View File
@@ -2,8 +2,8 @@
# PACKAGE: View Road Announcement Router
################################################################################
#
# Version: 1.2
# Date: 2026-05-06
# Version: 1.4
# Date: 2026-06-02
#
# Purpose:
# Central announcement router for general Home Assistant announcements.
@@ -11,7 +11,136 @@
# values such as channels, title, short_announcement, long_announcement,
# payload, and indicator.
#
# How to call this script:
#
# - action: script.view_road_announcement
# data:
# channels: "pushover_zorruno, lounge_google_home_voice, led_matrix_1"
# title: "View Road"
# short_announcement: "Washing complete"
# long_announcement: "The washing machine has finished."
# payload: ""
# indicator: "dry,1,15,10,2,1"
#
# Available channels:
#
# pushover_zorruno:
# Uses:
# title
# long_announcement
#
# pushover_kim:
# Uses:
# title
# long_announcement
#
# sony_tv_lounge:
# Uses:
# title
# short_announcement
# payload
# Message format:
# "<short_announcement> is <payload>"
#
# lounge_google_home_voice:
# Also accepts alias:
# google_home_voice
# Uses:
# long_announcement
# Fallback:
# If long_announcement is blank, uses short_announcement and payload.
# Quiet time:
# Blocked by default when input_boolean.quiet_time is on.
#
# lounge_touchscreen_voice:
# Placeholder only.
# Quiet time:
# Blocked by default when input_boolean.quiet_time is on.
#
# mqtt_view_rd_feed:
# Placeholder only.
#
# led_matrix_1:
# Uses:
# short_announcement
# indicator
# Publishes to MQTT topic:
# viewroad-commands/ledmatrix1/announce
# Message format:
# "<short_announcement> [<indicator>]"
# Example:
# "Washing complete [dry,1,15,10,2,1]"
#
# led_matrix_2:
# Future channel.
# Uses the same format as led_matrix_1.
# Publishes to MQTT topic:
# viewroad-commands/ledmatrix2/announce
#
# LED matrix announcement format:
#
# Message text [identifier,transition_mode,speed,repeat_seconds,repeat_times,sounder_quantity]
#
# Example script call:
#
# - action: script.view_road_announcement
# data:
# channels: "led_matrix_1"
# short_announcement: "Washing complete"
# indicator: "dry,1,15,10,2,1"
#
# Result sent to MQTT:
#
# Washing complete [dry,1,15,10,2,1]
#
# Indicator fields:
#
# identifier:
# Announcement identifier used by the LED matrix ESPHome logic.
# It is cleaned by ESPHome to letters, numbers, underscore, or dash, and
# is limited to 8 characters.
#
# transition_mode:
# 0 = Slide up
# 1 = Slide down
# 2 = Pixel fall
#
# speed:
# Per-message scroll delay in ms.
# Clamped by ESPHome from 1 to 100.
#
# repeat_seconds:
# Delay between completed scrolls.
# Clamped by ESPHome from 0 to 99.
#
# repeat_times:
# Total number of scroll displays.
# Clamped by ESPHome from 0 to 99.
# 0 is treated as a one-shot announcement.
#
# sounder_quantity:
# Number of announcement displays that should beep first.
# 0 means no sounder beep.
#
# Notes:
# The announcement router does not parse, clean, or clamp the indicator
# fields. It passes the indicator through to the LED matrix in square
# brackets. The LED matrix ESPHome YAML handles validation and behaviour.
#
# Changes:
# 1.4:
# - Documented LED matrix indicator format.
# - Clarified that LED matrix indicator validation is handled by ESPHome.
#
# 1.3:
# - Added led_matrix_1 announcement channel.
# - Added future led_matrix_2 announcement channel.
# - Added MQTT topic settings for LED matrix announcement channels.
# - Added channel enable helpers for led_matrix_1 and led_matrix_2.
# - Added package instructions for calling script.view_road_announcement.
# - Moved more configurable values into the package settings section.
# - Added lounge Google Home cast chime suppression setting.
#
# 1.2:
# - Updated Lounge Google Home voice channel to use working Piper TTS setup.
# - Added Piper voice option en_GB-alba-medium.
@@ -30,21 +159,6 @@
#
################################################################################
################################################################################
# PUSHOVER NOTIFY SERVICES
################################################################################
#
# Pushover is configured using the Home Assistant Pushover integration.
#
# Expected notify entities:
#
# notify.pushover_zorruno
# notify.pushover_kim
#
# No YAML notify: block is needed in this package.
#
################################################################################
################################################################################
# CHANNEL ENABLE HELPERS
################################################################################
@@ -80,6 +194,16 @@ input_boolean:
icon: mdi:message-processing
initial: true
announcement_channel_led_matrix_1:
name: Announcement Channel - LED Matrix 1
icon: mdi:led-strip-variant
initial: true
announcement_channel_led_matrix_2:
name: Announcement Channel - LED Matrix 2
icon: mdi:led-strip-variant
initial: true
################################################################################
# MAIN ANNOUNCEMENT ROUTER SCRIPT
################################################################################
@@ -95,7 +219,7 @@ script:
channels:
name: Channels
description: Comma separated list of announcement channels to use.
example: "pushover_zorruno, sony_tv_lounge"
example: "pushover_zorruno, sony_tv_lounge, led_matrix_1"
selector:
text:
@@ -130,26 +254,26 @@ script:
indicator:
name: Indicator
description: Future indicator data such as LED number, colour, or flash pattern.
example: "red, led 2, flash fast"
description: LED matrix indicator data in the format identifier,transition_mode,speed,repeat_seconds,repeat_times,sounder_quantity.
example: "dry,1,15,10,2,1"
selector:
text:
sequence:
##########################################################################
# DEFAULT VALUES
# PACKAGE SETTINGS / SUBSTITUTIONS
##########################################################################
#
# If a value is not passed, the default below is used.
# If a value is passed as "", it clears the default to blank.
# Home Assistant packages do not support ESPHome-style substitutions.
# These variables act as the package-level settings for this script.
#
# quiet_time_blocked_channels:
# Channels in this list will not run while input_boolean.quiet_time is on.
# If a value is not passed to the script, the default below is used.
# If a value is passed as "", it clears the default to blank.
#
##########################################################################
- variables:
default_channels: "pushover_zorruno, pushover_kim, sony_tv_lounge, lounge_google_home_voice, lounge_touchscreen_voice, mqtt_view_rd_feed"
default_channels: "pushover_zorruno, pushover_kim, sony_tv_lounge, lounge_google_home_voice, lounge_touchscreen_voice, mqtt_view_rd_feed, led_matrix_1, led_matrix_2"
default_title: "View Road"
default_short_announcement: "Home automation announcement"
default_long_announcement: "Home automation announcement"
@@ -165,10 +289,29 @@ script:
lounge_google_home_voice_tts_entity: "tts.piper"
lounge_google_home_voice_piper_voice: "en_GB-jenny_dioco-medium"
lounge_google_home_voice_volume_level: 0.80
lounge_google_home_voice_suppress_cast_chime: false
led_matrix_1_mqtt_topic: "viewroad-commands/ledmatrix1/announce"
led_matrix_2_mqtt_topic: "viewroad-commands/ledmatrix2/announce"
led_matrix_mqtt_qos: 0
led_matrix_mqtt_retain: false
led_matrix_leading_space_guard: ""
##########################################################################
# RESOLVE PASSED VALUES
##########################################################################
#
# Lowercase field names are preferred:
# channels
# title
# short_announcement
# long_announcement
# payload
# indicator
#
# Some uppercase variants are also accepted for tolerance.
#
##########################################################################
- variables:
ann_channels_raw: >-
@@ -263,6 +406,17 @@ script:
{{ payload_text }}
{% endif %}
ann_led_matrix_message: >-
{% set short_text = short_announcement if short_announcement is defined
else Short_Announcement if Short_Announcement is defined
else default_short_announcement %}
{% set short_text = short_text | string %}
{% set indicator_text = ann_indicator | string | trim %}
{{ (led_matrix_leading_space_guard if short_text[0:1] == ' ' else '') ~ short_text ~
(' [' ~ indicator_text ~ ']'
if indicator_text | length > 0
else '') }}
##########################################################################
# CHANNEL: PUSHOVER ZORRUNO
##########################################################################
@@ -405,3 +559,78 @@ script:
# Placeholder only. No action yet.
#
##########################################################################
##########################################################################
# CHANNEL: LOUNGE LED MATRIX DISPLAY - MATRIX 1
##########################################################################
#
# Channel name:
# led_matrix_1
#
# Uses:
# short_announcement
# indicator
#
# Publishes:
# <short_announcement> [<indicator>]
#
# Example payload:
# Washing complete [dry,1,15,10,2,1]
#
# Indicator format:
# identifier,transition_mode,speed,repeat_seconds,repeat_times,sounder_quantity
#
##########################################################################
- if:
- condition: template
value_template: "{{ ',led_matrix_1,' in ann_channels_normalised }}"
- condition: state
entity_id: input_boolean.announcement_channel_led_matrix_1
state: "on"
- condition: template
value_template: "{{ ann_led_matrix_message | string | trim | length > 0 }}"
then:
- action: mqtt.publish
data:
topic: "{{ led_matrix_1_mqtt_topic }}"
payload: "{{ ann_led_matrix_message }}"
qos: "{{ led_matrix_mqtt_qos | int(0) }}"
retain: "{{ led_matrix_mqtt_retain | bool(false) }}"
##########################################################################
# CHANNEL: LOUNGE LED MATRIX DISPLAY - MATRIX 2
##########################################################################
#
# Future channel.
#
# Channel name:
# led_matrix_2
#
# Uses:
# short_announcement
# indicator
#
# Publishes:
# <short_announcement> [<indicator>]
#
# Indicator format:
# identifier,transition_mode,speed,repeat_seconds,repeat_times,sounder_quantity
#
##########################################################################
- if:
- condition: template
value_template: "{{ ',led_matrix_2,' in ann_channels_normalised }}"
- condition: state
entity_id: input_boolean.announcement_channel_led_matrix_2
state: "on"
- condition: template
value_template: "{{ ann_led_matrix_message | string | trim | length > 0 }}"
then:
- action: mqtt.publish
data:
topic: "{{ led_matrix_2_mqtt_topic }}"
payload: "{{ ann_led_matrix_message }}"
qos: "{{ led_matrix_mqtt_qos | int(0) }}"
retain: "{{ led_matrix_mqtt_retain | bool(false) }}"