Schoettli HomeLab

Wissensdatenbank

Automatische Rückkehr zum Start-Dashboard

Übersicht

Was wird gebaut?

Szenario:

  • User navigiert zu einem Dashboard (z.B. Radio)
  • Nach 5 Sekunden ohne Interaktion
  • Automatisch zurück zum Start-Dashboard

Zwei Varianten:

  1. Einfach: Wechselt immer nach 5s (keine Touch-Erkennung)
  2. Erweitert: Reset bei Touch/Klick (komplexer)

Variante 1: Einfache Auto-Return (⭐ EMPFOHLEN)

Was wird erstellt?

  • Timer Helper: Zählt 5 Sekunden
  • Automation 1: Startet Timer bei Dashboard-Wechsel
  • Automation 2: Navigiert zurück bei Timer-Ende

Schritt 1: Timer Helper erstellen

  1. Einstellungen → Geräte & Dienste → Helfer
  2. „+ HELFER ERSTELLEN“ → „Timer“
  3. Konfiguration:
    • Name: Auto Return Timer
    • Icon: mdi:timer-sand
    • Dauer: 00:00:05 (5 Sekunden)
    • Wiederherstellen: Nein
  4. ERSTELLEN
    • Entity ID: timer.auto_return_timer

Schritt 2: Input Text Helper (Optional aber empfohlen)

Speichert aktuelles Dashboard für Logik

  1. „+ HELFER ERSTELLEN“ → „Text-Eingabe erstellen“
  2. Konfiguration:
    • Name: Aktueller Dashboard Pfad
    • Icon: mdi:monitor-dashboard
    • Max. Länge: 255
  3. ERSTELLEN
    • Entity ID: input_text.aktueller_dashboard_pfad

Schritt 3: Automation 1 – Timer starten

Startet Timer auf allen Dashboards (außer Start)

Via UI erstellen:

  1. Einstellungen → Automationen & Szenen
  2. „+ AUTOMATION ERSTELLEN“
  3. „Neue Automation erstellen“
  4. Name: Auto Return - Timer starten
  5. Trigger hinzufügen:
    • Trigger-Typ: Zustand
    • Entity: sensor.DEIN_BROWSER_path
      • Finde deinen Browser: Einstellungen → Geräte & Dienste → Browser Mod
      • Klicke auf dein Browser-Gerät
      • Suche Sensor mit _path am Ende
      • Z.B.: sensor.chrome_windows_path
    • Von: (leer lassen)
    • Nach: (leer lassen)
  6. Condition hinzufügen:
    • Condition-Typ: Template
    • Value Template:
    {{ not states('sensor.DEIN_BROWSER_path').endswith('/haus') }}
    
    • Ersetze DEIN_BROWSER mit deiner Sensor-Entity
    • Ersetze /haus mit deinem Start-Dashboard-Pfad
  7. Action hinzufügen:

    Action 1 – Input Text updaten:

    • Action-Typ: Service aufrufen
    • Service: input_text.set_value
    • Ziele: input_text.aktueller_dashboard_pfad
    • Daten:
    value: "{{ states('sensor.DEIN_BROWSER_path') }}"
    

    Action 2 – Timer starten:

    • Action-Typ: Service aufrufen
    • Service: timer.start
    • Ziele: timer.auto_return_timer
  8. Speichern

Als YAML (Alternative):

alias: Auto Return - Timer starten
description: Startet Timer bei Dashboard-Wechsel
trigger:
  - platform: state
    entity_id: sensor.chrome_windows_path  # ← Ersetze mit deinem Sensor
condition:
  - condition: template
    value_template: >
      {{ not states('sensor.chrome_windows_path').endswith('/haus') }}  # ← Ersetze mit deinem Sensor und Start-Dashboard
action:
  - service: input_text.set_value
    target:
      entity_id: input_text.aktueller_dashboard_pfad
    data:
      value: "{{ states('sensor.chrome_windows_path') }}" # ← Ersetze mit deinem Sensor - service: timer.start target: entity_id: timer.auto_return_timer data: duration: "00:00:05" mode: restart 

