diff --git a/configuration/automations/shopping.yaml b/configuration/automations/shopping.yaml new file mode 100644 index 0000000..47629a8 --- /dev/null +++ b/configuration/automations/shopping.yaml @@ -0,0 +1,85 @@ +- id: kitchen_shopping_oatmeal + alias: '[Kitchen][Shopping] Oatmeal' + trigger: + - device_id: 99f942bf6462d2372012278e086721bf + domain: zha + platform: device + type: remote_button_short_press + subtype: remote_button_short_press + condition: [ ] + action: + - service: shopping_list.add_item + data: + name: Płatki owsiane + +- id: kitchen_shopping_pasta + alias: '[Kitchen][Shopping] Pasta' + trigger: + - device_id: 75e43fd0f6c82fb9e7bc6ff7c30b8c9a + domain: zha + platform: device + type: remote_button_short_press + subtype: remote_button_short_press + condition: [ ] + action: + - service: shopping_list.add_item + data: + name: Makaron pełnoziarnisty + +- id: kitchen_shopping_spices + alias: '[Kitchen][Shopping] Spices' + trigger: + - device_id: 75e43fd0f6c82fb9e7bc6ff7c30b8c9a + domain: zha + platform: device + type: remote_button_short_press + subtype: remote_button_short_press + condition: [ ] + action: + - service: notify.mobile_app_iphone + data: + message: Co dodać do listy zakupów? + data: + actions: + - 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 + +- id: kitchen_shopping_coffee_supplies + alias: '[Kitchen][Shopping] Coffee Supplies' + trigger: + - device_id: 75e43fd0f6c82fb9e7bc6ff7c30b8c9a + domain: zha + platform: device + type: remote_button_short_press + subtype: remote_button_short_press + condition: [ ] + action: + - service: notify.mobile_app_iphone + data: + message: Co dodać do listy zakupów? + data: + actions: + - 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 diff --git a/home-assistant.yml b/home-assistant.yml index 2c00b4b..8028797 100644 --- a/home-assistant.yml +++ b/home-assistant.yml @@ -35,6 +35,39 @@ name: Desk Lightbar - entityId: light.office name: Table lamp + - name: Build spices shopping automations + delegate_to: localhost + 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 - name: Concat automation 2 ansible.builtin.assemble: remote_src: no diff --git a/templates/shopping-mobile-actions.yaml.j2 b/templates/shopping-mobile-actions.yaml.j2 new file mode 100644 index 0000000..a3e3cd5 --- /dev/null +++ b/templates/shopping-mobile-actions.yaml.j2 @@ -0,0 +1,17 @@ +{% for element in shopping_list %} +# Add {{ element.title }} to shopping list +- id: mobile_action-{{ element.action }} + alias: '[Mobile-action] Shopping {{ element.title }}' + description: '' + mode: single + trigger: + - platform: event + event_type: mobile_app_notification_action + event_data: + action: {{ element.action }} + action: + - service: shopping_list.add_item + data: + name: {{ element.title }} + +{% endfor %}