From 3ee3e9ab983b783f9e995615b899d0f8b5238011 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Wed, 21 Aug 2024 01:22:37 +0200 Subject: [PATCH] Little cleanup with vars --- home-assistant.yml | 10 ++++++++-- roles/automations/tasks/shopping.yml | 28 --------------------------- roles/automations/tasks/templates.yml | 18 ++--------------- vars/lights-automations.yml | 13 +++++++++++++ vars/shopping-list.yml | 27 ++++++++++++++++++++++++++ vars/zha-devices.yml | 2 +- vars/zwave-devices.yml | 2 +- 7 files changed, 52 insertions(+), 48 deletions(-) create mode 100644 vars/lights-automations.yml create mode 100644 vars/shopping-list.yml diff --git a/home-assistant.yml b/home-assistant.yml index 260cf8b..ed44ab3 100644 --- a/home-assistant.yml +++ b/home-assistant.yml @@ -14,12 +14,10 @@ - name: Include ZHA vars include_vars: file: vars/zha-devices.yml - name: zha - name: Include Z-wave vars include_vars: file: vars/zwave-devices.yml - name: zwave - name: Include battery vars include_vars: @@ -29,6 +27,14 @@ include_vars: file: vars/availability.yml + - name: Include shopping list + include_vars: + file: vars/shopping-list.yml + + - name: Include light list for automations + include_vars: + file: vars/lights-automations.yml + roles: - automations - scripts diff --git a/roles/automations/tasks/shopping.yml b/roles/automations/tasks/shopping.yml index 38653ef..0ab9dc1 100644 --- a/roles/automations/tasks/shopping.yml +++ b/roles/automations/tasks/shopping.yml @@ -3,31 +3,3 @@ template: src: shopping-mobile-actions.yaml.j2 dest: './build/automations/shopping-mobile-actions.yaml' - vars: - shopping_list: - - action: SHOPPING_COFFEE - title: Kawa - - action: SHOPPING_COFFEE_WATER_FILTER - title: Filtr do wody ekspresu - - action: SHOPPING_COFFEE_DESCALER - title: Odkamieniacz do ekspresu - - action: SHOPPING_COFFEE_CLEANING_TABLETS - title: Tabletki czyszczące do ekspresu - - action: SHOPPING_COFFEE_MILK_CLEANER - title: Środek do czyszczenia mleka ekspresu - - action: SHOPPING_BASIL - title: Bazylia - - action: SHOPPING_OREGANO - title: Oregano - - action: SHOPPING_THYMELEAF - title: Tymianek - - action: SHOPPING_WHITE_PEPPER - title: Pieprz biały - - action: SHOPPING_BLACK_PEPPER - title: Pieprz czarny - - action: SHOPPING_SWEET_PEPPER - title: Sweet pepper - - action: SHOPPING_GARLIC - title: Czosnek - - action: SHOPPING_SALT - title: Sól diff --git a/roles/automations/tasks/templates.yml b/roles/automations/tasks/templates.yml index dfc93eb..6283d09 100644 --- a/roles/automations/tasks/templates.yml +++ b/roles/automations/tasks/templates.yml @@ -3,20 +3,6 @@ template: src: lights.yaml.j2 dest: './build/automations/lights.yaml' - vars: - lights: - - entityId: light.bathroom_lights - name: Bathroom Lights - - entityId: light.kitchen_lights - name: Kitchen Lights - - entityId: light.shower_lights - name: Shower Lights - - entityId: light.couch_lights - name: Couch Lights - - entityId: light.desk_lightbar - name: Desk Lightbar - - entityId: light.office - name: Table lamp - name: Build music button automations delegate_to: localhost @@ -35,7 +21,7 @@ src: unavailable-zha.yaml.j2 dest: './build/automations/unavailable-zha.yaml' vars: - devices: "{{ zha.devices }}" + devices: "{{ zha_devices }}" - name: Build unavailable automations Z-Wave delegate_to: localhost @@ -43,7 +29,7 @@ src: unavailable-zwave.yaml.j2 dest: './build/automations/unavailable-zwave.yaml' vars: - devices: "{{ zwave.devices }}" + devices: "{{ zwave_devices }}" - name: Build battery info automations delegate_to: localhost diff --git a/vars/lights-automations.yml b/vars/lights-automations.yml new file mode 100644 index 0000000..33b31d9 --- /dev/null +++ b/vars/lights-automations.yml @@ -0,0 +1,13 @@ + lights: + - entityId: light.bathroom_lights + name: Bathroom Lights + - entityId: light.kitchen_lights + name: Kitchen Lights + - entityId: light.shower_lights + name: Shower Lights + - entityId: light.couch_lights + name: Couch Lights + - entityId: light.desk_lightbar + name: Desk Lightbar + - entityId: light.office + name: Table lamp diff --git a/vars/shopping-list.yml b/vars/shopping-list.yml new file mode 100644 index 0000000..259a093 --- /dev/null +++ b/vars/shopping-list.yml @@ -0,0 +1,27 @@ +shopping_list: + - action: SHOPPING_COFFEE + title: Kawa + - action: SHOPPING_COFFEE_WATER_FILTER + title: Filtr do wody ekspresu + - action: SHOPPING_COFFEE_DESCALER + title: Odkamieniacz do ekspresu + - action: SHOPPING_COFFEE_CLEANING_TABLETS + title: Tabletki czyszczące do ekspresu + - action: SHOPPING_COFFEE_MILK_CLEANER + title: Środek do czyszczenia mleka ekspresu + - action: SHOPPING_BASIL + title: Bazylia + - action: SHOPPING_OREGANO + title: Oregano + - action: SHOPPING_THYMELEAF + title: Tymianek + - action: SHOPPING_WHITE_PEPPER + title: Pieprz biały + - action: SHOPPING_BLACK_PEPPER + title: Pieprz czarny + - action: SHOPPING_SWEET_PEPPER + title: Sweet pepper + - action: SHOPPING_GARLIC + title: Czosnek + - action: SHOPPING_SALT + title: Sól diff --git a/vars/zha-devices.yml b/vars/zha-devices.yml index d3eea00..51cf001 100644 --- a/vars/zha-devices.yml +++ b/vars/zha-devices.yml @@ -1,4 +1,4 @@ -devices: +zha_devices: - name: 'Bedroom button' id: '15b083b6b5e2acb5d37fbbfbfc76281f' - name: 'Bedroom motion' diff --git a/vars/zwave-devices.yml b/vars/zwave-devices.yml index 7a14c49..2d72192 100644 --- a/vars/zwave-devices.yml +++ b/vars/zwave-devices.yml @@ -1,4 +1,4 @@ -devices: +zwave_devices: - name: '3D Printer' entity_id: 'sensor.3d_printer_node_status' - name: 'Kitchen tabletop motion'