Schritt 4: Automation 2 – Zurück navigieren

Navigiert zu Start-Dashboard wenn Timer abläuft

Via UI erstellen:

  1. „+ AUTOMATION ERSTELLEN“
  2. Name: Auto Return - Zu Start navigieren
  3. Trigger:
    • Typ: Event
    • Event type: timer.finished
    • Event data:
    entity_id: timer.auto_return_timer
    
  4. Condition:
    • Typ: Template
    • Value Template:
    {{ not states('sensor.DEIN_BROWSER_path').endswith('/haus') }} # ← Ersetze mit deinem Sensor
    
  5. Action:
    • Service: browser_mod.navigate
    • Daten:
    path: /dashboard-haus/haus 
    
    • Ersetze /dashboard-haus/haus mit deinem Start-Dashboard-Pfad
  6. Speichern

Als YAML:

alias: Auto Return - Zu Start navigieren
description: Navigiert nach 5 Sekunden zum Start-Dashboard
trigger:
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.auto_return_timer
condition:
  - condition: template
    value_template: >
      {{ not states('sensor.chrome_windows_path').endswith('/haus') }} # ← Ersetze mit deinem Sensor
      # ← Nur wenn nicht bereits auf Start
action:
  - service: browser_mod.navigate
    data:
      path: /dashboard-haus/haus  # ← DEIN START-DASHBOARD
mode: single

Schritt 5: Testen

  1. Navigiere zu einem Dashboard
    • Z.B. /dashboard-haus/radio
  2. Warte 5 Sekunden
    • Timer läuft im Hintergrund
    • Du siehst nichts (ist gewollt)
  3. Nach 5 Sekunden:
    • Automatisch zurück zu /dashboard-haus/haus
    • ✅ Funktioniert!
  4. Auf Start-Dashboard:
    • Timer startet NICHT
    • Bleibt auf Start
    • ✅ Korrekt!

Variante 2: Mit On/Off Schalter

Zusätzlicher Helper für Steuerung

Ermöglicht Ein/Ausschalten der Auto-Return-Funktion

Schritt 1: Input Boolean erstellen

  1. Einstellungen → Geräte & Dienste → Helfer
  2. „+ HELFER ERSTELLEN“ → „Schalter“
  3. Konfiguration:
    • Name: Auto Return aktiv
    • Icon: mdi:arrow-u-left-top
    • Anfangszustand: Ein
  4. ERSTELLEN
    • Entity ID: input_boolean.auto_return_aktiv

Schritt 2: Automation 2 anpassen

Füge Condition hinzu:

Im YAML der zweiten Automation:

condition:
  - condition: state
    entity_id: input_boolean.auto_return_aktiv
    state: "on"
  - condition: template
    value_template: >
      {{ not states('sensor.chrome_windows_path').endswith('/haus') }}

Schritt 3: Button in Sidebar

In deiner Sidebar-Config:

- type: custom:button-card
  entity: input_boolean.auto_return_aktiv
  show_name: true
  show_icon: true
  name: Auto-Return
  icon: mdi:arrow-u-left-top
  tap_action:
    action: toggle
  styles:
    card:
      - background: |
          [[[
            if (entity.state === 'on') {
              return 'rgba(0, 161, 136, 0.2)';
            }
            return 'rgba(255, 255, 255, 0.05)';
          ]]]
      - border-radius: 12px
      - min-height: 60px
    name:
      - color: |
          [[[
            if (entity.state === 'on') {
              return 'rgb(0, 161, 136)';
            }
            return 'rgba(255, 255, 255, 0.7)';
          ]]]
    icon:
      - color: |
          [[[
            if (entity.state === 'on') {
              return 'rgb(0, 161, 136)';
            }
            return 'rgba(255, 255, 255, 0.7)';
          ]]]

Variante 3: Mit Touch-Reset (ERWEITERT)

Konzept

Timer resettet bei jeder Interaktion:

  • User klickt/touched etwas
  • Timer startet von vorne
  • Nur bei 5s OHNE Touch wird gewechselt

