diff --git a/intern/docker_homeassistant/tasks/main.yml b/intern/docker_homeassistant/tasks/main.yml index ec625b05a6d2a61e1c840f139720f17dce3717b4..a6a225a701d6b109706318300cbfbb7b8615aac4 100644 --- a/intern/docker_homeassistant/tasks/main.yml +++ b/intern/docker_homeassistant/tasks/main.yml @@ -2,9 +2,10 @@ - include: ../functions/get_secret.yml with_items: + - { path: "{{ basedir }}/warpai_status_update_key", length: -1 } - { path: "{{ basedir }}/homeassistant_admin_password", length: 12 } - - { path: "{{ basedir }}/influxdb_password", length: 12 } - - { path: "{{ basedir }}/influxdb_token", length: 32 } + - { path: "{{ basedir }}/influxdb_password", length: 12 } + - { path: "{{ basedir }}/influxdb_token", length: 32 } - name: "create folder struct for {{ basedir }}" @@ -22,10 +23,7 @@ dest: "{{ basedir }}/{{ item }}" with_items: - docker-compose.yml - - config/automations.yaml - config/configuration.yaml - - config/scenes.yaml - - config/scripts.yaml register: config_files diff --git a/intern/docker_homeassistant/templates/config/automations.yaml b/intern/docker_homeassistant/templates/config/automations.yaml deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/intern/docker_homeassistant/templates/config/configuration.yaml b/intern/docker_homeassistant/templates/config/configuration.yaml index f095f6bc4b7040587df07d0d704d1bcee7fb4628..54aa79b2d3d49a432f6ba080a8b7c6e799df0461 100644 --- a/intern/docker_homeassistant/templates/config/configuration.yaml +++ b/intern/docker_homeassistant/templates/config/configuration.yaml @@ -61,3 +61,50 @@ binary_sensor: name: "Switch02" count: 3 scan_interval: 5 + +# https://www.home-assistant.io/integrations/rest_command/ +rest_command: + set_zone_status_open: + url: "https://api.warpzone.ms/setstatus?newstatus=OPEN&update_key={{ warpai_status_update_key }}" + method: GET + set_zone_status_closed: + url: "https://api.warpzone.ms/setstatus?newstatus=CLOSED&update_key={{ warpai_status_update_key }}" + method: GET + + +## Automatisierungen ################################################################ + +automation zonenstatus: + + - alias: Zonenstatus + description: Sendet den Zonenstatus per MQTT und REST + trigger: + - platform: state + entity_id: + - binary_sensor.switch02 + condition: [] + action: + - choose: + - conditions: + - condition: state + entity_id: binary_sensor.switch02 + state: 'on' + sequence: + - service: mqtt.publish + data: + topic: warpzone/door/status + payload: OPEN + - service: rest_command.set_zone_status_open + data: {} + - conditions: + - condition: state + entity_id: binary_sensor.switch02 + state: 'off' + sequence: + - service: mqtt.publish + data: + topic: warpzone/door/status + payload: CLOSED + - service: rest_command.set_zone_status_closed + data: {} + mode: single diff --git a/intern/docker_homeassistant/templates/config/scenes.yaml b/intern/docker_homeassistant/templates/config/scenes.yaml deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/intern/docker_homeassistant/templates/config/scripts.yaml b/intern/docker_homeassistant/templates/config/scripts.yaml deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000