152 lines
4.8 KiB
YAML
152 lines
4.8 KiB
YAML
---
|
|
- hosts: home-assistant
|
|
tasks:
|
|
- name: Remove automations directory
|
|
file:
|
|
path: '{{ pwd_config }}/automations'
|
|
state: absent
|
|
- name: Create build directory
|
|
delegate_to: localhost
|
|
file:
|
|
path: './build/automations'
|
|
state: directory
|
|
- name: Concat automation
|
|
delegate_to: localhost
|
|
ansible.builtin.assemble:
|
|
remote_src: no
|
|
src: './configuration/automations'
|
|
dest: './build/automations/automations-base.yaml'
|
|
- name: Build lights automations
|
|
delegate_to: localhost
|
|
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
|
|
template:
|
|
src: music-button.yaml.j2
|
|
dest: './build/automations/music.yaml'
|
|
vars:
|
|
room: Bathroom
|
|
room_id: bathroom
|
|
device_id: ea9059ad2df037a012ab01a575108dc5
|
|
player_entity_id: media_player.bathroom
|
|
- name: Include ZHA vars
|
|
include_vars:
|
|
file: zha-devices.yml
|
|
name: zha
|
|
- name: Build unavailable automations ZHA
|
|
delegate_to: localhost
|
|
template:
|
|
src: unavailable-zha.yaml.j2
|
|
dest: './build/automations/unavailable-zha.yaml'
|
|
vars:
|
|
devices: "{{ zha.devices }}"
|
|
- name: Include Z-wave vars
|
|
include_vars:
|
|
file: zwave-devices.yml
|
|
name: zwave
|
|
- name: Build unavailable automations Z-Wave
|
|
delegate_to: localhost
|
|
template:
|
|
src: unavailable-zwave.yaml.j2
|
|
dest: './build/automations/unavailable-zwave.yaml'
|
|
vars:
|
|
devices: "{{ zwave.devices }}"
|
|
- name: Include battery vars
|
|
include_vars:
|
|
file: battery.yml
|
|
- name: Build battery info automations
|
|
delegate_to: localhost
|
|
template:
|
|
src: low-battery.yaml.j2
|
|
dest: './build/automations/low-battery.yaml'
|
|
vars:
|
|
entities: "{{ battery }}"
|
|
- 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
|
|
src: './build/automations/'
|
|
dest: '{{ pwd_config }}/automations.yaml'
|
|
- name: Concat scripts
|
|
ansible.builtin.assemble:
|
|
remote_src: no
|
|
src: ./scripts
|
|
dest: '{{ pwd_config }}/scripts.yaml'
|
|
- name: Copy configuration
|
|
copy:
|
|
src: configuration/configuration.yaml
|
|
dest: '{{ pwd_config }}/configuration.yaml'
|
|
- name: Copy alert
|
|
copy:
|
|
src: configuration/alert.yaml
|
|
dest: '{{ pwd_config }}/alert.yaml'
|
|
- name: Copy customize
|
|
copy:
|
|
src: configuration/customize.yaml
|
|
dest: '{{ pwd_config }}/customize.yaml'
|
|
- name: Copy groups
|
|
copy:
|
|
src: configuration/groups.yaml
|
|
dest: '{{ pwd_config }}/groups.yaml'
|
|
- name: Copy secrets
|
|
copy:
|
|
src: configuration/secrets.yaml
|
|
dest: '{{ pwd_config }}/secrets.yaml'
|
|
- name: Copy scripts
|
|
copy:
|
|
src: python_scripts
|
|
dest: '{{ pwd_config }}'
|
|
directory_mode: yes
|
|
- name: Copy appdaemon
|
|
copy:
|
|
src: configuration/appdaemon
|
|
dest: '{{ pwd_config }}/appdaemon'
|