Zusätzliche Komponenten

Problem: Home Assistant hat keinen eingebauten Touch-Sensor

Lösung: Template Binary Sensor + Button-Card Trick

Schritt 1: Template Binary Sensor

In configuration.yaml:

template:
  - binary_sensor:
      - name: User Activity
        unique_id: user_activity_sensor
        state: >
          {{ false }}
        delay_off:
          seconds: 1

Nach Änderung:

  • Entwicklerwerkzeuge → YAML → „Alle YAML-Konfigurationen neu laden“

Schritt 2: Touch-Detection Card

Auf JEDEM Dashboard eine unsichtbare Card:

type: custom:button-card
name: Touch Detection
show_name: false
show_icon: false
tap_action:
  action: call-service
  service: timer.start
  service_data:
    entity_id: timer.auto_return_timer
    duration: "00:00:05"
styles:
  card:
    - position: fixed
    - top: 0
    - left: 0
    - width: 100%
    - height: 100%
    - z-index: 0
    - background: transparent
    - pointer-events: none

Problem: Dies ist komplex und funktioniert nicht zuverlässig

Bessere Lösung: Variante 1 nutzen (ohne Touch-Reset)

Verschiedene Zeitintervalle

Verschiedene Timer für verschiedene Dashboards

Setup

Timer 1: 5 Sekunden (Standard) Timer 2: 30 Sekunden (Radio/Media) Timer 3: 10 Sekunden (Licht)

Helper erstellen

  1. Timer 1: timer.auto_return_5s – 00:00:05
  2. Timer 2: timer.auto_return_30s – 00:00:30
  3. Timer 3: timer.auto_return_10s – 00:00:10

Automation mit Choose

alias: Auto Return - Smart Timer
description: Verschiedene Timer je nach Dashboard
trigger:
  - platform: state
    entity_id: sensor.chrome_windows_path
condition:
  - condition: template
    value_template: >
      {{ not states('sensor.chrome_windows_path').endswith('/haus') }}
action:
  - choose:
      # Radio & Media = 30 Sekunden
      - conditions:
          - condition: template
            value_template: >
              {{ '/radio' in states('sensor.chrome_windows_path') or
                 '/media' in states('sensor.chrome_windows_path') }}
        sequence:
          - service: timer.start
            target:
              entity_id: timer.auto_return_30s
      
      # Licht = 10 Sekunden
      - conditions:
          - condition: template
            value_template: >
              {{ '/licht' in states('sensor.chrome_windows_path') }}
        sequence:
          - service: timer.start
            target:
              entity_id: timer.auto_return_10s
    
    # Default = 5 Sekunden
    default:
      - service: timer.start
        target:
          entity_id: timer.auto_return_5s
mode: restart

Automation für alle Timer

alias: Auto Return - Multi Timer Navigation
description: Navigiert bei Ablauf eines Timers
trigger:
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.auto_return_5s
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.auto_return_10s
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.auto_return_30s
condition:
  - condition: template
    value_template: >
      {{ not states('sensor.chrome_windows_path').endswith('/haus') }}
action:
  - service: browser_mod.navigate
    data:
      path: /dashboard-haus/haus
mode: single

Nur von bestimmten Dashboards

Szenario

Auto-Return nur von:

  • Radio-Dashboard
  • Licht-Dashboard

Alle anderen: Bleiben wo sie sind

Automation anpassen

alias: Auto Return - Nur bestimmte Dashboards
description: Auto-Return nur von Radio und Licht
trigger:
  - platform: state
    entity_id: sensor.chrome_windows_path
condition:
  - condition: or
    conditions:
      - condition: template
        value_template: >
          {{ '/radio' in states('sensor.chrome_windows_path') }}
      - condition: template
        value_template: >
          {{ '/licht' in states('sensor.chrome_windows_path') }}
action:
  - service: timer.start
    target:
      entity_id: timer.auto_return_timer
mode: restart

Nur zu bestimmten Zeiten

Szenario

