From 7b1ccc33284139a0acfc81cd385ba16490696719 Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Mon, 22 May 2023 23:16:42 +0200 Subject: [PATCH] dos2unix and minor fixes --- automations/startup.yaml | 58 +-- automations/update_notifications.yaml | 120 ++--- customizations/automations.yaml | 24 +- customizations/certificates.yaml | 12 +- customizations/hacs.yaml | 12 +- customizations/person.yaml | 30 +- input_boolean/update.yaml | 52 +- packages/alarm/alarm_engine.yaml | 1 - packages/qnap.yaml | 174 +++---- packages/zigbee2mqtt.yaml | 724 +++++++++++++------------- templates/speech_message.yaml | 442 ++++++++-------- templates/welcome_message.yaml | 52 +- 12 files changed, 850 insertions(+), 851 deletions(-) diff --git a/automations/startup.yaml b/automations/startup.yaml index 8191fca3..6d80ea70 100644 --- a/automations/startup.yaml +++ b/automations/startup.yaml @@ -1,29 +1,29 @@ -###################################################################### -# Startup Automation: Restart on Error -###################################################################### - -- alias: "Home Assistant - Startup: Restart on Error" - - trigger: - - platform: homeassistant - event: start - - action: - - delay: 00:00:60 - - condition: state - entity_id: persistent_notification.invalid_config - state: 'notifying' - - service: script.homeassistant_restart - -###################################################################### -# Startup Automation: Google Sync -###################################################################### - -- alias: "Home Assistant - Startup: Google Sync" - - trigger: - - platform: homeassistant - event: start - - action: - - service: script.homeassistant_google_home_sync +###################################################################### +# Startup Automation: Restart on Error +###################################################################### + +- alias: "Home Assistant - Startup: Restart on Error" + + trigger: + - platform: homeassistant + event: start + + action: + - delay: 00:00:60 + - condition: state + entity_id: persistent_notification.invalid_config + state: 'notifying' + - service: script.homeassistant_restart + +###################################################################### +# Startup Automation: Google Sync +###################################################################### + +- alias: "Home Assistant - Startup: Google Sync" + + trigger: + - platform: homeassistant + event: start + + action: + - service: script.homeassistant_google_home_sync diff --git a/automations/update_notifications.yaml b/automations/update_notifications.yaml index 2b7c380c..d4978471 100644 --- a/automations/update_notifications.yaml +++ b/automations/update_notifications.yaml @@ -1,60 +1,60 @@ -###################################################################### -# Update Notification: HACS -###################################################################### - -- alias: "Update Notification: HACS" - - trigger: - - platform: numeric_state - entity_id: sensor.hacs - above: 0 - - - platform: homeassistant - event: start - - condition: - condition: numeric_state - entity_id: sensor.hacs - above: 0 - - action: - - delay: '00:00:15' - - service: script.notify_text - data_template: - title: "HACS - Aggiornamento" - message: > - {% set update_number = states('sensor.hacs') %} - {% if is_state('sensor.hacs', '1') %} - E' disponibile un aggiornamento per i moduli HACS: - {% else %} - Sono disponibili {{ update_number }} aggiornamenti per i moduli HACS: - {% endif %} - {% for update in states.sensor.hacs.attributes['repositories'] %} - - {{ update['display_name'] }}: {{ update['available_version'] }} - {%- endfor %} - notification_id: "update" - enable_persistent: true - - - service: input_boolean.turn_on - entity_id: input_boolean.update_hacs - -###################################################################### -# Update: Aknowledge update -# -# Actions: -# - persistent_notification.dismiss -###################################################################### -- alias: "Update: Riconoscimento Aggiornamenti" - - trigger: - platform: state - entity_id: - - input_boolean.update_homeassistant - - input_boolean.update_shelly - - input_boolean.update_hacs - to: 'off' - - action: - - service: persistent_notification.dismiss - data_template: - notification_id: "update" +###################################################################### +# Update Notification: HACS +###################################################################### + +- alias: "Update Notification: HACS" + + trigger: + - platform: numeric_state + entity_id: sensor.hacs + above: 0 + + - platform: homeassistant + event: start + + condition: + condition: numeric_state + entity_id: sensor.hacs + above: 0 + + action: + - delay: '00:00:15' + - service: script.notify_text + data_template: + title: "HACS - Aggiornamento" + message: > + {% set update_number = states('sensor.hacs') %} + {% if is_state('sensor.hacs', '1') %} + E' disponibile un aggiornamento per i moduli HACS: + {% else %} + Sono disponibili {{ update_number }} aggiornamenti per i moduli HACS: + {% endif %} + {% for update in states.sensor.hacs.attributes['repositories'] %} + - {{ update['display_name'] }}: {{ update['available_version'] }} + {%- endfor %} + notification_id: "update" + enable_persistent: true + + - service: input_boolean.turn_on + entity_id: input_boolean.update_hacs + +###################################################################### +# Update: Aknowledge update +# +# Actions: +# - persistent_notification.dismiss +###################################################################### +- alias: "Update: Riconoscimento Aggiornamenti" + + trigger: + platform: state + entity_id: + - input_boolean.update_homeassistant + - input_boolean.update_shelly + - input_boolean.update_hacs + to: 'off' + + action: + - service: persistent_notification.dismiss + data_template: + notification_id: "update" diff --git a/customizations/automations.yaml b/customizations/automations.yaml index d7211146..2082b835 100644 --- a/customizations/automations.yaml +++ b/customizations/automations.yaml @@ -1,12 +1,12 @@ -###################################################################### -# Customization: Automations -###################################################################### - -automation.risveglio_giorgio: - icon: mdi:alarm - -automation.home_assistant_startup_restart_on_error: - icon: mdi:restart-alert - -automation.home_assistant_startup_google_sync: - icon: mdi:google-assistant +###################################################################### +# Customization: Automations +###################################################################### + +automation.risveglio_giorgio: + icon: mdi:alarm + +automation.home_assistant_startup_restart_on_error: + icon: mdi:restart-alert + +automation.home_assistant_startup_google_sync: + icon: mdi:google-assistant diff --git a/customizations/certificates.yaml b/customizations/certificates.yaml index bcec1d7a..c4cbbda3 100644 --- a/customizations/certificates.yaml +++ b/customizations/certificates.yaml @@ -1,6 +1,6 @@ -###################################################################### -# Customization: Certificates -###################################################################### - -sensor.cert_expiry_timestamp_server_giorgioravera_it: - friendly_name: Scadenza Certificato SSL +###################################################################### +# Customization: Certificates +###################################################################### + +sensor.cert_expiry_timestamp_server_giorgioravera_it: + friendly_name: Scadenza Certificato SSL diff --git a/customizations/hacs.yaml b/customizations/hacs.yaml index 2119e52b..ec703cde 100644 --- a/customizations/hacs.yaml +++ b/customizations/hacs.yaml @@ -1,6 +1,6 @@ -###################################################################### -# Customization: Hacs -###################################################################### - -sensor.hacs: - friendly_name: Aggiornamenti HACS +###################################################################### +# Customization: Hacs +###################################################################### + +sensor.hacs: + friendly_name: Aggiornamenti HACS diff --git a/customizations/person.yaml b/customizations/person.yaml index 3982a1ab..101971aa 100644 --- a/customizations/person.yaml +++ b/customizations/person.yaml @@ -1,15 +1,15 @@ -###################################################################### -# Customization: Person -###################################################################### - -person.giorgio: - entity_picture: "https://lh5.googleusercontent.com/-XA71SeQatCE/AAAAAAAAAAI/AAAAAAABf8U/EWQJ3bwMgK8/photo.jpg" - -person.laura: - entity_picture: "https://lh4.googleusercontent.com/-MzGTo7hJlzQ/AAAAAAAAAAI/AAAAAAAAHBg/enCMtB-4rrs/photo.jpg" - -person.anna: - entity_picture: "https://lh3.googleusercontent.com/-jKAuS0EKCo0/AAAAAAAAAAI/AAAAAAAAIz4/Edk7vyRSPc4/photo.jpg" - -person.assunta: - entity_picture: "https://lh6.googleusercontent.com/-4VDO1evGw1U/AAAAAAAAAAI/AAAAAAAAAC4/5BymNaSNWcc/photo.jpg" +###################################################################### +# Customization: Person +###################################################################### + +person.giorgio: + entity_picture: "https://lh5.googleusercontent.com/-XA71SeQatCE/AAAAAAAAAAI/AAAAAAABf8U/EWQJ3bwMgK8/photo.jpg" + +person.laura: + entity_picture: "https://lh4.googleusercontent.com/-MzGTo7hJlzQ/AAAAAAAAAAI/AAAAAAAAHBg/enCMtB-4rrs/photo.jpg" + +person.anna: + entity_picture: "https://lh3.googleusercontent.com/-jKAuS0EKCo0/AAAAAAAAAAI/AAAAAAAAIz4/Edk7vyRSPc4/photo.jpg" + +person.assunta: + entity_picture: "https://lh6.googleusercontent.com/-4VDO1evGw1U/AAAAAAAAAAI/AAAAAAAAAC4/5BymNaSNWcc/photo.jpg" diff --git a/input_boolean/update.yaml b/input_boolean/update.yaml index 756ae2d4..d81bb04e 100644 --- a/input_boolean/update.yaml +++ b/input_boolean/update.yaml @@ -1,26 +1,26 @@ -###################################################################### -# Update: Home Assistant -###################################################################### - -update_homeassistant: - name: Aggiornamento Home Assistant - initial: off - icon: mdi:cellphone-arrow-down - -###################################################################### -# Update: Shelly -###################################################################### - -update_shelly: - name: Aggiornamento Shelly - initial: off - icon: mdi:cellphone-arrow-down - -###################################################################### -# Update: HACS -###################################################################### - -update_hacs: - name: Aggiornamenti HACS - initial: off - icon: mdi:cellphone-arrow-down +###################################################################### +# Update: Home Assistant +###################################################################### + +update_homeassistant: + name: Aggiornamento Home Assistant + initial: off + icon: mdi:cellphone-arrow-down + +###################################################################### +# Update: Shelly +###################################################################### + +update_shelly: + name: Aggiornamento Shelly + initial: off + icon: mdi:cellphone-arrow-down + +###################################################################### +# Update: HACS +###################################################################### + +update_hacs: + name: Aggiornamenti HACS + initial: off + icon: mdi:cellphone-arrow-down diff --git a/packages/alarm/alarm_engine.yaml b/packages/alarm/alarm_engine.yaml index 8d36ee87..481be562 100644 --- a/packages/alarm/alarm_engine.yaml +++ b/packages/alarm/alarm_engine.yaml @@ -26,7 +26,6 @@ automation: # Alarm Automation: Aknowledge Alarms # # Actions: - # - persistent_notification.dismiss # - script.stop_alarm ###################################################################### - alias: "Allarmi: Riconoscimento Allarmi" diff --git a/packages/qnap.yaml b/packages/qnap.yaml index fd5eecda..7b3d7c69 100644 --- a/packages/qnap.yaml +++ b/packages/qnap.yaml @@ -1,87 +1,87 @@ -###################################################################### -# QNAP Package - Switch -###################################################################### - -switch: - - platform: wake_on_lan - mac: !secret nas_mac - name: NAS - host: !secret nas_host - turn_off: - service: shell_command.nas_turn_off - data: - nas_host: !secret nas_host - nas_username: !secret nas_username - -###################################################################### -# QNAP Package - Shell Command -###################################################################### - -shell_command: - nas_turn_off: 'ssh {{ nas_username }}@{{ nas_host }} -oStrictHostKeyChecking=no -i /config/credentials/id_rsa halt' - plex_start: 'ssh {{ nas_username }}@{{ nas_host }} -oStrictHostKeyChecking=no -i /config/credentials/id_rsa /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/plex.sh start' - plex_restart: 'ssh {{ nas_username }}@{{ nas_host }} -oStrictHostKeyChecking=no -i /config/credentials/id_rsa /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/plex.sh restart' - plex_stop: 'ssh {{ nas_username }}@{{ nas_host }} -oStrictHostKeyChecking=no -i /config/credentials/id_rsa /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/plex.sh stop' - -###################################################################### -# QNAP Package - Script -###################################################################### - -script: - plex_start: - alias: "Avvia Plex" - sequence: - - service: shell_command.plex_start - data: - nas_host: !secret nas_host - nas_username: !secret nas_username - - plex_restart: - alias: "Riavvia Plex" - sequence: - - service: shell_command.plex_restart - data: - nas_host: !secret nas_host - nas_username: !secret nas_username - - plex_stop: - alias: "Ferma Plex" - sequence: - - service: shell_command.plex_stop - data: - nas_host: !secret nas_host - nas_username: !secret nas_username - -###################################################################### -# QNAP Package - Google Assistant -###################################################################### - -google_assistant: - entity_config: - switch.nas: - name: NAS - expose: true - room: Studio - script.plex_start: - name: Avvia Plex - expose: true - room: Routine - script.plex_stop: - name: Ferma Plex - expose: true - room: Routine - -###################################################################### -# QNAP Package - Customizations -###################################################################### - -homeassistant: - customize: - switch.nas: - icon: mdi:nas - script.plex_start: - icon: mdi:plex - script.plex_restart: - icon: mdi:plex - script.plex_stop: - icon: mdi:plex +###################################################################### +# QNAP Package - Switch +###################################################################### + +switch: + - platform: wake_on_lan + mac: !secret nas_mac + name: NAS + host: !secret nas_host + turn_off: + service: shell_command.nas_turn_off + data: + nas_host: !secret nas_host + nas_username: !secret nas_username + +###################################################################### +# QNAP Package - Shell Command +###################################################################### + +shell_command: + nas_turn_off: 'ssh {{ nas_username }}@{{ nas_host }} -oStrictHostKeyChecking=no -i /config/credentials/id_rsa halt' + plex_start: 'ssh {{ nas_username }}@{{ nas_host }} -oStrictHostKeyChecking=no -i /config/credentials/id_rsa /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/plex.sh start' + plex_restart: 'ssh {{ nas_username }}@{{ nas_host }} -oStrictHostKeyChecking=no -i /config/credentials/id_rsa /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/plex.sh restart' + plex_stop: 'ssh {{ nas_username }}@{{ nas_host }} -oStrictHostKeyChecking=no -i /config/credentials/id_rsa /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/plex.sh stop' + +###################################################################### +# QNAP Package - Script +###################################################################### + +script: + plex_start: + alias: "Avvia Plex" + sequence: + - service: shell_command.plex_start + data: + nas_host: !secret nas_host + nas_username: !secret nas_username + + plex_restart: + alias: "Riavvia Plex" + sequence: + - service: shell_command.plex_restart + data: + nas_host: !secret nas_host + nas_username: !secret nas_username + + plex_stop: + alias: "Ferma Plex" + sequence: + - service: shell_command.plex_stop + data: + nas_host: !secret nas_host + nas_username: !secret nas_username + +###################################################################### +# QNAP Package - Google Assistant +###################################################################### + +google_assistant: + entity_config: + switch.nas: + name: NAS + expose: true + room: Studio + script.plex_start: + name: Avvia Plex + expose: true + room: Routine + script.plex_stop: + name: Ferma Plex + expose: true + room: Routine + +###################################################################### +# QNAP Package - Customizations +###################################################################### + +homeassistant: + customize: + switch.nas: + icon: mdi:nas + script.plex_start: + icon: mdi:plex + script.plex_restart: + icon: mdi:plex + script.plex_stop: + icon: mdi:plex diff --git a/packages/zigbee2mqtt.yaml b/packages/zigbee2mqtt.yaml index 98bc6583..c8b75d7f 100644 --- a/packages/zigbee2mqtt.yaml +++ b/packages/zigbee2mqtt.yaml @@ -1,362 +1,362 @@ -###################################################################### -# Zigbee2mqtt Package - Input select -###################################################################### - -input_select: - # Zigbee2mqtt log level - zigbee2mqtt_log_level: - name: "Zigbee2MQTT: Log Level" - options: - - debug - - info - - warn - - error - initial: info - icon: mdi:format-list-bulleted - -###################################################################### -# Zigbee2mqtt Package - Input Number -###################################################################### - -# Input number for joining time remaining (in minutes) -input_number: - zigbee2mqtt_join_minutes: - name: "Zigbee2MQTT: Tempo per il join" - initial: 2 - min: 1 - max: 5 - step: 1 - mode: slider - -###################################################################### -# Zigbee2mqtt Package - Input Text -###################################################################### - -input_text: - zigbee2mqtt_old_name: - name: "Device da Rinominare" - initial: "" - - zigbee2mqtt_new_name: - name: "Nuovo nome Device" - initial: "" - - zigbee2mqtt_remove: - name: "Device da Rimuovere" - initial: "" - -###################################################################### -# Zigbee2mqtt Package - Input boolean -###################################################################### - -input_boolean: - zigbee2mqtt_force_remove: - name: "Zigbee2MQTT: Rimozione Forzata" - initial: false - icon: mdi:alert-remove - -###################################################################### -# Zigbee2mqtt Package - Script -###################################################################### - -script: - ###################################################################### - # Restart Bridge - ###################################################################### - zigbee2mqtt_restart: - alias: "Zigbee2MQTT: Riavvia Bridge" - sequence: - - service: shell_command.zigbee2mqtt_restart - data: - docker_host: !secret docker_host - docker_username: !secret docker_username - icon: mdi:restart - - ###################################################################### - # Rename Device - ###################################################################### - zigbee2mqtt_rename: - alias: "Zigbee2MQTT: Rinomina Device" - sequence: - service: mqtt.publish - data_template: - topic: zigbee2mqtt/bridge/request/device/rename - payload_template: >- - { - "from": "{{ states.input_text.zigbee2mqtt_old_name.state | string }}", - "to": "{{ states.input_text.zigbee2mqtt_new_name.state | string }}" - } - icon: mdi:form-textbox - - ###################################################################### - # Delete Device - ###################################################################### - zigbee2mqtt_remove: - alias: "Zigbee2MQTT: Rimuovi Device" - sequence: - service: mqtt.publish - data_template: - topic: zigbee2mqtt/bridge/request/device/remove - payload_template: >- - { - "id": "{{ states.input_text.zigbee2mqtt_remove.state | string }}", - "force": {% if states.input_boolean.zigbee2mqtt_force_remove.state == "off" %}false{% else %}true{% endif %} - } - icon: mdi:link-variant-remove - -###################################################################### -# Zigbee2mqtt Package - Timer -###################################################################### - -timer: - # Timer for joining time remaining (120 sec = 2 min) - zigbee_permit_join: - name: Tempo rimasto per il join - duration: 120 - -###################################################################### -# Zigbee2mqtt Package - Sensor -###################################################################### - -mqtt: - sensor: - ###################################################################### - # MQTT Sensor for monitoring the bridge state - ###################################################################### - - name: "Zigbee2MQTT: Stato Bridge" - state_topic: "zigbee2mqtt/bridge/state" - icon: mdi:router-wireless - - ###################################################################### - # MQTT Sensor for Showing the Zigbee2MQTT Version - ###################################################################### - - name: "Zigbee2MQTT: Versione Bridge" - state_topic: "zigbee2mqtt/bridge/info" - value_template: "{{ value_json.version }}" - icon: mdi:zigbee - - ###################################################################### - # MQTT Sensor for Showing the Coordinator Type - ###################################################################### - #- name: "Zigbee2MQTT: Tipo Coordinator" - # state_topic: "zigbee2mqtt/bridge/info" - # value_template: "{{ value_json.coordinator.type }}" - # icon: mdi:chip - - ###################################################################### - # MQTT Sensor for Showing the Coordinator Version - ###################################################################### - - name: "Zigbee2MQTT: Versione Coordinator" - state_topic: "zigbee2mqtt/bridge/info" - value_template: "{{ value_json.coordinator.meta.revision }}" - icon: mdi:chip - - ###################################################################### - # MQTT Sensor for monitoring the permit_join state - ###################################################################### - - name: "Zigbee2MQTT: Stato permit join" - state_topic: "zigbee2mqtt/bridge/info" - value_template: "{{ value_json.permit_join }}" - icon: mdi:link-lock - - ###################################################################### - # MQTT Sensor for monitoring the log_level state - ###################################################################### - - name: "Zigbee2MQTT: Stato log level" - state_topic: "zigbee2mqtt/bridge/info" - value_template: "{{ value_json.log_level }}" - icon: mdi:file-document-outline - - ###################################################################### - # MQTT Sensor for Showing the Channel - ###################################################################### - - name: "Zigbee2MQTT: Canale" - state_topic: "zigbee2mqtt/bridge/info" - value_template: "{{ value_json.network.channel }}" - icon: mdi:access-point-network - - ###################################################################### - # MQTT Sensor for Showing the PanID - ###################################################################### - - name: "Zigbee2MQTT: PanID" - state_topic: "zigbee2mqtt/bridge/info" - value_template: "{{ value_json.network.pan_id }}" - icon: mdi:lan - - ###################################################################### - # MQTT Sensor for Showing the Extended PanID - ###################################################################### - #- name: "Zigbee2mqtt: Extended PanID" - # state_topic: "zigbee2mqtt/bridge/info" - # value_template: "{{ value_json.network.extended_pan_id }}" - # icon: mdi:lan - - ###################################################################### - # Zigbee2mqtt Networkmap - ###################################################################### - - name: Zigbee2MQTT Networkmap - state_topic: zigbee2mqtt/bridge/response/networkmap - value_template: >- - {{ now().strftime('%Y-%m-%d %H:%M:%S') }} - json_attributes_topic: zigbee2mqtt/bridge/response/networkmap - json_attributes_template: "{{ value_json.data.value | tojson }}" - - ###################################################################### - # Zigbee2mqtt Package - Switch - ###################################################################### - switch: - # Switch for enabling joining - - name: "Zigbee2MQTT: Abilita join" - state_topic: "zigbee2mqtt/bridge/info" - value_template: '{{ value_json.permit_join | lower }}' - command_topic: "zigbee2mqtt/bridge/request/permit_join" - payload_on: "true" - payload_off: "false" - icon: mdi:link-lock - -###################################################################### -# Zigbee2mqtt Package - Shell Command -###################################################################### - -shell_command: - zigbee2mqtt_restart: 'ssh {{ docker_username }}@{{ docker_host }} -oStrictHostKeyChecking=no -i /config/credentials/id_rsa docker container restart zigbee2mqtt' - -###################################################################### -# Zigbee2mqtt Package - Automation -###################################################################### - -automation: - ###################################################################### - # Automation to change log level - ###################################################################### - - id: zigbee2mqtt_change_log_level - alias: "Zigbee2MQTT: Cambia Log Level" - trigger: - platform: state - entity_id: input_select.zigbee2mqtt_log_level - action: - - service: mqtt.publish - data: - payload_template: "{{ states('input_select.zigbee2mqtt_log_level') }}" - topic: zigbee2mqtt/bridge/request/config/log_level - - ###################################################################### - # Automation to start timer when enable join is turned on - ###################################################################### - - id: zigbee2mqtt_join_enabled - alias: "Zigbee2MQTT: Abilita Join" - trigger: - platform: state - entity_id: switch.zigbee2mqtt_abilita_join - to: "on" - action: - service: timer.start - entity_id: timer.zigbee_permit_join - data_template: - duration: "{{ '00:0%i:00' % (states('input_number.zigbee2mqtt_join_minutes') | int ) }}" - - ###################################################################### - # Automation to stop timer when switch turned off and turn off switch when timer finished - ###################################################################### - - id: zigbee2mqtt_join_disabled - alias: "Zigbee2MQTT: Disabilita Join" - trigger: - - platform: event - event_type: timer.finished - event_data: - entity_id: timer.zigbee_permit_join - - platform: state - entity_id: switch.zigbee2mqtt_abilita_join - to: "off" - action: - - service: timer.cancel - data: - entity_id: timer.zigbee_permit_join - - service: switch.turn_off - entity_id: switch.zigbee2mqtt_abilita_join - - ###################################################################### - # Automation to notify when a device joined zigbee2mqtt network - ###################################################################### - - id: "zigbee2mqtt_notification_on_successfull_interview" - alias: "Zigbee2MQTT: Device aggiunto alla rete Zigbee2mqtt" - trigger: - platform: mqtt - topic: 'zigbee2mqtt/bridge/event' - condition: - condition: template - value_template: '{{trigger.payload_json.type == "device_interview" and trigger.payload_json.data.status == "successful" and trigger.payload_json.data.supported}}' - action: - - service: persistent_notification.create - data_template: - title: "Device aggiunto alla rete Zigbee2mqtt" - message: "Name: {{trigger.payload_json.data.friendly_name}}, - Vendor: {{trigger.payload_json.data.definition.vendor}}, - Model: {{trigger.payload_json.data.definition.model}}, - Description: {{trigger.payload_json.data.definition.description}}" - - ###################################################################### - # Automation to restart zigbee2mqtt to refresh sensor state - ###################################################################### - - id: zigbee2mqtt_startup_automation - alias: "Zigbee2MQTT: Startup Automation" - trigger: - - platform: homeassistant - event: start - action: - - service: script.zigbee2mqtt_restart - - ###################################################################### - # Automation to restart zigbee2mqtt in case of bridge offline for 1m - ###################################################################### - - id: zigbee2mqtt_restart_automation - alias: "Zigbee2MQTT: Restart Automation" - trigger: - - platform: state - entity_id: sensor.zigbee2mqtt_stato_bridge - to: "offline" - for: "00:01:00" - action: - - service: script.zigbee2mqtt_restart - - service: script.notify_text - data: - title: "Restart Zigbee2mqtt" - message: "Zigbee2mqtt bridge offline: force restart" - -###################################################################### -# Zigbee2mqtt Package - Logbook -###################################################################### - -logbook: - exclude: - entities: - - sensor.zigbee2mqtt_stato_bridge - - sensor.zigbee2mqtt_stato_permit_join - - sensor.zigbee2mqtt_stato_log_level - - sensor.zigbee2mqtt_versione_bridge - - sensor.zigbee2mqtt_versione_coordinator - - sensor.zigbee2mqtt_tipo_coordinator - - sensor.zigbee2mqtt_canale - - sensor.zigbee2mqtt_panid - - sensor.zigbee2mqtt_extended_panid - - sensor.zigbee2mqtt_networkmap - - timer.zigbee_permit_join - -###################################################################### -# Zigbee2mqtt Package - Recorder -###################################################################### - -recorder: - exclude: - entities: - - sensor.zigbee2mqtt_stato_bridge - - sensor.zigbee2mqtt_stato_permit_join - - sensor.zigbee2mqtt_stato_log_level - - sensor.zigbee2mqtt_versione_bridge - - sensor.zigbee2mqtt_versione_coordinator - - sensor.zigbee2mqtt_tipo_coordinator - - sensor.zigbee2mqtt_canale - - sensor.zigbee2mqtt_panid - - sensor.zigbee2mqtt_extended_panid - - sensor.zigbee2mqtt_networkmap - - timer.zigbee_permit_join +###################################################################### +# Zigbee2mqtt Package - Input select +###################################################################### + +input_select: + # Zigbee2mqtt log level + zigbee2mqtt_log_level: + name: "Zigbee2MQTT: Log Level" + options: + - debug + - info + - warn + - error + initial: info + icon: mdi:format-list-bulleted + +###################################################################### +# Zigbee2mqtt Package - Input Number +###################################################################### + +# Input number for joining time remaining (in minutes) +input_number: + zigbee2mqtt_join_minutes: + name: "Zigbee2MQTT: Tempo per il join" + initial: 2 + min: 1 + max: 5 + step: 1 + mode: slider + +###################################################################### +# Zigbee2mqtt Package - Input Text +###################################################################### + +input_text: + zigbee2mqtt_old_name: + name: "Device da Rinominare" + initial: "" + + zigbee2mqtt_new_name: + name: "Nuovo nome Device" + initial: "" + + zigbee2mqtt_remove: + name: "Device da Rimuovere" + initial: "" + +###################################################################### +# Zigbee2mqtt Package - Input boolean +###################################################################### + +input_boolean: + zigbee2mqtt_force_remove: + name: "Zigbee2MQTT: Rimozione Forzata" + initial: false + icon: mdi:alert-remove + +###################################################################### +# Zigbee2mqtt Package - Script +###################################################################### + +script: + ###################################################################### + # Restart Bridge + ###################################################################### + zigbee2mqtt_restart: + alias: "Zigbee2MQTT: Riavvia Bridge" + sequence: + - service: shell_command.zigbee2mqtt_restart + data: + docker_host: !secret docker_host + docker_username: !secret docker_username + icon: mdi:restart + + ###################################################################### + # Rename Device + ###################################################################### + zigbee2mqtt_rename: + alias: "Zigbee2MQTT: Rinomina Device" + sequence: + service: mqtt.publish + data_template: + topic: zigbee2mqtt/bridge/request/device/rename + payload_template: >- + { + "from": "{{ states.input_text.zigbee2mqtt_old_name.state | string }}", + "to": "{{ states.input_text.zigbee2mqtt_new_name.state | string }}" + } + icon: mdi:form-textbox + + ###################################################################### + # Delete Device + ###################################################################### + zigbee2mqtt_remove: + alias: "Zigbee2MQTT: Rimuovi Device" + sequence: + service: mqtt.publish + data_template: + topic: zigbee2mqtt/bridge/request/device/remove + payload_template: >- + { + "id": "{{ states.input_text.zigbee2mqtt_remove.state | string }}", + "force": {% if states.input_boolean.zigbee2mqtt_force_remove.state == "off" %}false{% else %}true{% endif %} + } + icon: mdi:link-variant-remove + +###################################################################### +# Zigbee2mqtt Package - Timer +###################################################################### + +timer: + # Timer for joining time remaining (120 sec = 2 min) + zigbee_permit_join: + name: Tempo rimasto per il join + duration: 120 + +###################################################################### +# Zigbee2mqtt Package - Sensor +###################################################################### + +mqtt: + sensor: + ###################################################################### + # MQTT Sensor for monitoring the bridge state + ###################################################################### + - name: "Zigbee2MQTT: Stato Bridge" + state_topic: "zigbee2mqtt/bridge/state" + icon: mdi:router-wireless + + ###################################################################### + # MQTT Sensor for Showing the Zigbee2MQTT Version + ###################################################################### + - name: "Zigbee2MQTT: Versione Bridge" + state_topic: "zigbee2mqtt/bridge/info" + value_template: "{{ value_json.version }}" + icon: mdi:zigbee + + ###################################################################### + # MQTT Sensor for Showing the Coordinator Type + ###################################################################### + #- name: "Zigbee2MQTT: Tipo Coordinator" + # state_topic: "zigbee2mqtt/bridge/info" + # value_template: "{{ value_json.coordinator.type }}" + # icon: mdi:chip + + ###################################################################### + # MQTT Sensor for Showing the Coordinator Version + ###################################################################### + - name: "Zigbee2MQTT: Versione Coordinator" + state_topic: "zigbee2mqtt/bridge/info" + value_template: "{{ value_json.coordinator.meta.revision }}" + icon: mdi:chip + + ###################################################################### + # MQTT Sensor for monitoring the permit_join state + ###################################################################### + - name: "Zigbee2MQTT: Stato permit join" + state_topic: "zigbee2mqtt/bridge/info" + value_template: "{{ value_json.permit_join }}" + icon: mdi:link-lock + + ###################################################################### + # MQTT Sensor for monitoring the log_level state + ###################################################################### + - name: "Zigbee2MQTT: Stato log level" + state_topic: "zigbee2mqtt/bridge/info" + value_template: "{{ value_json.log_level }}" + icon: mdi:file-document-outline + + ###################################################################### + # MQTT Sensor for Showing the Channel + ###################################################################### + - name: "Zigbee2MQTT: Canale" + state_topic: "zigbee2mqtt/bridge/info" + value_template: "{{ value_json.network.channel }}" + icon: mdi:access-point-network + + ###################################################################### + # MQTT Sensor for Showing the PanID + ###################################################################### + - name: "Zigbee2MQTT: PanID" + state_topic: "zigbee2mqtt/bridge/info" + value_template: "{{ value_json.network.pan_id }}" + icon: mdi:lan + + ###################################################################### + # MQTT Sensor for Showing the Extended PanID + ###################################################################### + #- name: "Zigbee2mqtt: Extended PanID" + # state_topic: "zigbee2mqtt/bridge/info" + # value_template: "{{ value_json.network.extended_pan_id }}" + # icon: mdi:lan + + ###################################################################### + # Zigbee2mqtt Networkmap + ###################################################################### + - name: Zigbee2MQTT Networkmap + state_topic: zigbee2mqtt/bridge/response/networkmap + value_template: >- + {{ now().strftime('%Y-%m-%d %H:%M:%S') }} + json_attributes_topic: zigbee2mqtt/bridge/response/networkmap + json_attributes_template: "{{ value_json.data.value | tojson }}" + + ###################################################################### + # Zigbee2mqtt Package - Switch + ###################################################################### + switch: + # Switch for enabling joining + - name: "Zigbee2MQTT: Abilita join" + state_topic: "zigbee2mqtt/bridge/info" + value_template: '{{ value_json.permit_join | lower }}' + command_topic: "zigbee2mqtt/bridge/request/permit_join" + payload_on: "true" + payload_off: "false" + icon: mdi:link-lock + +###################################################################### +# Zigbee2mqtt Package - Shell Command +###################################################################### + +shell_command: + zigbee2mqtt_restart: 'ssh {{ docker_username }}@{{ docker_host }} -oStrictHostKeyChecking=no -i /config/credentials/id_rsa docker container restart zigbee2mqtt' + +###################################################################### +# Zigbee2mqtt Package - Automation +###################################################################### + +automation: + ###################################################################### + # Automation to change log level + ###################################################################### + - id: zigbee2mqtt_change_log_level + alias: "Zigbee2MQTT: Cambia Log Level" + trigger: + platform: state + entity_id: input_select.zigbee2mqtt_log_level + action: + - service: mqtt.publish + data: + payload_template: "{{ states('input_select.zigbee2mqtt_log_level') }}" + topic: zigbee2mqtt/bridge/request/config/log_level + + ###################################################################### + # Automation to start timer when enable join is turned on + ###################################################################### + - id: zigbee2mqtt_join_enabled + alias: "Zigbee2MQTT: Abilita Join" + trigger: + platform: state + entity_id: switch.zigbee2mqtt_abilita_join + to: "on" + action: + service: timer.start + entity_id: timer.zigbee_permit_join + data_template: + duration: "{{ '00:0%i:00' % (states('input_number.zigbee2mqtt_join_minutes') | int ) }}" + + ###################################################################### + # Automation to stop timer when switch turned off and turn off switch when timer finished + ###################################################################### + - id: zigbee2mqtt_join_disabled + alias: "Zigbee2MQTT: Disabilita Join" + trigger: + - platform: event + event_type: timer.finished + event_data: + entity_id: timer.zigbee_permit_join + - platform: state + entity_id: switch.zigbee2mqtt_abilita_join + to: "off" + action: + - service: timer.cancel + data: + entity_id: timer.zigbee_permit_join + - service: switch.turn_off + entity_id: switch.zigbee2mqtt_abilita_join + + ###################################################################### + # Automation to notify when a device joined zigbee2mqtt network + ###################################################################### + - id: "zigbee2mqtt_notification_on_successfull_interview" + alias: "Zigbee2MQTT: Device aggiunto alla rete Zigbee2mqtt" + trigger: + platform: mqtt + topic: 'zigbee2mqtt/bridge/event' + condition: + condition: template + value_template: '{{trigger.payload_json.type == "device_interview" and trigger.payload_json.data.status == "successful" and trigger.payload_json.data.supported}}' + action: + - service: persistent_notification.create + data_template: + title: "Device aggiunto alla rete Zigbee2mqtt" + message: "Name: {{trigger.payload_json.data.friendly_name}}, + Vendor: {{trigger.payload_json.data.definition.vendor}}, + Model: {{trigger.payload_json.data.definition.model}}, + Description: {{trigger.payload_json.data.definition.description}}" + + ###################################################################### + # Automation to restart zigbee2mqtt to refresh sensor state + ###################################################################### + - id: zigbee2mqtt_startup_automation + alias: "Zigbee2MQTT: Startup Automation" + trigger: + - platform: homeassistant + event: start + action: + - service: script.zigbee2mqtt_restart + + ###################################################################### + # Automation to restart zigbee2mqtt in case of bridge offline for 1m + ###################################################################### + - id: zigbee2mqtt_restart_automation + alias: "Zigbee2MQTT: Restart Automation" + trigger: + - platform: state + entity_id: sensor.zigbee2mqtt_stato_bridge + to: "offline" + for: "00:01:00" + action: + - service: script.zigbee2mqtt_restart + - service: script.notify_text + data: + title: "Restart Zigbee2mqtt" + message: "Zigbee2mqtt bridge offline: force restart" + +###################################################################### +# Zigbee2mqtt Package - Logbook +###################################################################### + +logbook: + exclude: + entities: + - sensor.zigbee2mqtt_stato_bridge + - sensor.zigbee2mqtt_stato_permit_join + - sensor.zigbee2mqtt_stato_log_level + - sensor.zigbee2mqtt_versione_bridge + - sensor.zigbee2mqtt_versione_coordinator + - sensor.zigbee2mqtt_tipo_coordinator + - sensor.zigbee2mqtt_canale + - sensor.zigbee2mqtt_panid + - sensor.zigbee2mqtt_extended_panid + - sensor.zigbee2mqtt_networkmap + - timer.zigbee_permit_join + +###################################################################### +# Zigbee2mqtt Package - Recorder +###################################################################### + +recorder: + exclude: + entities: + - sensor.zigbee2mqtt_stato_bridge + - sensor.zigbee2mqtt_stato_permit_join + - sensor.zigbee2mqtt_stato_log_level + - sensor.zigbee2mqtt_versione_bridge + - sensor.zigbee2mqtt_versione_coordinator + - sensor.zigbee2mqtt_tipo_coordinator + - sensor.zigbee2mqtt_canale + - sensor.zigbee2mqtt_panid + - sensor.zigbee2mqtt_extended_panid + - sensor.zigbee2mqtt_networkmap + - timer.zigbee_permit_join diff --git a/templates/speech_message.yaml b/templates/speech_message.yaml index 2342f535..6b4c67b5 100644 --- a/templates/speech_message.yaml +++ b/templates/speech_message.yaml @@ -1,221 +1,221 @@ -###################################################################### -# Speech Engine Message -###################################################################### - ->- - {# *********************************************** #} - {# ***************** Check Input ***************** #} - {# *********************************************** #} - {% if enable_greeting is not defined %} - {% set enable_greeting=false %} - {% endif %} - {% if enable_status is not defined %} - {% set enable_status=false %} - {% endif %} - {% if enable_consumption is not defined %} - {% set enable_consumption=false %} - {% endif %} - {% if enable_location is not defined %} - {% set enable_location=false %} - {% endif %} - {% if location_people_start is not defined %} - {% set location_people_start=1 %} - {% endif %} - {% if location_people_num is not defined %} - {% set location_people_num=2 %} - {% endif %} - {% if enable_car is not defined %} - {% set enable_car=false %} - {% endif %} - - {# *********************************************** #} - {# ******************** Macro ******************** #} - {# *********************************************** #} - - {# Greeting Message #} - {%- macro greeting() -%} - {% if now().strftime('%H')|int >= 7 and now().strftime('%H')|int < 12 %} - Buongiorno. - {% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %} - Buonpomeriggio. - {% elif now().strftime('%H')|int >= 17 and now().strftime('%H')|int < 23 %} - Buonasera. - {% else %} - Buonanotte. - {% endif %} - {%- endmacro -%} - - {# Time & Date #} - {%- macro time_and_date() -%} - {% set hour = now().strftime('%H') %} - {% set min = now().strftime('%M') %} - {% set day = now().strftime('%d') %} - {% set mounth = now().strftime('%B')|replace('January', 'Gennaio') - |replace('February', 'Febbraio') - |replace('March', 'Marzo') - |replace('April', 'Aprile') - |replace('May', 'Maggio') - |replace('June', 'Giugno') - |replace('July', 'Luglio') - |replace('August', 'Agosto') - |replace('September', 'Settembre') - |replace('October', 'Ottobre') - |replace('November', 'Novembre') - |replace('December', 'Dicembre') %} - {% set year = now().strftime('%Y') %} - Sono le {{ hour }} e {{ min }} del {{ day }} {{ mounth }} {{ year }} - {%- endmacro -%} - - {# Door Status #} - {%- macro status_door() -%} - {% for entity_id in states.group.doors.attributes.entity_id %} - {% set name = state_attr(entity_id, 'friendly_name') %} - {% if is_state(entity_id, 'off') %} - La {{ name }} è chiusa. - {% else %} - La {{ name }} è aperta. - {% endif %} - {%- endfor %} - {%- endmacro -%} - - {# Lights Status #} - {%- macro status_lights() -%} - {% for entity_id in states.group.lights.attributes.entity_id %} - {% set name = state_attr(entity_id, 'friendly_name') %} - {% if is_state(entity_id, 'off') %} - La {{ name }} è spenta. - {% else %} - La {{ name }} è accesa. - {% endif %} - {%- endfor %} - {%- endmacro -%} - - {# Covers Status #} - {%- macro status_covers() -%} - {% for entity_id in states.group.covers.attributes.entity_id %} - {% set name = state_attr(entity_id, 'friendly_name') %} - {% set perc = state_attr(entity_id, 'current_position') %} - {% if perc | int < 25 %} - La {{ name }} è chiusa. - {% else %} - La {{ name }} è aperta al {{ perc }} percento. - {% endif %} - {%- endfor %} - {%- endmacro -%} - - {# Temperature Status #} - {%- macro status_temperature() -%} - {% for entity_id in states.group.temperature.attributes.entity_id %} - {% set name = state_attr(entity_id, 'friendly_name') %} - {% set temp = states(entity_id) %} - La {{ name }} è {{ temp }} gradi. - {%- endfor %} - {%- endmacro -%} - - {# Consumption Status #} - {%- macro status_consumption() -%} - "Il consumo istantaneo è pari a {{ states.sensor.shelly_em_channel_1_power.state }} watt" - {%- endmacro -%} - - {# Location Status #} - {%- macro status_location(start, num) -%} - {% for entity_id in states.group.people.attributes.entity_id %} - {% set name = state_attr(entity_id, 'friendly_name') %} - {% if is_state(entity_id, 'not_home') %} - {% set source = state_attr(entity_id, 'source') %} - {% set position = state_attr(source, 'address')|replace('Province of', 'Provincia di') %} - {% elif is_state(entity_id, 'home') %} - {% set position = "casa" %} - {% else %} - {% set position = states(entity_id) %} - {% endif %} - - {% if (loop.index >= start|int) and (loop.index < num|int+start|int) %} - La posizione di {{ name }} è {{ position }}. - {% endif %} - {%- endfor %} - {%- endmacro -%} - - {# Car Status #} - {%- macro status_car() -%} - {% if is_state('device_tracker.ff590mr_device_tracker', 'home') %} - {% set car_position = "in garage" %} - {% else %} - {% set car_position = "fuori" %} - {% endif %} - {% if is_state('binary_sensor.ff590mr_locked', 'off') %} - {% set car_lock = "chiusa" %} - {% else %} - {% set car_lock = "aperta" %} - {% endif %} - {% if is_state('binary_sensor.ff590mr_windows_closed_2', 'off') %} - {% set car_windows = "chiusi" %} - {% else %} - {% set car_windows = "aperti" %} - {% endif %} - La Mercedes si trova {{ car_position }}. è {{ car_lock }} con i finestrini {{ car_windows }}. - Il livello del carburante è {{ states('sensor.ff590mr_fuel_level') }} percento. - {% if is_state('binary_sensor.ff590mr_low_brake_fluid_warning', 'on') or - is_state('binary_sensor.ff590mr_low_coolant_level_warning', 'on') or - is_state('binary_sensor.ff590mr_low_wash_water_warning', 'on') or - is_state('binary_sensor.ff590mr_tire_warning', 'on') %} - Sono inoltre presenti allarmi. - {% endif %} - {%- endmacro -%} - - {# End Message #} - {%- macro end_message() -%} - {% if enable_status == true %} - {{ [ - "Spero che il report ti abbia soddisfatto!", - "Il report è concluso.", - "Alla prossima!", - "Buon proseguimento!", - "Non ho altro da comunicare." - ] | random }} - {% endif %} - {%- endmacro -%} - - {# *********************************************** #} - {# ******************* Message ******************* #} - {# *********************************************** #} - - {# Greeting Message #} - {% if enable_greeting == true %} - {{ greeting() }} - {% endif %} - - {# Home Status #} - {% if enable_status == true %} - - {{ time_and_date() }} - - {{ status_door() }} - - {{ status_lights() }} - - {{ status_covers() }} - - {{ status_temperature() }} - - {% endif %} - - {% if (enable_status == true) or (enable_consumption == true) %} - {{ status_consumption() }} - {% endif %} - - {# Location Status #} - {% if (enable_status == true) or (enable_location == true) %} - {{ status_location(location_people_start, location_people_num) }} - {% endif %} - - {# Car Status #} - {% if (enable_status == true) or (enable_car == true) %} - {{ status_car() }} - {% endif %} - - {# generic message #} - {{ message }} - - {# end message #} - {{ end_message() }} +###################################################################### +# Speech Engine Message +###################################################################### + +>- + {# *********************************************** #} + {# ***************** Check Input ***************** #} + {# *********************************************** #} + {% if enable_greeting is not defined %} + {% set enable_greeting=false %} + {% endif %} + {% if enable_status is not defined %} + {% set enable_status=false %} + {% endif %} + {% if enable_consumption is not defined %} + {% set enable_consumption=false %} + {% endif %} + {% if enable_location is not defined %} + {% set enable_location=false %} + {% endif %} + {% if location_people_start is not defined %} + {% set location_people_start=1 %} + {% endif %} + {% if location_people_num is not defined %} + {% set location_people_num=2 %} + {% endif %} + {% if enable_car is not defined %} + {% set enable_car=false %} + {% endif %} + + {# *********************************************** #} + {# ******************** Macro ******************** #} + {# *********************************************** #} + + {# Greeting Message #} + {%- macro greeting() -%} + {% if now().strftime('%H')|int >= 7 and now().strftime('%H')|int < 12 %} + Buongiorno. + {% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %} + Buonpomeriggio. + {% elif now().strftime('%H')|int >= 17 and now().strftime('%H')|int < 23 %} + Buonasera. + {% else %} + Buonanotte. + {% endif %} + {%- endmacro -%} + + {# Time & Date #} + {%- macro time_and_date() -%} + {% set hour = now().strftime('%H') %} + {% set min = now().strftime('%M') %} + {% set day = now().strftime('%d') %} + {% set mounth = now().strftime('%B')|replace('January', 'Gennaio') + |replace('February', 'Febbraio') + |replace('March', 'Marzo') + |replace('April', 'Aprile') + |replace('May', 'Maggio') + |replace('June', 'Giugno') + |replace('July', 'Luglio') + |replace('August', 'Agosto') + |replace('September', 'Settembre') + |replace('October', 'Ottobre') + |replace('November', 'Novembre') + |replace('December', 'Dicembre') %} + {% set year = now().strftime('%Y') %} + Sono le {{ hour }} e {{ min }} del {{ day }} {{ mounth }} {{ year }} + {%- endmacro -%} + + {# Door Status #} + {%- macro status_door() -%} + {% for entity_id in states.group.doors.attributes.entity_id %} + {% set name = state_attr(entity_id, 'friendly_name') %} + {% if is_state(entity_id, 'off') %} + La {{ name }} è chiusa. + {% else %} + La {{ name }} è aperta. + {% endif %} + {%- endfor %} + {%- endmacro -%} + + {# Lights Status #} + {%- macro status_lights() -%} + {% for entity_id in states.group.lights.attributes.entity_id %} + {% set name = state_attr(entity_id, 'friendly_name') %} + {% if is_state(entity_id, 'off') %} + La {{ name }} è spenta. + {% else %} + La {{ name }} è accesa. + {% endif %} + {%- endfor %} + {%- endmacro -%} + + {# Covers Status #} + {%- macro status_covers() -%} + {% for entity_id in states.group.covers.attributes.entity_id %} + {% set name = state_attr(entity_id, 'friendly_name') %} + {% set perc = state_attr(entity_id, 'current_position') %} + {% if perc | int < 25 %} + La {{ name }} è chiusa. + {% else %} + La {{ name }} è aperta al {{ perc }} percento. + {% endif %} + {%- endfor %} + {%- endmacro -%} + + {# Temperature Status #} + {%- macro status_temperature() -%} + {% for entity_id in states.group.temperature.attributes.entity_id %} + {% set name = state_attr(entity_id, 'friendly_name') %} + {% set temp = states(entity_id) %} + La {{ name }} è {{ temp }} gradi. + {%- endfor %} + {%- endmacro -%} + + {# Consumption Status #} + {%- macro status_consumption() -%} + "Il consumo istantaneo è pari a {{ states.sensor.shelly_em_channel_1_power.state }} watt" + {%- endmacro -%} + + {# Location Status #} + {%- macro status_location(start, num) -%} + {% for entity_id in states.group.people.attributes.entity_id %} + {% set name = state_attr(entity_id, 'friendly_name') %} + {% if is_state(entity_id, 'not_home') %} + {% set source = state_attr(entity_id, 'source') %} + {% set position = state_attr(source, 'address')|replace('Province of', 'Provincia di') %} + {% elif is_state(entity_id, 'home') %} + {% set position = "casa" %} + {% else %} + {% set position = states(entity_id) %} + {% endif %} + + {% if (loop.index >= start|int) and (loop.index < num|int+start|int) %} + La posizione di {{ name }} è {{ position }}. + {% endif %} + {%- endfor %} + {%- endmacro -%} + + {# Car Status #} + {%- macro status_car() -%} + {% if is_state('device_tracker.ff590mr_device_tracker', 'home') %} + {% set car_position = "in garage" %} + {% else %} + {% set car_position = "fuori" %} + {% endif %} + {% if is_state('binary_sensor.ff590mr_locked', 'off') %} + {% set car_lock = "chiusa" %} + {% else %} + {% set car_lock = "aperta" %} + {% endif %} + {% if is_state('binary_sensor.ff590mr_windows_closed_2', 'off') %} + {% set car_windows = "chiusi" %} + {% else %} + {% set car_windows = "aperti" %} + {% endif %} + La Mercedes si trova {{ car_position }}. è {{ car_lock }} con i finestrini {{ car_windows }}. + Il livello del carburante è {{ states('sensor.ff590mr_fuel_level') }} percento. + {% if is_state('binary_sensor.ff590mr_low_brake_fluid_warning', 'on') or + is_state('binary_sensor.ff590mr_low_coolant_level_warning', 'on') or + is_state('binary_sensor.ff590mr_low_wash_water_warning', 'on') or + is_state('binary_sensor.ff590mr_tire_warning', 'on') %} + Sono inoltre presenti allarmi. + {% endif %} + {%- endmacro -%} + + {# End Message #} + {%- macro end_message() -%} + {% if enable_status == true %} + {{ [ + "Spero che il report ti abbia soddisfatto!", + "Il report è concluso.", + "Alla prossima!", + "Buon proseguimento!", + "Non ho altro da comunicare." + ] | random }} + {% endif %} + {%- endmacro -%} + + {# *********************************************** #} + {# ******************* Message ******************* #} + {# *********************************************** #} + + {# Greeting Message #} + {% if enable_greeting == true %} + {{ greeting() }} + {% endif %} + + {# Home Status #} + {% if enable_status == true %} + + {{ time_and_date() }} + + {{ status_door() }} + + {{ status_lights() }} + + {{ status_covers() }} + + {{ status_temperature() }} + + {% endif %} + + {% if (enable_status == true) or (enable_consumption == true) %} + {{ status_consumption() }} + {% endif %} + + {# Location Status #} + {% if (enable_status == true) or (enable_location == true) %} + {{ status_location(location_people_start, location_people_num) }} + {% endif %} + + {# Car Status #} + {% if (enable_status == true) or (enable_car == true) %} + {{ status_car() }} + {% endif %} + + {# generic message #} + {{ message }} + + {# end message #} + {{ end_message() }} diff --git a/templates/welcome_message.yaml b/templates/welcome_message.yaml index b8a80f90..447e5c38 100644 --- a/templates/welcome_message.yaml +++ b/templates/welcome_message.yaml @@ -1,26 +1,26 @@ -###################################################################### -# Speech Engine Message -###################################################################### - ->- - {% set name = state_attr(trigger.entity_id, 'friendly_name') %} - {%- macro greeting_sentence(name) -%} - {{ [ - "Ciao " ~ name + " è un piacere rivederti a casa", - "Finalmente a casa " ~ name + "!", - "Indovina chi è a casa? " ~ name + "!", - name + " è ora a casa!", - "Che bello! " ~ name + " è a casa", - name + " sei a casa!", - "Il sistema di domotica Casa Ravera-Testa notifica che " ~ name + " è a casa!", - "Annuncio: " ~ name + " è ora a casa!", - "Rilevo una presenza! " ~ name + " è a casa!", - "Ciao " ~ name + " che la forza sia con te", - "Sento un tremito nella forza! " ~ name + " è a casa", - "Sento un interferenza nella Forza! " ~ name + " è qui", - "Menomale che sei qui " ~ name + "! Mi sentivo solo", - "Menomale che sei qui " ~ name + "! La casa è vuota senza di te!", - "Ciao " ~ name + "! Casa è sempre la casa!" - ] | random }} - {%- endmacro -%} - {{ greeting_sentence(name) }} +###################################################################### +# Speech Engine Message +###################################################################### + +>- + {% set name = state_attr(trigger.entity_id, 'friendly_name') %} + {%- macro greeting_sentence(name) -%} + {{ [ + "Ciao " ~ name + " è un piacere rivederti a casa", + "Finalmente a casa " ~ name + "!", + "Indovina chi è a casa? " ~ name + "!", + name + " è ora a casa!", + "Che bello! " ~ name + " è a casa", + name + " sei a casa!", + "Il sistema di domotica Casa Ravera-Testa notifica che " ~ name + " è a casa!", + "Annuncio: " ~ name + " è ora a casa!", + "Rilevo una presenza! " ~ name + " è a casa!", + "Ciao " ~ name + " che la forza sia con te", + "Sento un tremito nella forza! " ~ name + " è a casa", + "Sento un interferenza nella Forza! " ~ name + " è qui", + "Menomale che sei qui " ~ name + "! Mi sentivo solo", + "Menomale che sei qui " ~ name + "! La casa è vuota senza di te!", + "Ciao " ~ name + "! Casa è sempre la casa!" + ] | random }} + {%- endmacro -%} + {{ greeting_sentence(name) }} -- 2.47.3