From df734d92595ec71123b905eada1b15ec66fe67df Mon Sep 17 00:00:00 2001 From: Claus Dethlefsen Date: Fri, 24 Apr 2026 19:03:13 +0200 Subject: [PATCH] Syg-status: sluk alarmer+motion lys, kompakt person view --- dashboards/views/02_person_status.yaml | 84 ++++++++++----- include/automations/alarms.yaml | 24 +++++ include/automations/lys_andreas.yaml | 4 + include/automations/lys_daniel.yaml | 4 + include/automations/lys_sovevaerelse.yaml | 8 ++ include/automations/syg.yaml | 120 ++++++++++++++++++++++ 6 files changed, 220 insertions(+), 24 deletions(-) create mode 100644 include/automations/syg.yaml diff --git a/dashboards/views/02_person_status.yaml b/dashboards/views/02_person_status.yaml index 87b9110..aceb659 100644 --- a/dashboards/views/02_person_status.yaml +++ b/dashboards/views/02_person_status.yaml @@ -2,42 +2,77 @@ title: Person Status path: person-status icon: mdi:account-group type: sections -max_columns: 1 # én kolonne for fuld bredde +max_columns: 1 sections: - # 👨‍👩‍👧‍👦 Personer (2x2 grid) + # 👨‍👩‍👧‍👦 Personer – kompakt 2x2 grid - type: grid columns: 2 square: false cards: - - type: entities - title: Daniel - entities: - - entity: person.daniel_schusler_dethlefsen - - entity: input_select.daniel_status + - type: vertical-stack + cards: + - type: custom:mushroom-person-card + entity: person.andreas_schusler_dethlefsen + name: Andreas + secondary_info: last_changed + layout: horizontal + tap_action: + action: more-info + - type: custom:mushroom-select-card + entity: input_select.andreas_status + icon: mdi:account-heart + icon_color: > + {% if is_state('input_select.andreas_status', 'Syg') %}red{% else %}green{% endif %} - - type: entities - title: Claus - entities: - - entity: person.claus_dethlefsen - - entity: input_select.claus_status + - type: vertical-stack + cards: + - type: custom:mushroom-person-card + entity: person.daniel_schusler_dethlefsen + name: Daniel + secondary_info: last_changed + layout: horizontal + tap_action: + action: more-info + - type: custom:mushroom-select-card + entity: input_select.daniel_status + icon: mdi:account-heart + icon_color: > + {% if is_state('input_select.daniel_status', 'Syg') %}red{% else %}green{% endif %} - - type: entities - title: Anne - entities: - - entity: person.anne_schusler_dethlefsen - - entity: input_select.anne_status + - type: vertical-stack + cards: + - type: custom:mushroom-person-card + entity: person.anne_schusler_dethlefsen + name: Anne + secondary_info: last_changed + layout: horizontal + tap_action: + action: more-info + - type: custom:mushroom-select-card + entity: input_select.anne_status + icon: mdi:account-heart + icon_color: > + {% if is_state('input_select.anne_status', 'Syg') %}red{% else %}green{% endif %} - - type: entities - title: Andreas - entities: - - entity: person.andreas_schusler_dethlefsen - - entity: input_select.andreas_status + - type: vertical-stack + cards: + - type: custom:mushroom-person-card + entity: person.claus_dethlefsen + name: Claus + secondary_info: last_changed + layout: horizontal + tap_action: + action: more-info + - type: custom:mushroom-select-card + entity: input_select.claus_status + icon: mdi:account-heart + icon_color: > + {% if is_state('input_select.claus_status', 'Syg') %}red{% else %}green{% endif %} - - # 🗺️ Popup kort nederst + # 🗺️ Popup kort - type: grid cards: - type: custom:button-card @@ -77,3 +112,4 @@ sections: name: Anne - entity: device_tracker.claus_iphone_15pro name: Claus + diff --git a/include/automations/alarms.yaml b/include/automations/alarms.yaml index 3c3a0f3..0dbdc67 100644 --- a/include/automations/alarms.yaml +++ b/include/automations/alarms.yaml @@ -7,6 +7,10 @@ - condition: state entity_id: binary_sensor.arbejdsdagimorgen state: 'on' + - condition: template + value_template: >- + {{ not is_state('input_select.anne_status', 'Syg') and + not is_state('input_select.claus_status', 'Syg') }} action: - service: homeassistant.turn_on entity_id: switch.sonos_alarm_1782 @@ -31,6 +35,8 @@ - condition: state entity_id: binary_sensor.arbejdsdagimorgen state: 'on' + - condition: template + value_template: "{{ not is_state('input_select.andreas_status', 'Syg') }}" action: - service: homeassistant.turn_on entity_id: switch.sonos_alarm_445 @@ -58,6 +64,8 @@ value_template: '{{ now().date() | string != "2022-12-24" }}' - condition: template value_template: '{{ now().date() | string != "2022-12-31" }}' + - condition: template + value_template: "{{ not is_state('input_select.andreas_status', 'Syg') }}" action: - service: homeassistant.turn_on entity_id: switch.sonos_alarm_1874 @@ -78,6 +86,8 @@ - condition: state entity_id: binary_sensor.arbejdsdagimorgen state: 'on' + - condition: template + value_template: "{{ not is_state('input_select.daniel_status', 'Syg') }}" action: - service: homeassistant.turn_on entity_id: switch.sonos_alarm_377 @@ -103,6 +113,8 @@ - condition: state entity_id: binary_sensor.arbejdsdagimorgen state: 'on' + - condition: template + value_template: "{{ not is_state('input_select.daniel_status', 'Syg') }}" action: - service: homeassistant.turn_on entity_id: switch.sonos_alarm_1894 @@ -128,6 +140,8 @@ - condition: state entity_id: binary_sensor.arbejdsdagimorgen state: 'on' + - condition: template + value_template: "{{ not is_state('input_select.daniel_status', 'Syg') }}" action: - service: homeassistant.turn_on entity_id: switch.sonos_alarm_2273 @@ -155,6 +169,8 @@ value_template: '{{ now().date() | string != "2022-12-24" }}' - condition: template value_template: '{{ now().date() | string != "2022-12-31" }}' + - condition: template + value_template: "{{ not is_state('input_select.daniel_status', 'Syg') }}" action: - service: homeassistant.turn_on entity_id: switch.sonos_alarm_3471 @@ -177,6 +193,10 @@ - condition: state entity_id: binary_sensor.arbejdsdagimorgen state: 'on' + - condition: template + value_template: >- + {{ not is_state('input_select.anne_status', 'Syg') and + not is_state('input_select.claus_status', 'Syg') }} action: - service: homeassistant.turn_on entity_id: switch.sonos_alarm_298 @@ -202,6 +222,10 @@ - condition: state entity_id: binary_sensor.arbejdsdagimorgen state: 'on' + - condition: template + value_template: >- + {{ not is_state('input_select.anne_status', 'Syg') and + not is_state('input_select.claus_status', 'Syg') }} action: - service: homeassistant.turn_on entity_id: switch.sonos_alarm_1899 diff --git a/include/automations/lys_andreas.yaml b/include/automations/lys_andreas.yaml index 71419b9..32a8442 100644 --- a/include/automations/lys_andreas.yaml +++ b/include/automations/lys_andreas.yaml @@ -40,6 +40,10 @@ {{ 1000 <= t <= 2030 }} {% endif %} + # Ikke syg + - condition: template + value_template: "{{ not is_state('input_select.andreas_status', 'Syg') }}" + sequence: - service: light.turn_on diff --git a/include/automations/lys_daniel.yaml b/include/automations/lys_daniel.yaml index 8778fc2..6641716 100644 --- a/include/automations/lys_daniel.yaml +++ b/include/automations/lys_daniel.yaml @@ -25,6 +25,8 @@ - condition: time after: '06:30:00' before: '19:30:00' + - condition: template + value_template: "{{ not is_state('input_select.daniel_status', 'Syg') }}" action: - service: homeassistant.turn_on target: @@ -47,6 +49,8 @@ - condition: time after: '10:00:00' before: '19:45:00' + - condition: template + value_template: "{{ not is_state('input_select.daniel_status', 'Syg') }}" action: - service: homeassistant.turn_on target: diff --git a/include/automations/lys_sovevaerelse.yaml b/include/automations/lys_sovevaerelse.yaml index 2040287..e870386 100644 --- a/include/automations/lys_sovevaerelse.yaml +++ b/include/automations/lys_sovevaerelse.yaml @@ -25,6 +25,10 @@ - condition: time after: '06:30:00' before: '20:00:00' + - condition: template + value_template: >- + {{ not is_state('input_select.anne_status', 'Syg') and + not is_state('input_select.claus_status', 'Syg') }} action: - service: homeassistant.turn_on target: @@ -47,6 +51,10 @@ - condition: time after: '10:00:00' before: '20:00:00' + - condition: template + value_template: >- + {{ not is_state('input_select.anne_status', 'Syg') and + not is_state('input_select.claus_status', 'Syg') }} action: - service: homeassistant.turn_on target: diff --git a/include/automations/syg.yaml b/include/automations/syg.yaml new file mode 100644 index 0000000..e787a8c --- /dev/null +++ b/include/automations/syg.yaml @@ -0,0 +1,120 @@ +################################################## +# Syg-status: sluk alarmer + motion-lys ved sygdom +# +# Triggeres af input_select.PERSON_status → "Syg" +# Genaktiverer alarmer når status ikke længere er "Syg" +# Motion-lys håndteres via conditions i lys_*.yaml +################################################## + +# ---- Andreas ---- + +- alias: "Syg - Andreas - sluk alarmer" + id: syg_andreas_sluk_alarmer + trigger: + - platform: state + entity_id: input_select.andreas_status + to: "Syg" + action: + - service: homeassistant.turn_off + target: + entity_id: + - switch.sonos_alarm_445 # Andreas hverdagsalarm + - switch.sonos_alarm_1874 # Andreas lørdag + +- alias: "Syg - Andreas - genaktiver alarmer" + id: syg_andreas_genaktiver_alarmer + trigger: + - platform: state + entity_id: input_select.andreas_status + not_to: "Syg" + condition: + - condition: state + entity_id: binary_sensor.arbejdsdagimorgen + state: "on" + action: + - service: homeassistant.turn_on + target: + entity_id: + - switch.sonos_alarm_445 + - switch.sonos_alarm_1874 + +# ---- Daniel ---- + +- alias: "Syg - Daniel - sluk alarmer" + id: syg_daniel_sluk_alarmer + trigger: + - platform: state + entity_id: input_select.daniel_status + to: "Syg" + action: + - service: homeassistant.turn_off + target: + entity_id: + - switch.sonos_alarm_377 # Daniel hverdagsalarm + - switch.sonos_alarm_1894 # Daniel afsted + - switch.sonos_alarm_2273 # Daniel man/fre + - switch.sonos_alarm_3471 # Daniel lørdag + +- alias: "Syg - Daniel - genaktiver alarmer" + id: syg_daniel_genaktiver_alarmer + trigger: + - platform: state + entity_id: input_select.daniel_status + not_to: "Syg" + condition: + - condition: state + entity_id: binary_sensor.arbejdsdagimorgen + state: "on" + action: + - service: homeassistant.turn_on + target: + entity_id: + - switch.sonos_alarm_377 + - switch.sonos_alarm_1894 + - switch.sonos_alarm_2273 + - switch.sonos_alarm_3471 + +# ---- Anne / Claus (soveværelse) ---- + +- alias: "Syg - Soveværelse - sluk alarmer" + id: syg_sovevaerelse_sluk_alarmer + trigger: + - platform: state + entity_id: input_select.anne_status + to: "Syg" + - platform: state + entity_id: input_select.claus_status + to: "Syg" + action: + - service: homeassistant.turn_off + target: + entity_id: + - switch.sonos_alarm_1782 # Soft wakeup + - switch.sonos_alarm_298 # Badeværelse + - switch.sonos_alarm_1899 # Badeværelse afsted + +- alias: "Syg - Soveværelse - genaktiver alarmer" + id: syg_sovevaerelse_genaktiver_alarmer + trigger: + - platform: state + entity_id: input_select.anne_status + not_to: "Syg" + - platform: state + entity_id: input_select.claus_status + not_to: "Syg" + condition: + # Kun genaktiver hvis BEGGE ikke er syge + - condition: template + value_template: > + {{ not is_state('input_select.anne_status', 'Syg') and + not is_state('input_select.claus_status', 'Syg') }} + - condition: state + entity_id: binary_sensor.arbejdsdagimorgen + state: "on" + action: + - service: homeassistant.turn_on + target: + entity_id: + - switch.sonos_alarm_1782 + - switch.sonos_alarm_298 + - switch.sonos_alarm_1899