Auto-Return nur nachts (22:00 – 07:00)

Tagsüber: Kein Auto-Return

Automation mit Time Condition

alias: Auto Return - Nur nachts
description: Auto-Return nur zwischen 22:00 und 07:00
trigger:
  - platform: state
    entity_id: sensor.chrome_windows_path
condition:
  - condition: or
    conditions:
      - condition: time
        after: "22:00:00"
      - condition: time
        before: "07:00:00"
  - condition: template
    value_template: >
      {{ not states('sensor.chrome_windows_path').endswith('/haus') }}
action:
  - service: timer.start
    target:
      entity_id: timer.auto_return_timer
mode: restart

Mit visuellem Feedback

Timer-Countdown anzeigen

Markdown Card die Countdown zeigt:

type: markdown
content: |
  {% if is_state('timer.auto_return_timer', 'active') %}
    🔙 Zurück in {{ state_attr('timer.auto_return_timer', 'remaining') }}
  {% endif %}
card_mod:
  style: |
    ha-card {
      background: rgba(255, 165, 0, 0.2);
      border: 1px solid rgba(255, 165, 0, 0.5);
      border-radius: 12px;
      padding: 8px;
      text-align: center;
      font-size: 14px;
      color: rgba(255, 165, 0, 1);
      position: fixed;
      bottom: 80px;
      right: 20px;
      z-index: 999;
      min-width: 200px;
    }

Platziere auf jedem Dashboard (außer Start)

Zeigt:

  • 🔙 Zurück in 0:00:04″
  • 🔙 Zurück in 0:00:03″

Pause-Button

Button zum Pausieren

Card zum Timer pausieren:

type: custom:button-card
entity: timer.auto_return_timer
name: Pause
icon: mdi:pause
show_name: true
show_icon: true
tap_action:
  action: call-service
  service: timer.pause
  service_data:
    entity_id: timer.auto_return_timer
hold_action:
  action: call-service
  service: timer.cancel
  service_data:
    entity_id: timer.auto_return_timer
styles:
  card:
    - background: rgba(255, 165, 0, 0.2)
    - border-radius: 12px
    - padding: 10px
  name:
    - color: white
  icon:
    - color: rgba(255, 165, 0, 1)

Funktion:

  • Tap: Timer pausieren
  • Hold: Timer abbrechen

Mehrere Browser unterstützen

Problem

Wenn du mehrere Geräte hast (Tablet, Desktop, Handy):

  • Jedes hat eigenen Sensor
  • Automation muss alle berücksichtigen

Lösung: Trigger für alle Browser

trigger:
  - platform: state
    entity_id:
      - sensor.tablet_wohnzimmer_path
      - sensor.chrome_windows_path
      - sensor.iphone_safari_path

Action: Navigiere alle Browser

action:
  - service: browser_mod.navigate
    data:
      path: /dashboard-haus/haus
    # Ohne browser_id = alle Browser

Oder: Nur aktiven Browser

action:
  - service: browser_mod.navigate
    data:
      path: /dashboard-haus/haus
      browser_id: "{{ trigger.entity_id.replace('sensor.', '').replace('_path', '') }}"

Kombination mit Dashboard-Rotation

Setup

Auf Start-Dashboard:

  • Dashboard-Rotation läuft (alle 15s wechseln)
  • KEIN Auto-Return

Auf anderen Dashboards:

  • KEIN Rotation
  • MIT Auto-Return nach 5s

Automation-Logik

Rotation-Automation:

condition:
  - condition: template
    value_template: >
      {{ states('sensor.chrome_windows_path').endswith('/haus') }}

→ Nur auf Start-Dashboard

Auto-Return-Automation:

condition:
  - condition: template
    value_template: >
      {{ not states('sensor.chrome_windows_path').endswith('/haus') }}

→ Nur NICHT auf Start-Dashboard

Ergebnis:

  • Start rotiert automatisch
  • User kann zu Radio navigieren
  • Nach 5s zurück zu Start
  • Start rotiert weiter
  • Perfekt für Wandtablet!