From 5b558c147859aadbc96db6f85aa06f27afb3d58b Mon Sep 17 00:00:00 2001 From: Julian Tabel Date: Sat, 20 Jun 2026 18:49:03 +0200 Subject: [PATCH] Initial Commit --- .gitignore | 49 +- automations.yaml | 519 ++++++++++++++++++ .../homeassistant/motion_light.yaml | 56 ++ .../homeassistant/notify_leaving_zone.yaml | 50 ++ .../jcwillox/automatic_backups.yaml | 200 +++++++ .../jcwillox/notify_auto_backup.yaml | 143 +++++ .../confirmable_notification.yaml | 86 +++ .../sleep-as-android-trigger-app-actions.yaml | 129 +++++ .../homeassistant/inverted_binary_sensor.yaml | 27 + configuration.yaml | 36 ++ packages/ecovacs.yaml | 56 ++ scenes.yaml | 1 + scripts.yaml | 56 ++ 13 files changed, 1405 insertions(+), 3 deletions(-) create mode 100644 automations.yaml create mode 100644 blueprints/automation/homeassistant/motion_light.yaml create mode 100644 blueprints/automation/homeassistant/notify_leaving_zone.yaml create mode 100644 blueprints/automation/jcwillox/automatic_backups.yaml create mode 100644 blueprints/automation/jcwillox/notify_auto_backup.yaml create mode 100644 blueprints/script/homeassistant/confirmable_notification.yaml create mode 100644 blueprints/script/tr4nt0r/sleep-as-android-trigger-app-actions.yaml create mode 100644 blueprints/template/homeassistant/inverted_binary_sensor.yaml create mode 100644 configuration.yaml create mode 100644 packages/ecovacs.yaml create mode 100644 scenes.yaml create mode 100644 scripts.yaml diff --git a/.gitignore b/.gitignore index a87ac1a..ecc93dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,48 @@ -.storage +# Secrets & credentials — never commit +secrets.yaml +.storage/ +.cloud/ +.deploy_key +*.key +*.pem + +# Runtime state & databases +.HA_VERSION +.ha_run.lock +.uuid +.shopping_list.json +home-assistant_v2.db* +zigbee.db* *.db +*.db-shm +*.db-wal +*.db-journal + +# Logs +home-assistant.log* *.log -.cloud -deps +*.log.* + +# Caches & generated content +.cache/ +deps/ +tts/ +image/ +__pycache__/ +*.pyc + +# Backups & editor cruft +backups/ +*.bak +*.bak[0-9] +*.swp +*~ +.DS_Store + +# Local SSH/known_hosts inside /config +.ssh/ +known_hosts* + +# Custom content +custom_components +themes diff --git a/automations.yaml b/automations.yaml new file mode 100644 index 0000000..45e05d0 --- /dev/null +++ b/automations.yaml @@ -0,0 +1,519 @@ +- id: '1725613486677' + alias: Notify - Auto Backup + description: '' + use_blueprint: + path: jcwillox/notify_auto_backup.yaml + input: + devices: + - 00a3c80aa7d8dc3f89e6764f82d92f7e + notify_hass: true + only_after: 09:00:00 + only_before: '21:00:00' +- id: '1725613591824' + alias: Automatic Backups + description: '' + use_blueprint: + path: jcwillox/automatic_backups.yaml + input: + backup_action: + - data: + name: '{{ name }}' + password: '{{ password }}' + keep_days: '{{ keep_days }}' + include_folders: + - config + action: auto_backup.backup +- id: '1729087449006' + alias: Staubsauger Zimmer resetieren + description: '' + triggers: + - trigger: event + event_type: deepbot_cleaning_job + event_data: + status: finished + - trigger: state + entity_id: + - vacuum.obi_wan_cleanobi + from: + to: docked + enabled: true + for: + hours: 0 + minutes: 10 + seconds: 0 + conditions: [] + actions: + - alias: Reset room queue + data: + value: '' + action: input_text.set_value + target: + entity_id: input_text.deebot_obi_wan_cleanobi_queue + mode: single +- id: '1735981366208' + alias: Leaving Home + description: '' + triggers: + - trigger: zone + entity_id: person.julian + zone: zone.home + event: leave + conditions: [] + actions: + - action: light.turn_off + metadata: {} + data: {} + target: + floor_id: + - unten + - oben + mode: single +- id: '1735981499982' + alias: Coming Home + description: '' + triggers: + - trigger: zone + entity_id: person.julian + zone: zone.home + event: enter + conditions: + - condition: sun + after: sunset + before: sunrise + actions: + - action: light.turn_on + metadata: {} + data: + kelvin: 2000 + brightness_pct: 50 + target: + entity_id: light.wohnzimmer + - action: light.turn_on + metadata: {} + data: + effect: Ember + target: + entity_id: light.elements + mode: single +- id: '1750514682779' + alias: Auto Control Mobile AC + description: Turns mobile AC on/off based on temperature and automation toggle + triggers: + - entity_id: sensor.thermometer_buro_temperature_2 + above: 27 + trigger: numeric_state + - entity_id: + - sensor.thermometer_buro_temperature_2 + below: 24 + trigger: numeric_state + - entity_id: input_boolean.ac_automation_enabled + to: 'on' + trigger: state + conditions: + - condition: state + entity_id: input_boolean.ac_automation_enabled + state: 'on' + - condition: time + after: 08:00:00 + before: '22:00:00' + actions: + - choose: + - conditions: + - condition: numeric_state + entity_id: sensor.thermometer_buro_temperature_2 + above: 27 + sequence: + - target: + entity_id: climate.echos_mobile_klimaanlage_mit_wifi + data: + hvac_mode: cool + action: climate.set_hvac_mode + - target: + entity_id: input_boolean.ac_auto_active + action: input_boolean.turn_on + data: {} + - conditions: + - condition: numeric_state + entity_id: sensor.thermometer_buro_temperature_2 + below: 24 + sequence: + - target: + entity_id: climate.echos_mobile_klimaanlage_mit_wifi + action: climate.turn_off + data: {} + - target: + entity_id: input_boolean.ac_auto_active + action: input_boolean.turn_off + data: {} + mode: single +- id: '1750523603546' + alias: Turn off AC when automation toggle is turned off + triggers: + - entity_id: input_boolean.ac_automation_enabled + to: 'off' + trigger: state + conditions: + - condition: state + entity_id: input_boolean.ac_auto_active + state: 'on' + actions: + - target: + entity_id: climate.echos_mobile_klimaanlage_mit_wifi + action: climate.turn_off + - target: + entity_id: input_boolean.ac_auto_active + action: input_boolean.turn_off + mode: single +- id: '1758382495219' + alias: Sleep Tracking Started (Home) + description: '' + triggers: + - trigger: state + entity_id: + - event.sleep_as_android_sleep_tracking_2 + to: + - started + attribute: event_type + conditions: + - condition: zone + entity_id: person.julian + zone: zone.home + actions: + - sequence: + - parallel: + - action: light.turn_on + metadata: {} + data: + transition: 2 + rgb_color: + - 255 + - 0 + - 0 + brightness_pct: 15 + target: + area_id: bedroom + - sequence: + - condition: device + device_id: 06b6270f81ce9719648d0adafb0cbef2 + domain: fan + entity_id: 791bc56427ab036a07f6444c75317ec8 + type: is_on + - action: fan.set_percentage + metadata: {} + data: + percentage: 16 + target: + area_id: bedroom + - action: light.turn_off + metadata: {} + data: {} + target: + floor_id: unten + - action: music_assistant.play_media + metadata: {} + data: + media_id: + - library://audiobook/12 + enqueue: replace + target: + device_id: c4caa54d97fd88139e3edf468fd714ce + continue_on_error: true + enabled: false + - if: + - condition: device + device_id: 06b6270f81ce9719648d0adafb0cbef2 + domain: fan + entity_id: 791bc56427ab036a07f6444c75317ec8 + type: is_on + then: + - action: media_player.volume_set + metadata: {} + data: + volume_level: 0.1 + target: + device_id: 1f884a0c64e02639fffc10c2747a01f4 + else: + - action: media_player.volume_set + metadata: {} + data: + volume_level: 0.05 + target: + device_id: 1f884a0c64e02639fffc10c2747a01f4 + enabled: true + - action: fan.turn_off + metadata: {} + data: {} + target: + area_id: living_room + - sequence: + - action: light.turn_off + metadata: {} + data: + transition: 5 + target: + area_id: bedroom + mode: single +- id: '1758383070507' + alias: Start Sleep Tracking + description: '' + triggers: + - type: plugged_in + device_id: cea4fed628acb78af28bb9c48a265d11 + entity_id: 50f84770e5b8cd8e3eb916baef1f0a1a + domain: binary_sensor + trigger: device + for: + hours: 0 + minutes: 0 + seconds: 1 + conditions: + - condition: time + after: '22:00:00' + before: 03:00:00 + weekday: + - sun + - mon + - tue + - wed + - thu + - fri + - sat + - condition: state + entity_id: event.sleep_as_android_sleep_tracking_2 + attribute: event_type + state: + - stopped + actions: + - action: script.start_sleep_tracking + metadata: {} + data: {} + mode: single +- id: '1758383701998' + alias: Sleep Tracking Stopped + description: '' + triggers: + - trigger: state + entity_id: + - event.sleep_as_android_sleep_tracking_2 + attribute: event_type + to: + - stopped + conditions: + - condition: zone + entity_id: person.julian + zone: zone.home + actions: + - action: light.turn_on + metadata: {} + data: + transition: 5 + color_temp_kelvin: 2947 + brightness_pct: 25 + target: + area_id: bedroom + - sequence: + - action: media_player.shuffle_set + metadata: {} + data: + shuffle: true + target: + entity_id: media_player.speaker_bad_2 + - action: music_assistant.play_media + metadata: {} + data: + enqueue: replace + media_id: + - library://artist/1 + target: + entity_id: media_player.speaker_bad_2 + - delay: + hours: 0 + minutes: 45 + seconds: 0 + milliseconds: 0 + - action: media_player.media_stop + metadata: {} + data: {} + target: + entity_id: media_player.speaker_bad_2 + mode: single +- id: '1758737029692' + alias: Schreibtisch scan Licht + description: '' + triggers: + - trigger: tag + tag_id: 47412051-1947-4ef6-88b1-02aca77602d6 + conditions: [] + actions: + - action: light.toggle + metadata: {} + data: {} + target: + area_id: office + - if: + - condition: media_player.is_playing + target: + entity_id: media_player.speaker_bad_2 + options: + behavior: any + then: + - action: music_assistant.transfer_queue + metadata: {} + data: + source_player: media_player.speaker_bad_2 + target: + device_id: 2e1fcb091fc8eb4513c232d00ed7a97e + mode: single +- id: '1758892251874' + alias: Speedtest + description: '' + triggers: + - trigger: time + at: 03:00:00 + conditions: [] + actions: + - action: homeassistant.update_entity + data: + entity_id: + - sensor.speedtest_download + - sensor.speedtest_upload + - sensor.speedtest_ping + mode: single +- id: '1759432890095' + alias: Fell Asleep + description: '' + triggers: + - trigger: state + entity_id: + - event.sleep_as_android_sleep_phase_2 + attribute: event_type + to: + - not_awake + - light_sleep + - deep_sleep + - rem + for: + hours: 0 + minutes: 5 + seconds: 0 + enabled: false + - trigger: numeric_state + entity_id: + - sensor.pixel_10_sleep_confidence + for: + hours: 0 + minutes: 15 + seconds: 0 + above: 80 + conditions: + - condition: zone + entity_id: person.julian + zone: zone.home + actions: + - delay: + hours: 0 + minutes: 10 + seconds: 0 + milliseconds: 0 + - action: media_player.media_stop + metadata: {} + data: {} + target: + area_id: bedroom + continue_on_error: true + - delay: + hours: 0 + minutes: 1 + seconds: 0 + milliseconds: 0 + - action: fan.turn_off + metadata: {} + data: {} + target: + area_id: bedroom + mode: single +- id: '1779900420322' + alias: Turn on PC + description: '' + triggers: + - device_id: 8e2942f6079c1ff8086c3d8cb427db0c + domain: zha + type: remote_button_short_press + subtype: button + trigger: device + conditions: [] + actions: + - action: button.press + metadata: {} + target: + entity_id: button.archstation + data: {} + mode: single +- id: '1779900796574' + alias: Schreibtischlampe + description: '' + triggers: + - device_id: 8e2942f6079c1ff8086c3d8cb427db0c + domain: zha + type: remote_button_double_press + subtype: button + trigger: device + conditions: [] + actions: + - action: light.toggle + metadata: {} + target: + entity_id: light.schreibtischlampe_light + data: {} + mode: single +- id: '1779914848758' + alias: Nanoleaf + description: '' + triggers: + - device_id: c2c7c5e9ab3212af67a4733d02ca1437 + domain: zha + type: remote_button_short_press + subtype: button + trigger: device + conditions: [] + actions: + - action: light.toggle + metadata: {} + target: + entity_id: light.elements + data: {} + mode: single +- id: '1779914956222' + alias: Hue + description: '' + triggers: + - device_id: c2c7c5e9ab3212af67a4733d02ca1437 + domain: zha + type: remote_button_double_press + subtype: button + trigger: device + conditions: [] + actions: + - action: light.toggle + metadata: {} + target: + entity_id: light.wohnzimmer + data: {} + mode: single +- id: '1779915188913' + alias: 'Ventilator ' + description: '' + triggers: + - device_id: c2c7c5e9ab3212af67a4733d02ca1437 + domain: zha + type: remote_button_long_press + subtype: button + trigger: device + conditions: [] + actions: + - action: fan.toggle + metadata: {} + target: + entity_id: fan.ventilator_unten + data: {} + mode: single diff --git a/blueprints/automation/homeassistant/motion_light.yaml b/blueprints/automation/homeassistant/motion_light.yaml new file mode 100644 index 0000000..8f5d3f9 --- /dev/null +++ b/blueprints/automation/homeassistant/motion_light.yaml @@ -0,0 +1,56 @@ +blueprint: + name: Motion-activated Light + description: Turn on a light when motion is detected. + domain: automation + source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml + author: Home Assistant + input: + motion_entity: + name: Motion Sensor + selector: + entity: + filter: + device_class: motion + domain: binary_sensor + light_target: + name: Light + selector: + target: + entity: + domain: light + no_motion_wait: + name: Wait time + description: Time to leave the light on after last motion is detected. + default: 120 + selector: + number: + min: 0 + max: 3600 + unit_of_measurement: seconds + +# If motion is detected within the delay, +# we restart the script. +mode: restart +max_exceeded: silent + +trigger: + platform: state + entity_id: !input motion_entity + from: "off" + to: "on" + +action: + - alias: "Turn on the light" + service: light.turn_on + target: !input light_target + - alias: "Wait until there is no motion from device" + wait_for_trigger: + platform: state + entity_id: !input motion_entity + from: "on" + to: "off" + - alias: "Wait the number of seconds that has been set" + delay: !input no_motion_wait + - alias: "Turn off the light" + service: light.turn_off + target: !input light_target diff --git a/blueprints/automation/homeassistant/notify_leaving_zone.yaml b/blueprints/automation/homeassistant/notify_leaving_zone.yaml new file mode 100644 index 0000000..e1e3bd5 --- /dev/null +++ b/blueprints/automation/homeassistant/notify_leaving_zone.yaml @@ -0,0 +1,50 @@ +blueprint: + name: Zone Notification + description: Send a notification to a device when a person leaves a specific zone. + domain: automation + source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/notify_leaving_zone.yaml + author: Home Assistant + input: + person_entity: + name: Person + selector: + entity: + filter: + domain: person + zone_entity: + name: Zone + selector: + entity: + filter: + domain: zone + notify_device: + name: Device to notify + description: Device needs to run the official Home Assistant app to receive notifications. + selector: + device: + filter: + integration: mobile_app + +trigger: + platform: state + entity_id: !input person_entity + +variables: + zone_entity: !input zone_entity + # This is the state of the person when it's in this zone. + zone_state: "{{ states[zone_entity].name }}" + person_entity: !input person_entity + person_name: "{{ states[person_entity].name }}" + +condition: + condition: template + # The first case handles leaving the Home zone which has a special state when zoning called 'home'. + # The second case handles leaving all other zones. + value_template: "{{ zone_entity == 'zone.home' and trigger.from_state.state == 'home' and trigger.to_state.state != 'home' or trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}" + +action: + - alias: "Notify that a person has left the zone" + domain: mobile_app + type: notify + device_id: !input notify_device + message: "{{ person_name }} has left {{ zone_state }}" diff --git a/blueprints/automation/jcwillox/automatic_backups.yaml b/blueprints/automation/jcwillox/automatic_backups.yaml new file mode 100644 index 0000000..a687f8b --- /dev/null +++ b/blueprints/automation/jcwillox/automatic_backups.yaml @@ -0,0 +1,200 @@ +blueprint: + name: Automatic Backups + description: 'Create backups each day and keep them for a configurable amount of + time, backups are stored less frequently the older they are. + + + By default all backups are full backups, besides the 3-hourly backups which only + include the configuration. + + + **Template Variables:** + + - `name` — backup name configured below + + - `password` — backup password configured below + + - `keep_days` — days the backup is kept for based on the current backup type + + - `backup_type` — current schedule being created, e.g., `daily`, `weekly`, `monthly` + + + **Note: requires the [Auto Backup](https://jcwillox.github.io/hass-auto-backup) + custom integration.** + + ' + domain: automation + input: + backup_name: + name: Name template used for backups + default: "{{ backup_type | title }}Backup: {{\n now().strftime(\n \"%A, + \"\n ~ iif(backup_type == \"hourly\", \"%-I:%M %p, \", \"\")\n ~ \"%B + %-d, %Y\"\n )\n}}\n{# HourlyBackup: Monday, 3:04 PM, January 2, 2006 #}\n{# + DailyBackup: Monday, January 2, 2006 #}\n" + selector: + template: {} + backup_time: + name: Time of day to create backups + default: 02:30:00 + selector: + time: {} + backup_password: + name: Backup Password (Optional) + default: '' + selector: + text: + type: password + multiple: false + multiline: false + enable_hourly: + name: 'Enable: Hourly Backups' + description: Create a backup every 3 hours and store for 2 days + default: false + selector: + boolean: {} + enable_daily: + name: 'Enable: Daily Backups' + description: Create a backup each day and store for a week + default: true + selector: + boolean: {} + enable_weekly: + name: 'Enable: Weekly Backups' + description: Create a backup each week and store for a month + default: true + selector: + boolean: {} + enable_monthly: + name: 'Enable: Monthly Backups' + description: Create a backup each month and store for a year + default: true + selector: + boolean: {} + enable_yearly: + name: 'Enable: Yearly Backups' + description: Create a backup each year and store forever + default: true + selector: + boolean: {} + use_action_hourly: + name: Use Backup Action for Hourly Backups Only + description: Otherwise, it will be used for all backup types + default: true + selector: + boolean: {} + backup_action: + name: Backup Action (Optional) + description: 'Optionally override the built-in backup action with a custom action, + designed to allow greater control over what is included in each backup. + + + By default this only overrides the 3-hourly backups, so that they only include + the configuration. + + ' + default: + - service: auto_backup.backup + data: + name: '{{ name }}' + password: '{{ password }}' + keep_days: '{{ keep_days }}' + include_folders: + - config + selector: + action: {} + condition: + name: Condition (Optional) + description: Condition to test before any action + default: [] + selector: + action: {} + source_url: https://raw.githubusercontent.com/jcwillox/home-assistant-blueprints/main/automation/automatic_backups.yaml +mode: single +variables: + password: !input backup_password + enable_hourly: !input enable_hourly + enable_daily: !input enable_daily + enable_weekly: !input enable_weekly + enable_monthly: !input enable_monthly + enable_yearly: !input enable_yearly + use_action_hourly: !input use_action_hourly +trigger: +- id: daily + platform: time + at: !input backup_time +- id: hourly + enabled: !input enable_hourly + platform: time_pattern + hours: /3 +condition: !input condition +action: +- if: + condition: trigger + id: daily + then: + - choose: + - conditions: + - '{{ enable_yearly }}' + - '{{ now().day == 1 and now().month == 1 }}' + sequence: + - variables: + backup_type: yearly + keep_days: + - &id001 + variables: + name: !input backup_name + backup_action: !input backup_action + - &id002 + if: + - '{{ not use_action_hourly }}' + - '{{ backup_action | length > 0 }}' + then: !input backup_action + else: + - alias: Creating a full backup (default action) + service: auto_backup.backup + data: + name: '{{ name }}' + password: '{{ password }}' + keep_days: '{{ keep_days }}' + - conditions: + - '{{ enable_monthly }}' + - '{{ now().day == 1 }}' + sequence: + - variables: + backup_type: monthly + keep_days: 365 + - *id001 + - *id002 + - conditions: + - '{{ enable_weekly }}' + - '{{ now().weekday() == 0 }}' + sequence: + - variables: + backup_type: weekly + keep_days: 30.4167 + - *id001 + - *id002 + - conditions: + - '{{ enable_daily }}' + sequence: + - variables: + backup_type: daily + keep_days: 7 + - *id001 + - *id002 + else: + - variables: + backup_type: hourly + keep_days: 2 + - *id001 + - if: '{{ backup_action | length > 0 }}' + then: !input backup_action + else: + - alias: Creating a partial backup (default action) + service: auto_backup.backup + data: + name: '{{ name }}' + password: '{{ password }}' + keep_days: '{{ keep_days }}' + include_folders: + - config diff --git a/blueprints/automation/jcwillox/notify_auto_backup.yaml b/blueprints/automation/jcwillox/notify_auto_backup.yaml new file mode 100644 index 0000000..e87bff4 --- /dev/null +++ b/blueprints/automation/jcwillox/notify_auto_backup.yaml @@ -0,0 +1,143 @@ +blueprint: + name: Notify - Auto Backup + description: 'Send notifications based on events created by the [Auto Backup](https://jcwillox.github.io/hass-auto-backup) + integration, such as when a backup fails. + + + **Note: requires the [Auto Backup](https://jcwillox.github.io/hass-auto-backup) + custom integration.** + + ' + domain: automation + input: + events: + name: Events + description: Which events to send notifications + default: + - auto_backup.backup_failed + selector: + select: + multiple: true + mode: dropdown + options: + - label: Backup Start + value: auto_backup.backup_start + - label: Backup Successful + value: auto_backup.backup_successful + - label: Backup Failed + value: auto_backup.backup_failed + - label: Backup Purged + value: auto_backup.purged_backups + custom_value: false + sort: false + notify_hass: + name: Send to Home Assistant + description: Send to Home Assistant as a persistent notification + default: false + selector: + boolean: {} + devices: + name: Mobile Devices + description: Send notifications to mobile devices + default: [] + selector: + device: + integration: mobile_app + multiple: true + only_after: + name: Only after + description: Only send notifications to mobile devices after this time + default: 00:00:00 + selector: + time: {} + only_before: + name: Only before + description: Only send notifications to mobile devices before this time + default: 00:00:00 + selector: + time: {} + source_url: https://raw.githubusercontent.com/jcwillox/home-assistant-blueprints/main/automation/notify_auto_backup.yaml +mode: parallel +variables: + notify_hass: !input notify_hass +trigger: + platform: event + event_type: !input events +action: +- choose: + - conditions: '{{ trigger.event.event_type == "auto_backup.backup_start" }}' + sequence: + - variables: + notify_title: Backup Started + notify_message: '{{ trigger.event.data.name }}' + notify_data: + group: Auto Backup + url: /hassio/backups + clickAction: /hassio/backups + tag: auto-backup-{{ trigger.event.data.name }} + notification_icon: mdi:package-variant + - &id001 + if: '{{ True }}' + then: + - if: + condition: time + after: !input only_after + before: !input only_before + then: + - alias: Send notifications to mobile devices + repeat: + for_each: !input devices + sequence: + - alias: Notify mobile device + service: notify.mobile_app_{{ device_attr(repeat.item, "name") | slugify + }} + data: + title: '{{ notify_title }}' + message: '{{ notify_message }}' + data: '{{ notify_data }}' + - if: '{{ notify_hass }}' + then: + - alias: Send a notification to HA + service: persistent_notification.create + data: + title: '{{ notify_title }}' + message: '{{ notify_message }}' + - conditions: '{{ trigger.event.event_type == "auto_backup.backup_successful" }}' + sequence: + - variables: + notify_title: Backup Successful + notify_message: '{{ trigger.event.data.name }}' + notify_data: + group: Auto Backup + url: /hassio/backups + clickAction: /hassio/backups + tag: auto-backup-{{ trigger.event.data.name }} + notification_icon: mdi:package-variant-closed + - *id001 + - conditions: '{{ trigger.event.event_type == "auto_backup.backup_failed" }}' + sequence: + - variables: + notify_title: Backup Failed + notify_message: '{{ trigger.event.data.name }} + + {{ trigger.event.data.error }} + + ' + notify_data: + group: Auto Backup + url: /hassio/backups + clickAction: /hassio/backups + tag: auto-backup-{{ trigger.event.data.name }} + notification_icon: mdi:package-variant-closed-remove + - *id001 + - conditions: '{{ trigger.event.event_type == "auto_backup.purged_backups" }}' + sequence: + - variables: + notify_title: Backup(s) Purged + notify_message: '{{ trigger.event.data.backups | join('', '') }}' + notify_data: + group: Auto Backup + url: /hassio/backups + clickAction: /hassio/backups + notification_icon: mdi:package-variant-closed-minus + - *id001 diff --git a/blueprints/script/homeassistant/confirmable_notification.yaml b/blueprints/script/homeassistant/confirmable_notification.yaml new file mode 100644 index 0000000..c5f4249 --- /dev/null +++ b/blueprints/script/homeassistant/confirmable_notification.yaml @@ -0,0 +1,86 @@ +blueprint: + name: Confirmable Notification + description: >- + A script that sends an actionable notification with a confirmation before + running the specified action. + domain: script + source_url: https://github.com/home-assistant/core/blob/master/homeassistant/components/script/blueprints/confirmable_notification.yaml + author: Home Assistant + input: + notify_device: + name: Device to notify + description: Device needs to run the official Home Assistant app to receive notifications. + selector: + device: + filter: + integration: mobile_app + title: + name: "Title" + description: "The title of the button shown in the notification." + default: "" + selector: + text: + message: + name: "Message" + description: "The message body" + selector: + text: + confirm_text: + name: "Confirmation Text" + description: "Text to show on the confirmation button" + default: "Confirm" + selector: + text: + confirm_action: + name: "Confirmation Action" + description: "Action to run when notification is confirmed" + default: [] + selector: + action: + dismiss_text: + name: "Dismiss Text" + description: "Text to show on the dismiss button" + default: "Dismiss" + selector: + text: + dismiss_action: + name: "Dismiss Action" + description: "Action to run when notification is dismissed" + default: [] + selector: + action: + +mode: restart + +sequence: + - alias: "Set up variables" + variables: + action_confirm: "{{ 'CONFIRM_' ~ context.id }}" + action_dismiss: "{{ 'DISMISS_' ~ context.id }}" + - alias: "Send notification" + domain: mobile_app + type: notify + device_id: !input notify_device + title: !input title + message: !input message + data: + actions: + - action: "{{ action_confirm }}" + title: !input confirm_text + - action: "{{ action_dismiss }}" + title: !input dismiss_text + - alias: "Awaiting response" + wait_for_trigger: + - platform: event + event_type: mobile_app_notification_action + event_data: + action: "{{ action_confirm }}" + - platform: event + event_type: mobile_app_notification_action + event_data: + action: "{{ action_dismiss }}" + - choose: + - conditions: "{{ wait.trigger.event.data.action == action_confirm }}" + sequence: !input confirm_action + - conditions: "{{ wait.trigger.event.data.action == action_dismiss }}" + sequence: !input dismiss_action diff --git a/blueprints/script/tr4nt0r/sleep-as-android-trigger-app-actions.yaml b/blueprints/script/tr4nt0r/sleep-as-android-trigger-app-actions.yaml new file mode 100644 index 0000000..3364253 --- /dev/null +++ b/blueprints/script/tr4nt0r/sleep-as-android-trigger-app-actions.yaml @@ -0,0 +1,129 @@ +blueprint: + name: 'Sleep as Android: Trigger app actions' + description: 'Send commands to the Sleep as Android app on your selected mobile + device via Home Assistant. Requires the device to run the official Home Assistant + companion app. + + ' + domain: script + author: tr4nt0r + input: + notify_device: + name: Target device + description: 'The mobile device running Sleep as Android. Must have the official + Home Assistant companion app installed and connected. + + ' + selector: + device: + filter: + - integration: mobile_app + multiple: false + sleep_action: + name: Action + description: 'The specific Sleep as Android command to trigger + + ' + selector: + select: + options: + - label: Start sleep tracking + value: com.urbandroid.sleep.alarmclock.START_SLEEP_TRACK + - label: Start sleep tracking + Set an alarm for ideal sleep length + value: com.urbandroid.sleep.alarmclock.START_SLEEP_TRACK_WITH_IDEAL_ALARM_ACTION + - label: Stop sleep tracking + value: com.urbandroid.sleep.alarmclock.STOP_SLEEP_TRACK + - label: Pause sleep tracking for 5 minutes + value: com.urbandroid.sleep.ACTION_PAUSE_TRACKING + - label: Snooze alarm + value: com.urbandroid.sleep.alarmclock.ALARM_SNOOZE + - label: Dismiss alarm + value: com.urbandroid.sleep.alarmclock.ALARM_DISMISS_CAPTCHA + - label: Stop lullaby + value: com.urbandroid.sleep.ACTION_LULLABY_STOP_PLAYBACK + - label: Request backup + value: com.urbandroid.sleep.REQUEST_SYNC + - label: Change alarm state (when not currently ringing) + value: com.urbandroid.sleep.alarmclock.ALARM_STATE_CHANGE + multiple: false + sort: false + custom_value: false + section_extra_snooze_time: + name: Snooze alarm extras + icon: mdi:alarm-snooze + collapsed: true + input: + extra_snooze_time: + name: Extra snooze time (optional) + description: 'Override the snooze duration for this alarm (1–60 minutes). Leave + blank to use the default snooze time set in the Sleep as Android app. + + ' + selector: + number: + min: 1.0 + max: 60.0 + unit_of_measurement: minutes + mode: box + step: 1.0 + default: '' + section_alarm_state_change: + name: Change alarm state extras + icon: mdi:alarm + description: These settings are required when using the "Change alarm state" + action. + collapsed: true + input: + alarm_label: + name: Alarm label + description: 'The label of the alarm to modify. Must explicitly set **in + the Sleep as Android app** for this action to work. If multiple alarms + share this label, only one will be changed (no guarantee which). + + ' + selector: + text: {} + default: Alarm + alarm_state: + name: Enable or disable + description: 'Select whether the specified alarm should be turned on (enabled) + or turned off (disabled). + + ' + selector: + boolean: {} + default: false + section_start_in_battery_saving_mode: + name: Start sleep tracking extras + icon: mdi:record-rec + collapsed: true + input: + start_in_battery_saving_mode: + name: Start in battery saving mode + description: Start sleep tracking with reduced power usage to save battery. + selector: + boolean: {} + default: false + source_url: https://community.home-assistant.io/t/sleep-as-android-trigger-app-actions/920845 +mode: parallel +sequence: +- variables: + sleep_action: !input sleep_action + alarm_label: !input alarm_label + alarm_state: !input alarm_state + extra_snooze_time: !input extra_snooze_time + start_in_battery_saving_mode: !input start_in_battery_saving_mode +- alias: Send intent to Sleep as Android + domain: mobile_app + type: notify + device_id: !input notify_device + message: command_broadcast_intent + data: + intent_package_name: com.urbandroid.sleep + intent_action: !input sleep_action + intent_extras: "{% if sleep_action == 'com.urbandroid.sleep.alarmclock.ALARM_STATE_CHANGE' + and alarm_label %}\n alarm_label:{{ alarm_label }},alarm_enabled:{{ alarm_state + }}\n{% elif sleep_action == 'com.urbandroid.sleep.alarmclock.ALARM_SNOOZE' and + extra_snooze_time %}\n extra_snooze_time:{{ extra_snooze_time }}\n{% elif sleep_action + == 'com.urbandroid.sleep.alarmclock.START_SLEEP_TRACK' and start_in_battery_saving_mode + %}\n START_IN_BATTERY_SAVING_MODE:true\n{% endif %}" diff --git a/blueprints/template/homeassistant/inverted_binary_sensor.yaml b/blueprints/template/homeassistant/inverted_binary_sensor.yaml new file mode 100644 index 0000000..5be1840 --- /dev/null +++ b/blueprints/template/homeassistant/inverted_binary_sensor.yaml @@ -0,0 +1,27 @@ +blueprint: + name: Invert a binary sensor + description: Creates a binary_sensor which holds the inverted value of a reference binary_sensor + domain: template + source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/template/blueprints/inverted_binary_sensor.yaml + input: + reference_entity: + name: Binary sensor to be inverted + description: The binary_sensor which needs to have its value inverted + selector: + entity: + domain: binary_sensor +variables: + reference_entity: !input reference_entity +binary_sensor: + state: > + {% if states(reference_entity) == 'on' %} + off + {% elif states(reference_entity) == 'off' %} + on + {% else %} + {{ states(reference_entity) }} + {% endif %} + # delay_on: not_used in this example + # delay_off: not_used in this example + # auto_off: not_used in this example + availability: "{{ states(reference_entity) not in ('unknown', 'unavailable') }}" diff --git a/configuration.yaml b/configuration.yaml new file mode 100644 index 0000000..35f3834 --- /dev/null +++ b/configuration.yaml @@ -0,0 +1,36 @@ + +# Loads default set of integrations. Do not remove. +default_config: + +# Load frontend themes from the themes folder +frontend: + themes: !include_dir_merge_named themes + +automation: !include automations.yaml +script: !include scripts.yaml +scene: !include scenes.yaml + +route53: + aws_access_key_id: !secret aws_access_key_id + aws_secret_access_key: !secret aws_secret_access_key + zone: ZXCN4WCJ80R1B + domain: nerdboden.de + records: + - home + +http: + use_x_forwarded_for: true + trusted_proxies: 192.168.3.80 + +homeassistant: + packages: !include_dir_named packages + +prometheus: + namespace: hass + filter: + include_domains: + - light + - fan + - event + - media_player + - sensor \ No newline at end of file diff --git a/packages/ecovacs.yaml b/packages/ecovacs.yaml new file mode 100644 index 0000000..ceced64 --- /dev/null +++ b/packages/ecovacs.yaml @@ -0,0 +1,56 @@ +recorder: + exclude: + entities: + - input_text.deebot_obi_wan_cleanobi_queue + - script.deebot_room_queue + entity_globs: + - sensor.deebot_*_queue_* + +input_text: + deebot_obi_wan_cleanobi_queue: + name: Obi-Wan Cleanobi Raum Reihenfolge + max: 255 # Current max limit. See https://www.home-assistant.io/integrations/input_text/#max +# Room name comes from the integration to match attribute names + +template: + unique_id: deebot_obi_wan_cleanobi_queue + trigger: + - platform: state + entity_id: input_text.deebot_obi_wan_cleanobi_queue + sensor: + # Add for each room the following. Change room_name accordingly + - unique_id: deebot_obi_wan_cleanobi_queue_wohnzimmer1 + name: deebot_obi_wan_cleanobi_queue_wohnzimmer1 + # room_name must match the room name provided by the vacuum + state: > + {% set room_name = "wohnzimmer1" %} + {% set queue = trigger.to_state.state.split(",") %} + {{ queue.index(room_name)+1 if room_name in queue else 0 }} + - unique_id: deebot_obi_wan_cleanobi_queue_kuche1 + name: deebot_obi_wan_cleanobi_queue_kuche1 + # room_name must match the room name provided by the vacuum + state: > + {% set room_name = "kuche1" %} + {% set queue = trigger.to_state.state.split(",") %} + {{ queue.index(room_name)+1 if room_name in queue else 0 }} + - unique_id: deebot_obi_wan_cleanobi_queue_buro1 + name: deebot_obi_wan_cleanobi_queue_buro1 + # room_name must match the room name provided by the vacuum + state: > + {% set room_name = "buro1" %} + {% set queue = trigger.to_state.state.split(",") %} + {{ queue.index(room_name)+1 if room_name in queue else 0 }} + - unique_id: deebot_obi_wan_cleanobi_queue_badezimmer1 + name: deebot_obi_wan_cleanobi_queue_badezimmer1 + # room_name must match the room name provided by the vacuum + state: > + {% set room_name = "badezimmer1" %} + {% set queue = trigger.to_state.state.split(",") %} + {{ queue.index(room_name)+1 if room_name in queue else 0 }} + - unique_id: deebot_obi_wan_cleanobi_queue_flur1 + name: deebot_obi_wan_cleanobi_queue_flur1 + # room_name must match the room name provided by the vacuum + state: > + {% set room_name = "flur1" %} + {% set queue = trigger.to_state.state.split(",") %} + {{ queue.index(room_name)+1 if room_name in queue else 0 }} \ No newline at end of file diff --git a/scenes.yaml b/scenes.yaml new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/scenes.yaml @@ -0,0 +1 @@ +[] diff --git a/scripts.yaml b/scripts.yaml new file mode 100644 index 0000000..ff261c0 --- /dev/null +++ b/scripts.yaml @@ -0,0 +1,56 @@ +deepbot_clean: + alias: deepbot_clean + sequence: + - alias: Get room numbers + variables: + rooms: "{%- set queue_split = states(queue).split(\",\") -%} {%- set rooms = + state_attr(vacuum_bot, \"rooms\")-%} {%- set data = namespace(rooms=[]) -%} + {%- for room_name in queue_split -%}\n {%- set data.rooms = data.rooms + + [rooms[room_name]] -%}\n{%- endfor -%} {{ data.rooms | join(\",\") }}" + - alias: Send cleaning job to vacuum + data: + entity_id: '{{ vacuum_bot }}' + command: spot_area + params: + rooms: '{{ rooms }}' + cleanings: 1 + action: vacuum.send_command + description: Start a deebot cleaning task + variables: + queue: input_text.deebot_obi_wan_cleanobi_queue + vacuum_bot: vacuum.obi_wan_cleanobi +deepbot_room_queue: + alias: deepbot_room_queue + sequence: + - target: + entity_id: '{{ queue }}' + data: + value: "{%- set queue_state = states(queue) -%} {%- set queue_split = queue_state.split(\",\") + -%} {%- if queue_state | length == 0 -%}\n {{ room }}\n{%- elif room in queue_split + -%}\n {{ queue_split | reject(\"eq\", room) | list | join(\",\")}}\n{%- else + -%}\n {{ (queue_split + [room]) | join(\",\") }}\n{%- endif -%}" + action: input_text.set_value + description: Add/Remove a room from the queue + fields: + queue: + description: The queue variable + example: input_text.deebot_obi_wan_cleanobi_queue + room: + description: Room, which should be removed or added + example: kitchen +start_sleep_tracking: + alias: Start Sleep Tracking + use_blueprint: + path: tr4nt0r/sleep-as-android-trigger-app-actions.yaml + input: + notify_device: cea4fed628acb78af28bb9c48a265d11 + sleep_action: com.urbandroid.sleep.alarmclock.START_SLEEP_TRACK + description: '' +stop_sleep_tracking: + alias: Stop Sleep Tracking + use_blueprint: + path: tr4nt0r/sleep-as-android-trigger-app-actions.yaml + input: + notify_device: 00a3c80aa7d8dc3f89e6764f82d92f7e + sleep_action: com.urbandroid.sleep.alarmclock.STOP_SLEEP_TRACK + description: ''