diff --git a/common/docker/tasks/main.yml b/common/docker/tasks/main.yml index 302e174738fad70ed7c47b9463acf544c909dfab..5cb6c17777dfdd9ad4243b4f9c6cc43414827fb6 100644 --- a/common/docker/tasks/main.yml +++ b/common/docker/tasks/main.yml @@ -7,6 +7,7 @@ state: present vars: packages: + - apparmor - docker-ce - docker-compose - python3 diff --git a/intern/docker_esphome/templates/config/esphome_display02.yaml b/intern/docker_esphome/templates/config/esphome_display02.yaml index 549c0697c3e162a6527f377e30969c2df911c8da..a57b4fc12a8a995575e30e19fda19c5c1b28dc09 100644 --- a/intern/docker_esphome/templates/config/esphome_display02.yaml +++ b/intern/docker_esphome/templates/config/esphome_display02.yaml @@ -27,6 +27,10 @@ external_components: payload: "OFF" then: - light.turn_off: matrix_light + - topic: warpzone/door/status + payload: "CLOSED" + then: + - light.turn_off: matrix_light light: - platform: monochromatic diff --git a/intern/docker_esphome/templates/config/esphome_kuehlschrank.yaml b/intern/docker_esphome/templates/config/esphome_kuehlschrank.yaml index 954529f8ecc39b55aae44926acde47c9e2219e77..2db524be95434ceb3621a33f4c4d7310c0e06e72 100644 --- a/intern/docker_esphome/templates/config/esphome_kuehlschrank.yaml +++ b/intern/docker_esphome/templates/config/esphome_kuehlschrank.yaml @@ -28,8 +28,8 @@ {% include "/includes/common.inc.yaml" %} on_message: - - topic: ESPHome/{{ devicename }}/state/command - payload: "ON" + - topic: warpzone/door/status + payload: "OPEN" then: - light.turn_on: id: logo_led @@ -39,8 +39,8 @@ id: kuehl_led effect: "Rainbow" brightness: 100% - - topic: ESPHome/{{ devicename }}/state/command - payload: "OFF" + - topic: warpzone/door/status + payload: "CLOSED" then: - light.turn_off: logo_led - light.turn_off: kuehl_led diff --git a/intern/docker_esphome/templates/config/esphome_plug01.yaml b/intern/docker_esphome/templates/config/esphome_plug01.yaml index 4345033c4a2d64ed1e38fb84989ea066bac36292..efffc1d98834113d64728d3b50fd22dc430abdf6 100644 --- a/intern/docker_esphome/templates/config/esphome_plug01.yaml +++ b/intern/docker_esphome/templates/config/esphome_plug01.yaml @@ -15,6 +15,10 @@ payload: "OFF" then: - switch.turn_off: relay + - topic: warpzone/door/status + payload: "CLOSED" + then: + - switch.turn_off: relay status_led: pin: diff --git a/intern/docker_esphome/templates/config/esphome_plug02.yaml b/intern/docker_esphome/templates/config/esphome_plug02.yaml index 0bad6f3dbbb296446aa9fbd491f309f96de4109d..c613318bf660449cfe0be546f739392eb6d5aab8 100644 --- a/intern/docker_esphome/templates/config/esphome_plug02.yaml +++ b/intern/docker_esphome/templates/config/esphome_plug02.yaml @@ -15,6 +15,10 @@ payload: "OFF" then: - switch.turn_off: relay + - topic: warpzone/door/status + payload: "CLOSED" + then: + - switch.turn_off: relay status_led: pin: diff --git a/intern/docker_esphome/templates/config/esphome_plug03.yaml b/intern/docker_esphome/templates/config/esphome_plug03.yaml index 0048c0c3bdf333ad9e3fc5819579a85ef103b29f..07c62e6fffa956ea038aa5d3da54eb2d48d01eed 100644 --- a/intern/docker_esphome/templates/config/esphome_plug03.yaml +++ b/intern/docker_esphome/templates/config/esphome_plug03.yaml @@ -15,6 +15,10 @@ payload: "OFF" then: - switch.turn_off: relay + - topic: warpzone/door/status + payload: "CLOSED" + then: + - switch.turn_off: relay status_led: pin: diff --git a/intern/docker_esphome/templates/config/esphome_plug04.yaml b/intern/docker_esphome/templates/config/esphome_plug04.yaml index e1471832dfb1af716bb2d8abddf4958bd08a2dc5..04ecaa88b5924626b31540544824ff4d3992610a 100644 --- a/intern/docker_esphome/templates/config/esphome_plug04.yaml +++ b/intern/docker_esphome/templates/config/esphome_plug04.yaml @@ -15,6 +15,10 @@ payload: "OFF" then: - switch.turn_off: relay + - topic: warpzone/door/status + payload: "CLOSED" + then: + - switch.turn_off: relay status_led: pin: diff --git a/intern/docker_esphome/templates/config/esphome_plug05.yaml b/intern/docker_esphome/templates/config/esphome_plug05.yaml index 9608a94e91eae257278cfafce9e0018078cc1d71..9ba0939d86fdfa81e81b8861ca6880aa42376ce5 100644 --- a/intern/docker_esphome/templates/config/esphome_plug05.yaml +++ b/intern/docker_esphome/templates/config/esphome_plug05.yaml @@ -15,6 +15,10 @@ payload: "OFF" then: - switch.turn_off: relay + - topic: warpzone/door/status + payload: "CLOSED" + then: + - switch.turn_off: relay substitutions: plug_name: {{ devicename }} diff --git a/intern/docker_esphome/templates/config/esphome_plug06.yaml b/intern/docker_esphome/templates/config/esphome_plug06.yaml index 595a4dbf96ce2737302078ec4337e20b710653a0..2940f952ca5af296d6daf0bf9099b42adb3708a0 100644 --- a/intern/docker_esphome/templates/config/esphome_plug06.yaml +++ b/intern/docker_esphome/templates/config/esphome_plug06.yaml @@ -15,6 +15,10 @@ payload: "OFF" then: - switch.turn_off: relay + - topic: warpzone/door/status + payload: "CLOSED" + then: + - switch.turn_off: relay substitutions: plug_name: {{ devicename }} diff --git a/intern/docker_esphome/templates/config/esphome_plug07.yaml b/intern/docker_esphome/templates/config/esphome_plug07.yaml index cc47304b00a075009d88016c4362a6edb77ebc48..a2d482abf18ce9780563b4f8c7b19b0f95e51264 100644 --- a/intern/docker_esphome/templates/config/esphome_plug07.yaml +++ b/intern/docker_esphome/templates/config/esphome_plug07.yaml @@ -15,6 +15,10 @@ payload: "OFF" then: - switch.turn_off: relay + - topic: warpzone/door/status + payload: "CLOSED" + then: + - switch.turn_off: relay substitutions: plug_name: {{ devicename }} diff --git a/intern/docker_esphome/templates/config/esphome_plug08.yaml b/intern/docker_esphome/templates/config/esphome_plug08.yaml index 5c118347681cf3e9c33bcc00bafe9d4dc6c8d106..78daa4fb7b31665d4fa95c7321ca87100e842385 100644 --- a/intern/docker_esphome/templates/config/esphome_plug08.yaml +++ b/intern/docker_esphome/templates/config/esphome_plug08.yaml @@ -15,6 +15,10 @@ payload: "OFF" then: - switch.turn_off: relay + - topic: warpzone/door/status + payload: "CLOSED" + then: + - switch.turn_off: relay substitutions: plug_name: {{ devicename }} diff --git a/intern/docker_homeassistant/templates/config/configuration.yaml b/intern/docker_homeassistant/templates/config/configuration.yaml index a6b7b6b606192aa54adb3db8d5281b5a2e732944..54780ce1bed70edbd7c10744d93baa56e82650a9 100644 --- a/intern/docker_homeassistant/templates/config/configuration.yaml +++ b/intern/docker_homeassistant/templates/config/configuration.yaml @@ -59,7 +59,7 @@ binary_sensor: host: TL-SG3452X name: "Switch02" count: 3 - scan_interval: 5 + scan_interval: 20 # https://www.home-assistant.io/integrations/rest_command/ rest_command: @@ -96,7 +96,7 @@ input_select: - closed icon: mdi:door-open -# current time for +# current time for zonenstatus telegram sensor: - platform: time_date display_options: @@ -142,7 +142,7 @@ automation ansible: option: closed target: entity_id: input_select.zonenstatus - mode: single + mode: restart # send zonenstatus to MQTT, REST - alias: ANSIBLE_zonenstatus_send_MQTT_REST @@ -175,7 +175,7 @@ automation ansible: payload: CLOSED - service: rest_command.set_zone_status_closed data: {} - mode: single + mode: restart # send zonenstatus to telegram - alias: ANSIBLE_zonenstatus_send_telegram @@ -207,4 +207,4 @@ automation ansible: target: -1001893089134 timeout: 30 message: Die warpzone ist seit {{ '{{' }} states('sensor.time') {{ '}}' }} geschlossen! - mode: single + mode: restart diff --git a/intern/docker_tasmoadmin/tasks/main.yml b/intern/docker_tasmoadmin/tasks/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..c0ec94294fb80f73af038470fad0b8432b3c6271 --- /dev/null +++ b/intern/docker_tasmoadmin/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- name: "create folder struct for {{ servicename }}" + ansible.builtin.file: + path: "{{ item }}" + state: "directory" + recurse: yes + owner: 1000 + group: 1000 + with_items: + - "{{ basedir }}/data/" + +- name: "copy config files file for {{ servicename }}" + ansible.builtin.template: + src: "{{ item }}" + dest: "{{ basedir }}/{{ item }}" + mode: '0755' + with_items: + - "docker-compose.yml" + +- name: "start {{ servicename }} with docker-compose" + community.docker.docker_compose: + state: present + project_src: "{{ basedir }}" diff --git a/intern/docker_tasmoadmin/templates/docker-compose.yml b/intern/docker_tasmoadmin/templates/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..18c4b09015091c56a460ec565a9336429e922535 --- /dev/null +++ b/intern/docker_tasmoadmin/templates/docker-compose.yml @@ -0,0 +1,24 @@ + +version: "3" + +services: + + app: + image: ghcr.io/tasmoadmin/tasmoadmin:latest + restart: always + volumes: + - "{{ basedir }}/data:/data" + environment: + - TZ=Europe/Berlin + labels: + - traefik.enable=true + - traefik.http.routers.{{ servicename }}.rule=Host(`{{ domain }}`) + - traefik.http.routers.{{ servicename }}.entrypoints=websecure + - traefik.http.services.{{ servicename }}.loadbalancer.server.port=80 + networks: + - default + - web + +networks: + web: + external: true diff --git a/site.yml b/site.yml index 4527be8bae26eea8806c41fe037472e6d37b6490..766764d31b0205d387069c9dda87443ecde2b00d 100644 --- a/site.yml +++ b/site.yml @@ -102,6 +102,12 @@ basedir: /srv/graylog, domain: "graylog.warpzone.lan" } + - { + role: intern/docker_tasmoadmin, tags: tasmoadmin, + servicename: tasmoadmin, + basedir: /srv/tasmoadmin, + domain: "tasmoadmin.warpzone.lan" + } - hosts: webserver