esphome devices & scripts

This commit is contained in:
root
2026-05-07 23:18:01 +12:00
parent ae00e821ba
commit 5e941eea06
448 changed files with 1407 additions and 204 deletions
+39
View File
@@ -0,0 +1,39 @@
################################################################################
# PACKAGE: Announcement Test Button
################################################################################
input_button:
announcement_test:
name: Test Announcement
icon: mdi:bullhorn
automation:
- id: announcement_test_button_pressed
alias: Announcement Test Button Pressed
mode: single
trigger:
- platform: state
entity_id: input_button.announcement_test
action:
- action: script.view_road_announcement
data:
channels: "sony_tv_lounge"
title: "View Road Test"
short_announcement: "Test announcement"
long_announcement: "This is a test announcement from the package test button."
payload: "On"
indicator: ""
#- action: script.view_road_announcement
# data:
# channels: "pushover_zorruno,pushover_kim"
# title: "View Road Test"
# long_announcement: "This is a test through the View Road announcement router."
- action: script.view_road_announcement
data:
channels: "lounge_google_home_voice"
title: "View Road Test"
long_announcement: "This is a test announcement on the lounge Google Home."
+234
View File
@@ -0,0 +1,234 @@
###############################################################################
# PACKAGE: Bedtime Mode Delayed Shutdown
###############################################################################
#
# VERSION:
# 1.3 - 2026-05-07
# - Added downstairs lights all off script.
# - Added main hallway nightlights 60 minute bedtime timer.
# - Added timer cancellation if main hallway nightlights are manually turned off.
#
# 1.2 - 2026-05-04
# - Removed script field selectors to avoid HA selector validation error.
#
# 1.1 - 2026-05-04
# - Added lounge scene selection to "All Off".
# - Added quiet time activation.
#
# 1.0 - 2026-05-04
# - Initial package.
# - Triggered by input_button.bedtime_mode or ESPHome lounge hold event.
# - Turns listed entities off after individual delays.
# - Only sends OFF if the entity is currently on/active.
#
# NOTES:
# - Add more entities to bedtime_delayed_off_targets.
# - delay_seconds is counted from the original button press.
# - Delays are not cumulative.
# - switch and remote entities are only turned off if state == "on".
# - climate entities are turned off if they are not already "off".
# - Main hallway nightlights are turned on for 60 minutes when bedtime mode runs.
# - If the main hallway nightlights are turned off manually, the timer is cancelled.
#
###############################################################################
###############################################################################
# TIMER
###############################################################################
timer:
main_hallway_nightlights_bedtime:
name: Main Hallway Nightlights Bedtime Timer
duration: "01:00:00"
###############################################################################
# AUTOMATIONS
###############################################################################
automation:
- id: bedtime_mode_delayed_shutdown
alias: "Bedtime Mode - Delayed Shutdown"
description: >
Runs bedtime delayed shutdown when the bedtime button is pressed or when
the lounge switch hold ESPHome event is seen.
trigger:
- platform: state
entity_id: input_button.bedtime_mode
id: bedtime_mode_button
- platform: event
event_type: esphome.lounge_switch_hold
id: lounge_switch_hold
variables:
bedtime_delayed_off_targets:
- entity_id: switch.esp_mainkitchenlights_relay_1_main_lights
delay_seconds: 4
- entity_id: switch.esp_mainkitchenlights_relay_2_benchtop_lights
delay_seconds: 4
- entity_id: switch.esp_entrancelightswitch_relay_1_entrance_lights
delay_seconds: 5
- entity_id: switch.esp_garageentrylights_relay_3_garage_lights
delay_seconds: 10
- entity_id: switch.esp_garageentrylights_relay_1_corridor_lights
delay_seconds: 10
- entity_id: switch.rinnai_neo_gas_heater_heater_operation
delay_seconds: 1
- entity_id: climate.lounge
delay_seconds: 1
- entity_id: switch.lounge_cupboard_dual_usb_xus09_l2
delay_seconds: 2
- entity_id: switch.tv_surround_amp_power_in_loft_x27pp
delay_seconds: 1
- entity_id: remote.lounge_tv
delay_seconds: 0
action:
- service: script.downstairs_lights_all_off
- service: script.lounge_set_scene
data:
scene_name: "All Off"
- service: input_boolean.turn_on
target:
entity_id: input_boolean.quiet_time
- service: switch.turn_on
target:
entity_id: switch.main_hallway_nightlights_1_relay_1_main_hallway_nightlights
- service: timer.start
target:
entity_id: timer.main_hallway_nightlights_bedtime
data:
duration: "01:00:00"
- repeat:
for_each: "{{ bedtime_delayed_off_targets }}"
sequence:
- service: script.turn_on
target:
entity_id: script.bedtime_mode_turn_entity_off_after_delay
data:
variables:
target_entity: "{{ repeat.item.entity_id }}"
delay_seconds: "{{ repeat.item.delay_seconds | int(0) }}"
mode: queued
max: 5
- id: bedtime_mode_cancel_main_hallway_nightlights_timer
alias: "Bedtime Mode - Cancel Main Hallway Nightlights Timer"
description: >
Cancels the bedtime nightlights timer if something else turns the
main hallway nightlights off.
trigger:
- platform: state
entity_id: switch.main_hallway_nightlights_1_relay_1_main_hallway_nightlights
to: "off"
condition:
- condition: state
entity_id: timer.main_hallway_nightlights_bedtime
state: "active"
action:
- service: timer.cancel
target:
entity_id: timer.main_hallway_nightlights_bedtime
mode: single
- id: bedtime_mode_main_hallway_nightlights_timer_finished
alias: "Bedtime Mode - Main Hallway Nightlights Timer Finished"
description: >
Turns the main hallway nightlights off when the bedtime timer finishes.
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.main_hallway_nightlights_bedtime
condition:
- condition: state
entity_id: switch.main_hallway_nightlights_1_relay_1_main_hallway_nightlights
state: "on"
action:
- service: switch.turn_off
target:
entity_id: switch.main_hallway_nightlights_1_relay_1_main_hallway_nightlights
mode: single
###############################################################################
# SCRIPTS
###############################################################################
script:
bedtime_mode_turn_entity_off_after_delay:
alias: "Bedtime Mode - Turn Entity Off After Delay"
description: >
Waits for the supplied delay, checks whether the supplied entity is still
on/active, then sends the correct turn_off command for its domain.
sequence:
- delay:
seconds: "{{ delay_seconds | int(0) }}"
- variables:
target_domain: "{{ target_entity.split('.')[0] }}"
- condition: template
value_template: >
{% if target_domain == 'climate' %}
{{ states(target_entity) not in ['off', 'unknown', 'unavailable'] }}
{% else %}
{{ is_state(target_entity, 'on') }}
{% endif %}
- choose:
- conditions:
- condition: template
value_template: "{{ target_domain == 'switch' }}"
sequence:
- service: switch.turn_off
data:
entity_id: "{{ target_entity }}"
- conditions:
- condition: template
value_template: "{{ target_domain == 'climate' }}"
sequence:
- service: climate.turn_off
data:
entity_id: "{{ target_entity }}"
- conditions:
- condition: template
value_template: "{{ target_domain == 'remote' }}"
sequence:
- service: remote.turn_off
data:
entity_id: "{{ target_entity }}"
default:
- service: homeassistant.turn_off
data:
entity_id: "{{ target_entity }}"
mode: parallel
max: 50
+149 -56
View File
@@ -1,96 +1,163 @@
###############################################################################
# PACKAGE: Downstairs Flat Light Control
###############################################################################
#
# VERSION HISTORY
#
# 2026-05-07 - v1.0.1
# - Removed group.downstairs_flat_lights from this package to avoid duplicate
# group/name package merge errors.
# - Changed all-on/all-off scripts to use direct entity lists instead.
#
# 2026-05-07 - v1.0.0
# - Tidied original package.
# - Added package header and comments.
# - Added internal helper script to avoid repeating the same occupancy logic.
#
###############################################################################
#
# OPERATION NOTES
#
# - input_boolean.downstairs_flat_occupied is the safety/lockout helper.
#
# - When downstairs_flat_occupied is ON:
# - All scripts in this package do nothing.
# - This prevents upstairs controls from changing downstairs guest lights.
#
# - When downstairs_flat_occupied is OFF:
# - Individual scripts toggle their matching light switch.
# - downstairs_lights_all_off only ever turns the listed lights OFF.
# - downstairs_light_toggle_all_group turns all listed lights OFF if any are ON.
# - downstairs_light_toggle_all_group turns all listed lights ON if they are all OFF.
#
###############################################################################
###############################################################################
# INPUT BOOLEANS
###############################################################################
input_boolean:
downstairs_flat_occupied:
name: Downstairs Guest Occupied
icon: mdi:briefcase-plus-outline
icon: mdi:home-account
###############################################################################
# SCRIPTS
###############################################################################
script:
downstairs_light_toggle_lounge_main:
alias: Downstairs Light Toggle - Lounge Main Lights
mode: queued
downstairs_lights_all_off:
alias: Downstairs Lights - All Off
mode: single
sequence:
- condition: state
entity_id: input_boolean.downstairs_flat_occupied
state: "off"
- service: switch.toggle
- action: homeassistant.turn_off
target:
entity_id: switch.esp_downstloungemain_relay_1_main_lights
entity_id:
- switch.esp_downstloungemain_relay_1_main_lights
- switch.esp_downstloungemain_relay_2_back_wall_lights
- switch.esp_downstmasterbedrmlights_relay_1_main_lights
- switch.esp_downstbedrm2lights_relay_1_main_lights
- switch.esp_downstkitchlights_relay_2_kitchen_light
- switch.esp_downstkitchlights_relay_1_dining_light
- switch.esp_downstbathswitch_relay_1_main_lights
- switch.esp_downstbathswitch_relay_2_cabinet_light
downstairs_light_toggle_entity:
alias: Downstairs Light Toggle - Internal Entity Toggle
mode: queued
max: 10
fields:
target_switch:
name: Target Switch
description: The downstairs switch entity to toggle.
required: true
selector:
entity:
domain: switch
sequence:
- condition: state
entity_id: input_boolean.downstairs_flat_occupied
state: "off"
- action: switch.toggle
target:
entity_id: "{{ target_switch }}"
downstairs_light_toggle_lounge_main:
alias: Downstairs Light Toggle - Lounge Main Lights
mode: queued
max: 10
sequence:
- action: script.downstairs_light_toggle_entity
data:
target_switch: switch.esp_downstloungemain_relay_1_main_lights
downstairs_light_toggle_lounge_back_wall:
alias: Downstairs Light Toggle - Lounge Back Wall Lights
mode: queued
max: 10
sequence:
- condition: state
entity_id: input_boolean.downstairs_flat_occupied
state: "off"
- service: switch.toggle
target:
entity_id: switch.esp_downstloungemain_relay_2_back_wall_lights
- action: script.downstairs_light_toggle_entity
data:
target_switch: switch.esp_downstloungemain_relay_2_back_wall_lights
downstairs_light_toggle_main_bedroom_main:
alias: Downstairs Light Toggle - Main Bedroom Main Lights
mode: queued
max: 10
sequence:
- condition: state
entity_id: input_boolean.downstairs_flat_occupied
state: "off"
- service: switch.toggle
target:
entity_id: switch.esp_downstmasterbedrmlights_relay_1_main_lights
- action: script.downstairs_light_toggle_entity
data:
target_switch: switch.esp_downstmasterbedrmlights_relay_1_main_lights
downstairs_light_toggle_small_bedroom_main:
alias: Downstairs Light Toggle - Small Bedroom Room Lights
alias: Downstairs Light Toggle - Small Bedroom Main Lights
mode: queued
max: 10
sequence:
- condition: state
entity_id: input_boolean.downstairs_flat_occupied
state: "off"
- service: switch.toggle
target:
entity_id: switch.esp_downstbedrm2lights_relay_1_main_lights
- action: script.downstairs_light_toggle_entity
data:
target_switch: switch.esp_downstbedrm2lights_relay_1_main_lights
downstairs_light_toggle_kitchen:
alias: Downstairs Light Toggle - Kitchen Lights
mode: queued
max: 10
sequence:
- condition: state
entity_id: input_boolean.downstairs_flat_occupied
state: "off"
- service: switch.toggle
target:
entity_id: switch.esp_downstkitchlights_relay_2_kitchen_light
- action: script.downstairs_light_toggle_entity
data:
target_switch: switch.esp_downstkitchlights_relay_2_kitchen_light
downstairs_light_toggle_dining:
alias: Downstairs Light Toggle - Dining Lights
mode: queued
max: 10
sequence:
- condition: state
entity_id: input_boolean.downstairs_flat_occupied
state: "off"
- service: switch.toggle
target:
entity_id: switch.esp_downstkitchlights_relay_1_dining_light
- action: script.downstairs_light_toggle_entity
data:
target_switch: switch.esp_downstkitchlights_relay_1_dining_light
downstairs_light_toggle_bathroom_main:
alias: Downstairs Light Toggle - Bathroom Main Lights
mode: queued
max: 10
sequence:
- condition: state
entity_id: input_boolean.downstairs_flat_occupied
state: "off"
- service: switch.toggle
target:
entity_id: switch.esp_downstbathswitch_relay_1_main_lights
- action: script.downstairs_light_toggle_entity
data:
target_switch: switch.esp_downstbathswitch_relay_1_main_lights
downstairs_light_toggle_bathroom_cabinet:
alias: Downstairs Light Toggle - Bathroom Cabinet Lights
mode: queued
max: 10
sequence:
- condition: state
entity_id: input_boolean.downstairs_flat_occupied
state: "off"
- service: switch.toggle
target:
entity_id: switch.esp_downstbathswitch_relay_2_cabinet_light
- action: script.downstairs_light_toggle_entity
data:
target_switch: switch.esp_downstbathswitch_relay_2_cabinet_light
downstairs_light_toggle_all_group:
alias: Downstairs Lights - All On/Off
@@ -102,14 +169,40 @@ script:
- choose:
- conditions:
- condition: state
entity_id: group.downstairs_flat_lights
state: "on"
- condition: template
value_template: >
{{
is_state('switch.esp_downstloungemain_relay_1_main_lights', 'on')
or is_state('switch.esp_downstloungemain_relay_2_back_wall_lights', 'on')
or is_state('switch.esp_downstmasterbedrmlights_relay_1_main_lights', 'on')
or is_state('switch.esp_downstbedrm2lights_relay_1_main_lights', 'on')
or is_state('switch.esp_downstkitchlights_relay_2_kitchen_light', 'on')
or is_state('switch.esp_downstkitchlights_relay_1_dining_light', 'on')
or is_state('switch.esp_downstbathswitch_relay_1_main_lights', 'on')
or is_state('switch.esp_downstbathswitch_relay_2_cabinet_light', 'on')
}}
sequence:
- service: homeassistant.turn_off
- action: homeassistant.turn_off
target:
entity_id: group.downstairs_flat_lights
entity_id:
- switch.esp_downstloungemain_relay_1_main_lights
- switch.esp_downstloungemain_relay_2_back_wall_lights
- switch.esp_downstmasterbedrmlights_relay_1_main_lights
- switch.esp_downstbedrm2lights_relay_1_main_lights
- switch.esp_downstkitchlights_relay_2_kitchen_light
- switch.esp_downstkitchlights_relay_1_dining_light
- switch.esp_downstbathswitch_relay_1_main_lights
- switch.esp_downstbathswitch_relay_2_cabinet_light
default:
- service: homeassistant.turn_on
- action: homeassistant.turn_on
target:
entity_id: group.downstairs_flat_lights
entity_id:
- switch.esp_downstloungemain_relay_1_main_lights
- switch.esp_downstloungemain_relay_2_back_wall_lights
- switch.esp_downstmasterbedrmlights_relay_1_main_lights
- switch.esp_downstbedrm2lights_relay_1_main_lights
- switch.esp_downstkitchlights_relay_2_kitchen_light
- switch.esp_downstkitchlights_relay_1_dining_light
- switch.esp_downstbathswitch_relay_1_main_lights
- switch.esp_downstbathswitch_relay_2_cabinet_light
+175
View File
@@ -0,0 +1,175 @@
###############################################################################
# PACKAGE: Lounge IR Remote Functions
# VERSION: 1.0 - 2026-05-05
#
# PURPOSE:
# - Listen for Tasmota IR receive events over MQTT.
# - Convert known IR hash values into lounge scene commands or toggle actions.
# - Throttle repeated button-hold messages so toggles do not flip repeatedly.
#
# MQTT SOURCE:
# - Topic: tele/tasmo-ytfir-a25e21-lounge-1/RESULT
# - JSON path: IrReceived.Hash
#
# NOTES:
# - The incoming hash is normalised to lowercase before matching.
# - Adjust input_number.lounge_ir_remote_throttle_seconds if button repeats
# are still too fast or feel too slow.
###############################################################################
input_text:
lounge_ir_remote_last_hash:
name: "Lounge IR Remote Last Hash"
max: 32
input_datetime:
lounge_ir_remote_last_seen:
name: "Lounge IR Remote Last Seen"
has_date: true
has_time: true
input_number:
lounge_ir_remote_throttle_seconds:
name: "Lounge IR Remote Throttle Seconds"
min: 0.2
max: 10
step: 0.1
mode: box
unit_of_measurement: "s"
initial: 1.5
automation:
- id: lounge_ir_remote_functions
alias: "Lounge IR Remote Functions"
description: >
Handles lounge IR remote hash commands from the Tasmota IR receiver.
mode: queued
max: 20
max_exceeded: silent
triggers:
- trigger: mqtt
topic: "tele/tasmo-ytfir-a25e21-lounge-1/RESULT"
variables:
ir_hash: >-
{{ trigger.payload_json.get('IrReceived', {}).get('Hash', '') | string | lower }}
scene_map:
"0xe23b4151": "Bright"
"0xce5541e4": "TV General"
"0xc0c52aff": "Movie"
"0x79fb9e54": "Reading On/Off"
toggle_hashes:
- "0x2b4da162"
- "0xc2997ec2"
conditions:
- condition: template
value_template: "{{ ir_hash in scene_map or ir_hash in toggle_hashes }}"
actions:
- alias: "Stop repeated button-hold messages"
choose:
- conditions:
- condition: template
value_template: >-
{{
ir_hash == states('input_text.lounge_ir_remote_last_hash')
and
(
as_timestamp(now())
- as_timestamp(states('input_datetime.lounge_ir_remote_last_seen'), 0)
)
< (states('input_number.lounge_ir_remote_throttle_seconds') | float(1.5))
}}
sequence:
- stop: "Repeated IR hash ignored by throttle."
- alias: "Store this IR hash and timestamp for throttle checking"
action: input_text.set_value
target:
entity_id: input_text.lounge_ir_remote_last_hash
data:
value: "{{ ir_hash }}"
- alias: "Store current timestamp for throttle checking"
action: input_datetime.set_datetime
target:
entity_id: input_datetime.lounge_ir_remote_last_seen
data:
datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
- alias: "Run the matching lounge command"
choose:
- alias: "Scene commands"
conditions:
- condition: template
value_template: "{{ ir_hash in scene_map }}"
sequence:
- action: script.lounge_set_scene
data:
scene_name: "{{ scene_map[ir_hash] }}"
- alias: "Toggle Rinnai gas heater"
conditions:
- condition: template
value_template: "{{ ir_hash == '0x2b4da162' }}"
sequence:
- variables:
currently_on: "{{ is_state('switch.rinnai_neo_gas_heater_heater_operation', 'on') }}"
- variables:
new_state_text: "{{ 'Off' if currently_on else 'On' }}"
- choose:
- conditions:
- condition: template
value_template: "{{ currently_on }}"
sequence:
- action: switch.turn_off
target:
entity_id: switch.rinnai_neo_gas_heater_heater_operation
default:
- action: switch.turn_on
target:
entity_id: switch.rinnai_neo_gas_heater_heater_operation
- action: script.view_road_announcement
data:
channels: "sony_tv_lounge"
title: "View Road"
short_announcement: "Rinnai Gas Heater"
long_announcement: ""
payload: "{{ new_state_text }}"
indicator: ""
- alias: "Toggle surround amplifier"
conditions:
- condition: template
value_template: "{{ ir_hash == '0xc2997ec2' }}"
sequence:
- variables:
currently_on: "{{ is_state('switch.tv_surround_amp_power_in_loft_x27pp', 'on') }}"
- variables:
new_state_text: "{{ 'Off' if currently_on else 'On' }}"
- choose:
- conditions:
- condition: template
value_template: "{{ currently_on }}"
sequence:
- action: switch.turn_off
target:
entity_id: switch.tv_surround_amp_power_in_loft_x27pp
default:
- action: switch.turn_on
target:
entity_id: switch.tv_surround_amp_power_in_loft_x27pp
- action: script.view_road_announcement
data:
channels: "sony_tv_lounge"
title: "View Road"
short_announcement: "Surround Amplifier"
long_announcement: ""
payload: "{{ new_state_text }}"
indicator: ""
-12
View File
@@ -1,12 +0,0 @@
#mqtt_statestream:
# base_topic: hamqtt
# publish_attributes: true
# publish_timestamps: true
# include:
# entities:
# - sensor.main_bathroom_humidity_change_rate
# entity_globs:
# - sensor.*_zt*
#exclude:
# entity_globs:
# - sensor.*zoruno*
+2 -2
View File
@@ -15,9 +15,9 @@ template:
light:
- platform: group
name: "Entities to keep NSPanel Awake"
unique_id: "Entities to keep_nspanel_awake"
unique_id: entities_to_keep_nspanel_awake
entities:
- light.inverted_quiet_time_as_light
- light.inverted_quiet_time_as_light_2
- light.master_bedroom_bedside_lamp_arlec_bulb_master_bedroom_bedside_lamp_arlec_bulb
- light.tasmo_ifan02_3793_bedrm1_1
- light.tasmo_ks811t_3647_bedrm1_1b
@@ -6,6 +6,7 @@
# - Keep backlight control separate from the thermostat/heater UI package.
# - Avoid using brightness 0 as the main OFF method.
# - Wake the panel with "idle off" before applying brightness.
# - Quiet Time overrides everything and forces the backlight OFF.
#
# OPENHASP NOTES:
# - backlight brightness range is 1..255
@@ -35,9 +36,32 @@ input_number:
# AUTOMATIONS
###############################################################################
automation:
# -------------------------------------------------------------------------
# Quiet Time override
# - Quiet Time ON -> force backlight OFF
# - Quiet Time OFF -> re-apply the requested backlight state
# -------------------------------------------------------------------------
- id: openhasp_1_backlight_quiet_time_changed
alias: "OpenHASP 1: backlight quiet time changed"
mode: restart
trigger:
- platform: state
entity_id: input_boolean.quiet_time
action:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.quiet_time
state: "on"
sequence:
- service: script.openhasp_1_backlight_off
default:
- service: script.openhasp_1_backlight_apply_requested_state
# -------------------------------------------------------------------------
# Backlight enable helper changed
# - ON -> wake panel and apply current brightness level
# - ON -> wake panel and apply current brightness level, unless Quiet Time
# - OFF -> tell openHASP to switch the backlight off
# -------------------------------------------------------------------------
- id: openhasp_1_backlight_enable_changed
@@ -52,6 +76,9 @@ automation:
- condition: state
entity_id: input_boolean.openhasp_1_backlight_enable
state: "on"
- condition: state
entity_id: input_boolean.quiet_time
state: "off"
sequence:
- service: script.openhasp_1_backlight_apply
@@ -60,8 +87,8 @@ automation:
# -------------------------------------------------------------------------
# Backlight level helper changed
# - If backlight is enabled, apply the new level immediately
# - If disabled, just store the new level for next time
# - If backlight is enabled and Quiet Time is OFF, apply the new level
# - If disabled or Quiet Time is ON, just store the new level for later
# -------------------------------------------------------------------------
- id: openhasp_1_backlight_level_changed
alias: "OpenHASP 1: backlight level changed"
@@ -73,11 +100,15 @@ automation:
- condition: state
entity_id: input_boolean.openhasp_1_backlight_enable
state: "on"
- condition: state
entity_id: input_boolean.quiet_time
state: "off"
action:
- service: script.openhasp_1_backlight_apply
# -------------------------------------------------------------------------
# Re-apply requested backlight state when Home Assistant starts
# Quiet Time is checked inside the script.
# -------------------------------------------------------------------------
- id: openhasp_1_backlight_on_ha_start
alias: "OpenHASP 1: apply backlight on HA start"
@@ -91,6 +122,7 @@ automation:
# -------------------------------------------------------------------------
# Re-apply requested backlight state when the panel reconnects
# Quiet Time is checked inside the script.
# -------------------------------------------------------------------------
- id: openhasp_1_backlight_on_panel_online
alias: "OpenHASP 1: apply backlight on panel online"
@@ -109,8 +141,7 @@ automation:
# If openHASP enters idle while HA says the backlight should be enabled,
# wake it and re-apply the requested brightness.
#
# This is intended to stop the "black until touched" behaviour when the
# plate's own idle state has blanked the display.
# Quiet Time blocks this recovery, so the panel stays dark overnight.
# -------------------------------------------------------------------------
- id: openhasp_1_backlight_recover_from_idle
alias: "OpenHASP 1: recover backlight from idle"
@@ -122,6 +153,9 @@ automation:
- condition: state
entity_id: input_boolean.openhasp_1_backlight_enable
state: "on"
- condition: state
entity_id: input_boolean.quiet_time
state: "off"
- condition: template
value_template: "{{ trigger.payload | lower != 'off' }}"
action:
@@ -181,13 +215,25 @@ script:
# -------------------------------------------------------------------------
# Apply either ON/current-level or OFF according to helper state.
# Used on HA startup and panel reconnect.
# Used on HA startup, panel reconnect, and Quiet Time changes.
#
# Priority:
# 1. Quiet Time ON -> backlight OFF
# 2. Backlight Enable ON -> apply current level
# 3. Backlight Enable OFF -> backlight OFF
# -------------------------------------------------------------------------
openhasp_1_backlight_apply_requested_state:
alias: "OpenHASP 1: apply requested backlight state"
mode: restart
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.quiet_time
state: "on"
sequence:
- service: script.openhasp_1_backlight_off
- conditions:
- condition: state
entity_id: input_boolean.openhasp_1_backlight_enable
+382
View File
@@ -0,0 +1,382 @@
################################################################################
# PACKAGE: View Road Announcement Router
################################################################################
#
# Version: 1.2
# Date: 2026-05-06
#
# Purpose:
# Central announcement router for general Home Assistant announcements.
# Other scripts and automations can call script.view_road_announcement and pass
# values such as channels, title, short_announcement, long_announcement,
# payload, and indicator.
#
# Changes:
# 1.2:
# - Updated Lounge Google Home voice channel to use working Piper TTS setup.
# - Added Piper voice option en_GB-alba-medium.
# - Removed separate TTS language option from the voice channel.
#
# 1.1:
# - Removed old YAML Pushover notify service setup.
# - Uses existing Pushover integration notify entities.
# - Added quiet time channel blocking.
# - Added Lounge Google Home voice announcement channel.
#
# Notes:
# - Use input_boolean helpers for channel enable/disable control.
# - Binary sensors are read-only, so input_boolean is the correct helper type.
# - Channels with no action block yet intentionally do nothing.
#
################################################################################
################################################################################
# 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
################################################################################
input_boolean:
announcement_channel_pushover_zorruno:
name: Announcement Channel - Pushover Zorruno
icon: mdi:cellphone-message
initial: true
announcement_channel_pushover_kim:
name: Announcement Channel - Pushover Kim
icon: mdi:cellphone-message
initial: true
announcement_channel_sony_tv_lounge:
name: Announcement Channel - Sony TV Lounge
icon: mdi:television
initial: true
announcement_channel_lounge_google_home_voice:
name: Announcement Channel - Lounge Google Home Voice
icon: mdi:speaker
initial: true
announcement_channel_lounge_touchscreen_voice:
name: Announcement Channel - Lounge Touchscreen Voice
icon: mdi:tablet-dashboard
initial: true
announcement_channel_mqtt_view_rd_feed:
name: Announcement Channel - MQTT View Rd Feed
icon: mdi:message-processing
initial: true
################################################################################
# MAIN ANNOUNCEMENT ROUTER SCRIPT
################################################################################
script:
view_road_announcement:
alias: View Road Announcement
icon: mdi:bullhorn
mode: parallel
max: 20
fields:
channels:
name: Channels
description: Comma separated list of announcement channels to use.
example: "pushover_zorruno, sony_tv_lounge"
selector:
text:
title:
name: Title
description: Announcement title.
example: "View Road"
selector:
text:
short_announcement:
name: Short Announcement
description: Short announcement text.
example: "Garage door"
selector:
text:
long_announcement:
name: Long Announcement
description: Longer announcement text.
example: "The garage door has been opened."
selector:
text:
multiline: true
payload:
name: Payload
description: Payload value such as On, Off, Open, Closed, etc.
example: "Open"
selector:
text:
indicator:
name: Indicator
description: Future indicator data such as LED number, colour, or flash pattern.
example: "red, led 2, flash fast"
selector:
text:
sequence:
##########################################################################
# DEFAULT VALUES
##########################################################################
#
# If a value is not passed, the default below is used.
# If a value is passed as "", it clears the default to blank.
#
# quiet_time_blocked_channels:
# Channels in this list will not run while input_boolean.quiet_time is on.
#
##########################################################################
- variables:
default_channels: "pushover_zorruno, pushover_kim, sony_tv_lounge, lounge_google_home_voice, lounge_touchscreen_voice, mqtt_view_rd_feed"
default_title: "View Road"
default_short_announcement: "Home automation announcement"
default_long_announcement: "Home automation announcement"
default_payload: ""
default_indicator: ""
quiet_time_blocked_channels:
- "google_home_voice"
- "lounge_google_home_voice"
- "lounge_touchscreen_voice"
lounge_google_home_voice_media_player: "media_player.lounge_google_tichome_speaker"
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
##########################################################################
# RESOLVE PASSED VALUES
##########################################################################
- variables:
ann_channels_raw: >-
{% if channels is defined %}
{{ channels }}
{% elif channel is defined %}
{{ channel }}
{% elif Channel is defined %}
{{ Channel }}
{% else %}
{{ default_channels }}
{% endif %}
ann_title: >-
{% if title is defined %}
{{ title }}
{% elif Title is defined %}
{{ Title }}
{% else %}
{{ default_title }}
{% endif %}
ann_short_announcement: >-
{% if short_announcement is defined %}
{{ short_announcement }}
{% elif Short_Announcement is defined %}
{{ Short_Announcement }}
{% else %}
{{ default_short_announcement }}
{% endif %}
ann_long_announcement: >-
{% if long_announcement is defined %}
{{ long_announcement }}
{% elif Long_Announcement is defined %}
{{ Long_Announcement }}
{% else %}
{{ default_long_announcement }}
{% endif %}
ann_payload: >-
{% if payload is defined %}
{{ payload }}
{% elif Payload is defined %}
{{ Payload }}
{% else %}
{{ default_payload }}
{% endif %}
ann_indicator: >-
{% if indicator is defined %}
{{ indicator }}
{% elif Indicator is defined %}
{{ Indicator }}
{% else %}
{{ default_indicator }}
{% endif %}
##########################################################################
# NORMALISE CHANNEL LISTS AND MESSAGE TEXT
##########################################################################
- variables:
ann_channels_normalised: >-
{{ ',' ~ (ann_channels_raw | string | lower | replace(' ', '') | replace('\n', '') | trim(',')) ~ ',' }}
ann_quiet_time_blocked_channels_normalised: >-
{{ ',' ~ (quiet_time_blocked_channels | join(',') | lower | replace(' ', '') | replace('\n', '') | trim(',')) ~ ',' }}
ann_sony_tv_message: >-
{% set short_text = ann_short_announcement | string | trim %}
{% set payload_text = ann_payload | string | trim %}
{% if short_text | length > 0 and payload_text | length > 0 %}
{{ short_text }} is {{ payload_text }}
{% elif short_text | length > 0 %}
{{ short_text }}
{% else %}
{{ payload_text }}
{% endif %}
ann_voice_message: >-
{% set long_text = ann_long_announcement | string | trim %}
{% set short_text = ann_short_announcement | string | trim %}
{% set payload_text = ann_payload | string | trim %}
{% if long_text | length > 0 %}
{{ long_text }}
{% elif short_text | length > 0 and payload_text | length > 0 %}
{{ short_text }} is {{ payload_text }}
{% elif short_text | length > 0 %}
{{ short_text }}
{% else %}
{{ payload_text }}
{% endif %}
##########################################################################
# CHANNEL: PUSHOVER ZORRUNO
##########################################################################
- if:
- condition: template
value_template: "{{ ',pushover_zorruno,' in ann_channels_normalised }}"
- condition: state
entity_id: input_boolean.announcement_channel_pushover_zorruno
state: "on"
then:
- action: notify.pushover_zorruno
data:
title: "{{ ann_title }}"
message: "{{ ann_long_announcement }}"
##########################################################################
# CHANNEL: PUSHOVER KIM
##########################################################################
- if:
- condition: template
value_template: "{{ ',pushover_kim,' in ann_channels_normalised }}"
- condition: state
entity_id: input_boolean.announcement_channel_pushover_kim
state: "on"
then:
- action: notify.pushover_kim
data:
title: "{{ ann_title }}"
message: "{{ ann_long_announcement }}"
##########################################################################
# CHANNEL: SONY TV LOUNGE
##########################################################################
- if:
- condition: template
value_template: "{{ ',sony_tv_lounge,' in ann_channels_normalised }}"
- condition: state
entity_id: input_boolean.announcement_channel_sony_tv_lounge
state: "on"
then:
- action: notify.sony_android_tv_lounge
data:
title: "{{ ann_title }}"
message: "{{ ann_sony_tv_message }}"
##########################################################################
# CHANNEL: LOUNGE GOOGLE HOME VOICE
##########################################################################
#
# Also accepts google_home_voice as an alias channel name.
#
# This channel is blocked during quiet time by default.
#
##########################################################################
- if:
- condition: template
value_template: >-
{{
',lounge_google_home_voice,' in ann_channels_normalised
or ',google_home_voice,' in ann_channels_normalised
}}
- condition: state
entity_id: input_boolean.announcement_channel_lounge_google_home_voice
state: "on"
- condition: template
value_template: >-
{{ not (
is_state('input_boolean.quiet_time', 'on')
and (
',lounge_google_home_voice,' in ann_quiet_time_blocked_channels_normalised
or ',google_home_voice,' in ann_quiet_time_blocked_channels_normalised
)
) }}
- condition: template
value_template: "{{ ann_voice_message | string | trim | length > 0 }}"
then:
- action: media_player.volume_set
data:
entity_id: "{{ lounge_google_home_voice_media_player }}"
volume_level: "{{ lounge_google_home_voice_volume_level | float(0.8) }}"
- delay:
seconds: 1
- action: tts.speak
target:
entity_id: "{{ lounge_google_home_voice_tts_entity }}"
data:
cache: false
media_player_entity_id: "{{ lounge_google_home_voice_media_player }}"
message: "{{ ann_voice_message }}"
options:
voice: "{{ lounge_google_home_voice_piper_voice }}"
preferred_format: mp3
preferred_sample_rate: 44100
##########################################################################
# CHANNEL: LOUNGE TOUCHSCREEN VOICE
##########################################################################
#
# Placeholder only. No action yet.
#
# This channel is listed in quiet_time_blocked_channels for future use.
#
##########################################################################
##########################################################################
# CHANNEL: MQTT VIEW RD FEED
##########################################################################
#
# Placeholder only. No action yet.
#
##########################################################################