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
@@ -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