You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
5.4 KiB
133 lines
5.4 KiB
######################################################################
|
|
# @CCOSTAN - Follow Me on X
|
|
# For more info visit https://www.vcloudinfo.com/click-here
|
|
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
|
# -------------------------------------------------------------------
|
|
# Bedroom Kiosk Tablet - Fully Kiosk page recovery
|
|
# Keeps the Master Bedroom Fire tablet pinned to the kiosk dashboard.
|
|
# -------------------------------------------------------------------
|
|
# Notes: Baseline view path is the real typo-like `kiosk_oveview` slug.
|
|
# Notes: Uses Fully controls only; does not enable Fully Kiosk lockout mode.
|
|
# Notes: Wake events only restore brightness/focus; URL reloads require page drift.
|
|
# Notes: Fully auto-reload on screen-on/screensaver-stop is disabled to avoid motion wake reload loops.
|
|
# Notes: Startup recovery waits for HA's initial websocket state burst to settle.
|
|
# Notes: Brightness recovery only runs when both SleepIQ in-bed sensors are off.
|
|
# Video: https://youtu.be/ChgEu0IDWzc
|
|
######################################################################
|
|
|
|
automation:
|
|
- alias: "Bedroom Kiosk Tablet - Return to Kiosk View"
|
|
id: 11e50d2e-f66f-4fd0-86f4-bdca075c3a1c
|
|
mode: single
|
|
max_exceeded: silent
|
|
trigger:
|
|
- platform: state
|
|
entity_id: switch.alarm_panel_1_screen
|
|
to: "on"
|
|
for: "00:00:03"
|
|
id: wake
|
|
- platform: state
|
|
entity_id: switch.alarm_panel_1_screensaver
|
|
to: "off"
|
|
for: "00:00:03"
|
|
id: wake
|
|
- platform: state
|
|
entity_id:
|
|
- sensor.alarm_panel_1_current_page
|
|
- sensor.alarm_panel_1_foreground_app
|
|
- number.alarm_panel_1_screen_brightness
|
|
for: "00:00:10"
|
|
id: drift
|
|
- platform: time_pattern
|
|
minutes: "/1"
|
|
id: periodic
|
|
- platform: homeassistant
|
|
event: start
|
|
id: startup
|
|
|
|
condition:
|
|
- condition: state
|
|
entity_id: switch.alarm_panel_1_screen
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: switch.alarm_panel_1_screensaver
|
|
state: "off"
|
|
- condition: template
|
|
value_template: >-
|
|
{% set current_page = states('sensor.alarm_panel_1_current_page') %}
|
|
{% set foreground_app = states('sensor.alarm_panel_1_foreground_app') %}
|
|
{% set brightness = states('number.alarm_panel_1_screen_brightness') %}
|
|
{% set bed_clear = is_state('binary_sensor.sleepnumber_carlo_carlo_is_in_bed', 'off')
|
|
and is_state('binary_sensor.sleepnumber_carlo_stacey_is_in_bed', 'off') %}
|
|
{% set invalid = ['unknown', 'unavailable', 'none', ''] %}
|
|
{{ (current_page not in invalid and '/dashboard-kiosk/kiosk_oveview' not in current_page)
|
|
or (foreground_app not in invalid and foreground_app != 'de.ozerov.fully')
|
|
or (bed_clear and brightness not in invalid and brightness | float(100) < 40) }}
|
|
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: startup
|
|
sequence:
|
|
- delay: "00:02:00"
|
|
- variables:
|
|
previous_page: "{{ states('sensor.alarm_panel_1_current_page') }}"
|
|
previous_app: "{{ states('sensor.alarm_panel_1_foreground_app') }}"
|
|
previous_brightness: "{{ states('number.alarm_panel_1_screen_brightness') }}"
|
|
invalid:
|
|
- unknown
|
|
- unavailable
|
|
- none
|
|
- ""
|
|
- variables:
|
|
brightness_low: >-
|
|
{{ is_state('binary_sensor.sleepnumber_carlo_carlo_is_in_bed', 'off')
|
|
and is_state('binary_sensor.sleepnumber_carlo_stacey_is_in_bed', 'off')
|
|
and previous_brightness not in invalid
|
|
and previous_brightness | float(100) < 40 }}
|
|
foreground_drift: >-
|
|
{{ previous_app not in invalid and previous_app != 'de.ozerov.fully' }}
|
|
page_drift: >-
|
|
{{ previous_page not in invalid
|
|
and '/dashboard-kiosk/kiosk_oveview' not in previous_page }}
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ brightness_low | bool }}"
|
|
sequence:
|
|
- service: number.set_value
|
|
target:
|
|
entity_id: number.alarm_panel_1_screen_brightness
|
|
data:
|
|
value: 100
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ foreground_drift | bool }}"
|
|
sequence:
|
|
- service: button.press
|
|
target:
|
|
entity_id: button.alarm_panel_1_bring_to_foreground
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ page_drift | bool }}"
|
|
sequence:
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ foreground_drift | bool }}"
|
|
sequence:
|
|
- delay: "00:00:02"
|
|
- service: button.press
|
|
target:
|
|
entity_id: button.alarm_panel_1_load_start_url
|
|
- service: script.send_to_logbook
|
|
data:
|
|
topic: "KIOSK"
|
|
message: >-
|
|
Bedroom tablet reloaded after page drift from
|
|
{{ previous_page }} (foreground app: {{ previous_app }};
|
|
brightness: {{ previous_brightness }}).
|