+++ /dev/null
-######################################################################
-# Away Mode: Enable Action
-######################################################################
-
-- alias: "Modalità Vacanza: Azione on"
- initial_state: 'on'
-
- trigger:
- - platform: state
- entity_id: input_boolean.home_mode_away
- to: 'on'
-
- action:
- - service: script.notify_voice
- data_template:
- message: "Modalità vacanza abilitata"
-
-######################################################################
-# Away Mode: Disable Action
-######################################################################
-
-- alias: "Modalità Vacanza: Azione off"
- initial_state: 'on'
-
- trigger:
- # Manual Disable
- - platform: state
- entity_id: input_boolean.home_mode_away
- to: 'off'
- # Back home
- - platform: state
- entity_id: group.residents
- to: 'home'
- # End of Away Period
- - platform: template
- value_template: "{{ states('sensor.time_date') == (state_attr('input_datetime.away_mode_end', 'timestamp') | int | timestamp_custom('%H:%M, %Y-%m-%d', true)) }}"
-
- action:
- - service: script.notify_voice
- data_template:
- message: "Modalità vacanza disabilitata"
- - service: input_boolean.turn_off
- data:
- entity_id: input_boolean.home_mode_away
+++ /dev/null
-######################################################################
-# Climate: Weekly Schedule
-# - script.climate_daily_schedule
-######################################################################
-
-- alias: "Termosifoni: Schedulazione giornaliera feriale"
- initial_state: 'off'
-
- trigger:
- - platform: time
- at: '06:30:00'
- - platform: time
- at: '07:30:00'
- - platform: time
- at: '09:00:00'
- - platform: time
- at: '18:30:00'
- - platform: time
- at: '22:00:00'
-# - platform: state
-# entity_id: input_boolean.home_mode_away
-# to: 'off'
-
- condition:
- condition: and
- conditions:
- - condition: state
- entity_id: input_boolean.home_mode_away
- state: 'off'
-
- - condition: time
- weekday: [mon, tue, wed, thu, fri]
-
- action:
- - service: script.climate_daily_schedule
- data_template:
- entity_id: climate.cucina_termostato_cucina
- temp1: 20
- temp2: 18
- temp3: 20
- temp4: 20.5
- temp5: 16
-
- - service: script.climate_daily_schedule
- data_template:
- entity_id: climate.sala_termostato_sala
- temp1: 18
- temp2: 18
- temp3: 19.5
- temp4: 20
- temp5: 16
-
- - service: script.climate_daily_schedule
- data_template:
- entity_id: climate.bagno_termostato_bagno
- temp1: 19
- temp2: 18
- temp3: 19
- temp4: 19.5
- temp5: 16
-
- - service: script.climate_daily_schedule
- data_template:
- entity_id: climate.studio_termostato_studio
- temp1: 18
- temp2: 18
- temp3: 19.5
- temp4: 20
- temp5: 16
-
- - service: script.climate_daily_schedule
- data_template:
- entity_id: climate.camera_termostato_camera
- temp1: 19
- temp2: 18
- temp3: 19
- temp4: 19.5
- temp5: 16
-
-######################################################################
-# Climate: Away Mode
-# - climate.set_operation_mode
-# - climate.set_temperature
-######################################################################
-
-- alias: "Termosifoni: Modalità vacanza"
- initial_state: 'off'
-
- trigger:
- - platform: state
- entity_id: input_boolean.home_mode_away
- to: 'on'
- - platform: state
- entity_id: input_boolean.home_mode_away
- to: 'off'
-
- condition: []
-
- action:
- - service: script.climate_away_mode
- data_template:
- entity_id: climate.cucina_termostato_cucina
-
- - service: script.climate_away_mode
- data_template:
- entity_id: climate.sala_termostato_sala
- mode: trigger.to_state.state
-
- - service: script.climate_away_mode
- data_template:
- entity_id: climate.bagno_termostato_bagno
- mode: trigger.to_state.state
-
- - service: script.climate_away_mode
- data_template:
- entity_id: climate.studio_termostato_studio
- mode: trigger.to_state.state
-
- - service: script.climate_away_mode
- data_template:
- entity_id: climate.camera_termostato_camera
- mode: trigger.to_state.state
+++ /dev/null
-######################################################################
-# Wake Up Giorgio
-# - Every working day it opens Studio Cover
-######################################################################
-
-- alias: "Risveglio Giorgio"
- #initial_state: 'on'
-
- trigger:
- - platform: time
- at: '07:00:00'
-
- condition:
- condition: and
- conditions:
- - condition: state
- entity_id: input_boolean.home_mode_away
- state: 'off'
-
- - condition: time
- weekday: [mon, tue, wed, thu, fri]
-
- action:
- - service: cover.set_cover_position
- data:
- entity_id:
- - cover.tapparella_cucina
-# - cover.tapparella_sala
- - cover.tapparella_studio
- position: 85
+++ /dev/null
-######################################################################
-# Home Door: Switch on Lights
-#
-# Actions:
-# - light.turn_on
-# - delay
-#
-# Note: delay is necessary to avoid multiple opening in 5 minutes
-######################################################################
-
-- alias: "Porta Casa: Accendi Luce Corridoio"
- initial_state: 'on'
-
- trigger:
- - platform: state
- entity_id: binary_sensor.porta_casa
- to: 'on'
-
- condition:
- - condition: numeric_state
- entity_id: sun.sun
- value_template: "{{ state_attr('sun.sun', 'elevation') }}"
- below: -10
-
- action:
- - delay: 00:00:01
- - service: light.turn_on
- entity_id: light.luce_corridoio
- - delay: '00:05:00'
+++ /dev/null
-######################################################################
-# Energy: Power Consumption Notifications
-######################################################################
-
-- alias: "Allarme Consumo Energetico"
- initial_state: 'on'
-
- trigger:
- - platform: numeric_state
- entity_id: sensor.potenza_istantanea
- above: 2950
-
- action:
- service: script.notify_all
- data_template:
- title: "Home Assistant - Allarme Consumo Energetico"
- message: "Consumo energetico elevato ({{ states.sensor.potenza_istantanea.state }})."
- enable_persistent: 0
- volume_level: 0.4
+++ /dev/null
-######################################################################
-# Home Assistant: Management of the Home Mode Button
-######################################################################
-
-- alias: "Home Assistant: Cambio modalità On"
- initial_state: 'on'
-
- trigger:
- platform: state
- entity_id: input_boolean.home_mode_day,
- input_boolean.home_mode_night,
- input_boolean.home_mode_away
- to: 'on'
-
- action:
- - service: input_boolean.turn_off
- data_template:
- entity_id: >
- {% set booleans = [ 'input_boolean.home_mode_day', 'input_boolean.home_mode_night', 'input_boolean.home_mode_away' ] | reject('equalto', trigger.entity_id) %}
- {{ booleans | list | join(', ') }}
-
-- alias: "Home Assistant: Cambio modalità Off"
- initial_state: 'on'
-
- trigger:
- platform: state
- entity_id: input_boolean.home_mode_day,
- input_boolean.home_mode_night,
- input_boolean.home_mode_away
- to: 'off'
-
- condition:
- condition: and
- conditions:
- - condition: state
- entity_id: input_boolean.home_mode_day
- state: 'off'
- - condition: state
- entity_id: input_boolean.home_mode_night
- state: 'off'
- - condition: state
- entity_id: input_boolean.home_mode_away
- state: 'off'
-
- action:
- - service: input_boolean.turn_on
- data_template:
- entity_id: >
- {% if now().strftime('%H')|int >= 8 and now().strftime('%H')|int < 23 %}
- input_boolean.home_mode_day
- {% else %}
- input_boolean.home_mode_night
- {% endif %}
-
-######################################################################
-# Home Assistant: Management of Day/Night Mode
-######################################################################
-
-- alias: "Home Assistant: Modalità Giorno/Notte"
- initial_state: 'on'
-
- trigger:
- - platform: time
- at: '08:00:00'
- - platform: time
- at: '23:00:00'
- - platform: homeassistant
- event: start
-
- condition:
- condition: state
- entity_id: input_boolean.home_mode_away
- state: 'off'
-
- action:
- - service: input_boolean.turn_on
- data_template:
- entity_id: >-
- {% if now().strftime('%H')|int >= 8 and now().strftime('%H')|int < 23 %}
- input_boolean.home_mode_day
- {% else %}
- input_boolean.home_mode_night
- {% endif %}
-
- - service: script.volume_manager
-
-######################################################################
-# Home Assistant: Management of Speech Notifications
-######################################################################
-
-- alias: "Home Assistant: Gestione notifiche vocali"
- initial_state: 'on'
-
- trigger:
- - platform: state
- entity_id: input_boolean.home_mode_night
- to: 'on'
- - platform: state
- entity_id: input_boolean.home_mode_night
- to: 'off'
-
- action:
- - service_template: >-
- {% if trigger.to_state.state == 'on' %}
- input_boolean.turn_off
- {% else %}
- input_boolean.turn_on
- {% endif %}
- data:
- entity_id: input_boolean.speech_notifications
-
-######################################################################
-# Home Assistant: Weekly Clean Log
-# - script.homeassistant_clearlog
-######################################################################
-
-- alias: "Home Assistant: Pulitura settimanale log"
- initial_state: 'on'
-
- trigger:
- - platform: time
- at: '00:00:00'
-
- condition:
- - condition: time
- weekday: [mon]
-
- action:
- - service: script.homeassistant_clearlog
+++ /dev/null
-######################################################################
-# Google Home: speeak message
-# - script.notify_voice
-######################################################################
-
-- alias: "Google Home: Pronuncia testo"
- initial_state: 'on'
-
- trigger:
- - platform: state
- entity_id: input_text.google_home_speak
-
- condition: []
-
- action:
- - service: script.speech_engine
- data_template:
- media_player: "media_player.google_home"
- message: "{{ trigger.to_state.state }}"
+++ /dev/null
-######################################################################
-# Night Time
-# - Switch off all covers
-######################################################################
-
-- alias: "Modalità Notte"
- initial_state: 'off'
-
- trigger:
- - platform: state
- entity_id: input_boolean.home_mode_night
- to: 'on'
-
- condition: []
-# condition: state
-# entity_id: input_boolean.home_mode_away
-# state: 'off'
-
- action:
- - service: cover.set_cover_position
- data:
- entity_id: cover.tapparella_globale
- position: 15
-
- - service: cover.set_cover_position
- data:
- entity_id: cover.tapparella_camera
- position: 0
+++ /dev/null
-######################################################################
-# Welcome message
-#
-# Operations:
-# - script.speech_engine
-######################################################################
-
-- alias: Saluto di benvenuto
- initial_state: 'on'
-
- trigger:
- - platform: zone
- entity_id:
- - person.giorgio
- - person.laura
- # - person.anna
- zone: zone.home
- event: enter
-# - platform: state
-# entity_id:
-# - device_tracker.s9
-# - device_tracker.a5
-# to: 'home'
-# for: '00:00:30'
-
- condition: []
-
- action:
-# - wait_template: >-
-# {# Giorgio #}
-# {% if trigger.entity_id == 'person.giorgio' %}
-# {% if is_state('device_tracker.s9', 'home') %}
-# true
-# {% else %}
-# false
-# {% endif %}
-#
-# {# Laura #}
-# {% elif trigger.entity_id == 'person.laura' %}
-# {% if is_state('device_tracker.a5', 'home') %}
-# true
-# {% else %}
-# false
-# {% endif %}
-#
-# {# Anna #}
-# {% elif trigger.entity_id == 'person.anna' %}
-# {% if is_state('device_tracker.a3', 'home') %}
-# true
-# {% else %}
-# false
-# {% endif %}
-#
-# {# Others #}
-# {% else %}
-# false
-# {% endif %}
-#
-# timeout: '00:30:00'
-# continue_on_timeout: 'false'
-
- - wait_template: "{{ is_state('binary_sensor.porta_casa', 'on') }}"
- timeout: '00:30:00'
- continue_on_timeout: 'false'
-
- - delay: 00:00:05
-
- - service: script.speech_engine
- data_template:
- message: !include ../templates/welcome_message.yaml
- enable_greeting: 0
-
-######################################################################
-# Hourly message
-#
-# Operations:
-# - script.speech_engine
-######################################################################
-
-- alias: "Saluto orario"
- initial_state: 'off'
-
- trigger:
- - platform: time
- at: '12:00:00'
-
- condition: []
-
- action:
- - service: script.speech_engine
- data_template:
- message: >-
- {% set hour = now().strftime('%H') %}
- "Sono le {{ hour }} e tutto va bene."
+++ /dev/null
-######################################################################\r
-# Startup Automation: Restart on Error\r
-######################################################################\r
-\r
-- alias: "Startup: Restart on Error"\r
-\r
- trigger:\r
- - platform: homeassistant\r
- event: start\r
- \r
- action:\r
- - delay: 00:00:60\r
- - condition: state\r
- entity_id: persistent_notification.invalid_config\r
- state: 'notifying'\r
- - service: script.homeassistant_restart\r
-\r
-######################################################################\r
-# Startup Automation: Google Sync\r
-######################################################################\r
-\r
-- alias: "Startup: Google Sync"\r
-\r
- trigger:\r
- - platform: homeassistant\r
- event: start\r
-\r
- action:\r
- - service: script.homeassistant_google_home_sync\r
+++ /dev/null
-######################################################################
-# Test Mode: Enable Action
-######################################################################
-
-- alias: "Modalità Test: Azione on"
- initial_state: 'on'
-
- trigger:
- - platform: state
- entity_id: input_boolean.test_mode
- to: 'on'
-
- action:\r
-
- - service: automation.turn_off
- entity_id: automation.startup_restart_on_error
-
- - service: automation.turn_off
- entity_id: automation.startup_google_sync
-
-######################################################################
-# Test Mode: Disable Action
-######################################################################
-
-- alias: "Modalità Test: Azione off"
- initial_state: 'on'
-
- trigger:
- - platform: state
- entity_id: input_boolean.test_mode
- to: 'off'
-
- action:
- - service: automation.turn_on
- entity_id: automation.startup_restart_on_error
-
- - service: automation.turn_on
- entity_id: automation.startup_google_sync
+++ /dev/null
-######################################################################
-# Themes: Management of Day/Night Mode
-######################################################################
-
-- alias: "Temi: Modalità giorno/Notte"
- initial_state: 'on'
-
- trigger:
- - platform: state
- entity_id: input_boolean.home_mode_day
- to: 'on'
- - platform: state
- entity_id: input_boolean.home_mode_night
- to: 'on'
- - platform: state
- entity_id: input_boolean.home_mode_away
- to: 'on'
-
- action:
- - service: frontend.set_theme
- data_template:
- name: >-
- {% if trigger.entity_id == 'input_boolean.home_mode_day' %}
- default
- {% endif %}
- {% if trigger.entity_id == 'input_boolean.home_mode_night' %}
- darkish
- {% endif %}
- {% if trigger.entity_id == 'input_boolean.home_mode_away' %}
- reeder_dark
- {% endif %}
+++ /dev/null
-######################################################################\r
-# Update Notification: Home Assistant\r
-######################################################################\r
-\r
-- alias: "Update Notification: Home Assistant"\r
- initial_state: 'on'\r
-\r
- trigger:\r
- - platform: state\r
- entity_id: binary_sensor.updater\r
- to: 'on'\r
-\r
- - platform: homeassistant\r
- event: start\r
-\r
- condition:\r
- condition: state\r
- entity_id: binary_sensor.updater\r
- state: 'on'\r
-\r
- action:\r
- - delay: '00:00:5'\r
- - service: script.notify_text\r
- data_template:\r
- title: "Home Assistant - Aggiornamento"\r
- message: "E' disponibile un aggiornamento per Home Assistant {{ state_attr('binary_sensor.updater', 'newest_version') }}. {{now().strftime('%Y-%m-%d %I:%M %p')}}"\r
- notification_id: "update"\r
- enable_persistent: 1\r
- \r
- - service: input_boolean.turn_on\r
- entity_id: input_boolean.update\r
-\r
-######################################################################\r
-# Update Notification: Shelly\r
-######################################################################\r
-\r
-- alias: "Update Notification: Shelly"\r
- initial_state: 'on'\r
-\r
- trigger:\r
- - platform: state\r
- entity_id: group.shelly\r
- to: 'on'\r
- \r
- - platform: homeassistant\r
- event: start\r
- \r
- condition:\r
- condition: state\r
- entity_id: group.shelly\r
- state: 'on'\r
-\r
- action:\r
- - delay: '00:00:10'\r
- - service: script.notify_text\r
- data_template:\r
- title: "Shelly - Aggiornamento"\r
- message: "Sono disponibili aggiornamenti per i dispositivi Shelly"\r
- notification_id: "update"\r
- enable_persistent: 1\r
-\r
- - service: input_boolean.turn_on\r
- entity_id: input_boolean.update\r
-\r
-######################################################################\r
-# Update Notification: HACS\r
-######################################################################\r
-\r
-- alias: "Update Notification: HACS"\r
- initial_state: 'on'\r
-\r
- trigger:\r
- - platform: numeric_state\r
- entity_id: sensor.hacs\r
- above: 0\r
-\r
- action:\r
- - delay: '00:00:15'\r
- - service: script.notify_text\r
- data_template:\r
- title: "HACS - Aggiornamento"\r
- message: "Sono disponibili aggiornamenti per i moduli HACS"\r
- notification_id: "update"\r
- enable_persistent: 1\r
-\r
- - service: input_boolean.turn_on\r
- entity_id: input_boolean.update\r
-\r
-######################################################################\r
-# Update: Aknowledge update\r
-#\r
-# Actions:\r
-# - persistent_notification.dismiss\r
-######################################################################\r
-- alias: "Update: Riconoscimento Aggiornamenti"\r
- initial_state: 'on'\r
-\r
- trigger:\r
- platform: state\r
- entity_id: input_boolean.update\r
- to: 'off'\r
-\r
- action:\r
- - service: persistent_notification.dismiss\r
- data_template:\r
- notification_id: "update"\r
--- /dev/null
+######################################################################
+# Away Mode: Enable Action
+######################################################################
+
+- alias: "Modalità Vacanza: Azione on"
+ initial_state: 'on'
+
+ trigger:
+ - platform: state
+ entity_id: input_boolean.home_mode_away
+ to: 'on'
+
+ action:
+ - service: script.notify_voice
+ data_template:
+ message: "Modalità vacanza abilitata"
+
+######################################################################
+# Away Mode: Disable Action
+######################################################################
+
+- alias: "Modalità Vacanza: Azione off"
+ initial_state: 'on'
+
+ trigger:
+ # Manual Disable
+ - platform: state
+ entity_id: input_boolean.home_mode_away
+ to: 'off'
+ # Back home
+ - platform: state
+ entity_id: group.residents
+ to: 'home'
+ # End of Away Period
+ - platform: template
+ value_template: "{{ states('sensor.time_date') == (state_attr('input_datetime.away_mode_end', 'timestamp') | int | timestamp_custom('%H:%M, %Y-%m-%d', true)) }}"
+
+ action:
+ - service: script.notify_voice
+ data_template:
+ message: "Modalità vacanza disabilitata"
+ - service: input_boolean.turn_off
+ data:
+ entity_id: input_boolean.home_mode_away
--- /dev/null
+######################################################################
+# Climate: Weekly Schedule
+# - script.climate_daily_schedule
+######################################################################
+
+- alias: "Termosifoni: Schedulazione giornaliera feriale"
+ initial_state: 'off'
+
+ trigger:
+ - platform: time
+ at: '06:30:00'
+ - platform: time
+ at: '07:30:00'
+ - platform: time
+ at: '09:00:00'
+ - platform: time
+ at: '18:30:00'
+ - platform: time
+ at: '22:00:00'
+# - platform: state
+# entity_id: input_boolean.home_mode_away
+# to: 'off'
+
+ condition:
+ condition: and
+ conditions:
+ - condition: state
+ entity_id: input_boolean.home_mode_away
+ state: 'off'
+
+ - condition: time
+ weekday: [mon, tue, wed, thu, fri]
+
+ action:
+ - service: script.climate_daily_schedule
+ data_template:
+ entity_id: climate.cucina_termostato_cucina
+ temp1: 20
+ temp2: 18
+ temp3: 20
+ temp4: 20.5
+ temp5: 16
+
+ - service: script.climate_daily_schedule
+ data_template:
+ entity_id: climate.sala_termostato_sala
+ temp1: 18
+ temp2: 18
+ temp3: 19.5
+ temp4: 20
+ temp5: 16
+
+ - service: script.climate_daily_schedule
+ data_template:
+ entity_id: climate.bagno_termostato_bagno
+ temp1: 19
+ temp2: 18
+ temp3: 19
+ temp4: 19.5
+ temp5: 16
+
+ - service: script.climate_daily_schedule
+ data_template:
+ entity_id: climate.studio_termostato_studio
+ temp1: 18
+ temp2: 18
+ temp3: 19.5
+ temp4: 20
+ temp5: 16
+
+ - service: script.climate_daily_schedule
+ data_template:
+ entity_id: climate.camera_termostato_camera
+ temp1: 19
+ temp2: 18
+ temp3: 19
+ temp4: 19.5
+ temp5: 16
+
+######################################################################
+# Climate: Away Mode
+# - climate.set_operation_mode
+# - climate.set_temperature
+######################################################################
+
+- alias: "Termosifoni: Modalità vacanza"
+ initial_state: 'off'
+
+ trigger:
+ - platform: state
+ entity_id: input_boolean.home_mode_away
+ to: 'on'
+ - platform: state
+ entity_id: input_boolean.home_mode_away
+ to: 'off'
+
+ condition: []
+
+ action:
+ - service: script.climate_away_mode
+ data_template:
+ entity_id: climate.cucina_termostato_cucina
+
+ - service: script.climate_away_mode
+ data_template:
+ entity_id: climate.sala_termostato_sala
+ mode: trigger.to_state.state
+
+ - service: script.climate_away_mode
+ data_template:
+ entity_id: climate.bagno_termostato_bagno
+ mode: trigger.to_state.state
+
+ - service: script.climate_away_mode
+ data_template:
+ entity_id: climate.studio_termostato_studio
+ mode: trigger.to_state.state
+
+ - service: script.climate_away_mode
+ data_template:
+ entity_id: climate.camera_termostato_camera
+ mode: trigger.to_state.state
--- /dev/null
+######################################################################
+# Wake Up Giorgio
+# - Every working day it opens Studio Cover
+######################################################################
+
+- alias: "Risveglio Giorgio"
+ #initial_state: 'on'
+
+ trigger:
+ - platform: time
+ at: '07:00:00'
+
+ condition:
+ condition: and
+ conditions:
+ - condition: state
+ entity_id: input_boolean.home_mode_away
+ state: 'off'
+
+ - condition: time
+ weekday: [mon, tue, wed, thu, fri]
+
+ action:
+ - service: cover.set_cover_position
+ data:
+ entity_id:
+ - cover.tapparella_cucina
+# - cover.tapparella_sala
+ - cover.tapparella_studio
+ position: 85
--- /dev/null
+######################################################################
+# Home Door: Switch on Lights
+#
+# Actions:
+# - light.turn_on
+# - delay
+#
+# Note: delay is necessary to avoid multiple opening in 5 minutes
+######################################################################
+
+- alias: "Porta Casa: Accendi Luce Corridoio"
+ initial_state: 'on'
+
+ trigger:
+ - platform: state
+ entity_id: binary_sensor.porta_casa
+ to: 'on'
+
+ condition:
+ - condition: numeric_state
+ entity_id: sun.sun
+ value_template: "{{ state_attr('sun.sun', 'elevation') }}"
+ below: -10
+
+ action:
+ - delay: 00:00:01
+ - service: light.turn_on
+ entity_id: light.luce_corridoio
+ - delay: '00:05:00'
--- /dev/null
+######################################################################
+# Energy: Power Consumption Notifications
+######################################################################
+
+- alias: "Allarme Consumo Energetico"
+ initial_state: 'on'
+
+ trigger:
+ - platform: numeric_state
+ entity_id: sensor.potenza_istantanea
+ above: 2950
+
+ action:
+ service: script.notify_all
+ data_template:
+ title: "Home Assistant - Allarme Consumo Energetico"
+ message: "Consumo energetico elevato ({{ states.sensor.potenza_istantanea.state }})."
+ enable_persistent: 0
+ volume_level: 0.4
--- /dev/null
+######################################################################
+# Home Assistant: Management of the Home Mode Button
+######################################################################
+
+- alias: "Home Assistant: Cambio modalità On"
+ initial_state: 'on'
+
+ trigger:
+ platform: state
+ entity_id: input_boolean.home_mode_day,
+ input_boolean.home_mode_night,
+ input_boolean.home_mode_away
+ to: 'on'
+
+ action:
+ - service: input_boolean.turn_off
+ data_template:
+ entity_id: >
+ {% set booleans = [ 'input_boolean.home_mode_day', 'input_boolean.home_mode_night', 'input_boolean.home_mode_away' ] | reject('equalto', trigger.entity_id) %}
+ {{ booleans | list | join(', ') }}
+
+- alias: "Home Assistant: Cambio modalità Off"
+ initial_state: 'on'
+
+ trigger:
+ platform: state
+ entity_id: input_boolean.home_mode_day,
+ input_boolean.home_mode_night,
+ input_boolean.home_mode_away
+ to: 'off'
+
+ condition:
+ condition: and
+ conditions:
+ - condition: state
+ entity_id: input_boolean.home_mode_day
+ state: 'off'
+ - condition: state
+ entity_id: input_boolean.home_mode_night
+ state: 'off'
+ - condition: state
+ entity_id: input_boolean.home_mode_away
+ state: 'off'
+
+ action:
+ - service: input_boolean.turn_on
+ data_template:
+ entity_id: >
+ {% if now().strftime('%H')|int >= 8 and now().strftime('%H')|int < 23 %}
+ input_boolean.home_mode_day
+ {% else %}
+ input_boolean.home_mode_night
+ {% endif %}
+
+######################################################################
+# Home Assistant: Management of Day/Night Mode
+######################################################################
+
+- alias: "Home Assistant: Modalità Giorno/Notte"
+ initial_state: 'on'
+
+ trigger:
+ - platform: time
+ at: '08:00:00'
+ - platform: time
+ at: '23:00:00'
+ - platform: homeassistant
+ event: start
+
+ condition:
+ condition: state
+ entity_id: input_boolean.home_mode_away
+ state: 'off'
+
+ action:
+ - service: input_boolean.turn_on
+ data_template:
+ entity_id: >-
+ {% if now().strftime('%H')|int >= 8 and now().strftime('%H')|int < 23 %}
+ input_boolean.home_mode_day
+ {% else %}
+ input_boolean.home_mode_night
+ {% endif %}
+
+ - service: script.volume_manager
+
+######################################################################
+# Home Assistant: Management of Speech Notifications
+######################################################################
+
+- alias: "Home Assistant: Gestione notifiche vocali"
+ initial_state: 'on'
+
+ trigger:
+ - platform: state
+ entity_id: input_boolean.home_mode_night
+ to: 'on'
+ - platform: state
+ entity_id: input_boolean.home_mode_night
+ to: 'off'
+
+ action:
+ - service_template: >-
+ {% if trigger.to_state.state == 'on' %}
+ input_boolean.turn_off
+ {% else %}
+ input_boolean.turn_on
+ {% endif %}
+ data:
+ entity_id: input_boolean.speech_notifications
+
+######################################################################
+# Home Assistant: Weekly Clean Log
+# - script.homeassistant_clearlog
+######################################################################
+
+- alias: "Home Assistant: Pulitura settimanale log"
+ initial_state: 'on'
+
+ trigger:
+ - platform: time
+ at: '00:00:00'
+
+ condition:
+ - condition: time
+ weekday: [mon]
+
+ action:
+ - service: script.homeassistant_clearlog
--- /dev/null
+######################################################################
+# Google Home: speeak message
+# - script.notify_voice
+######################################################################
+
+- alias: "Google Home: Pronuncia testo"
+ initial_state: 'on'
+
+ trigger:
+ - platform: state
+ entity_id: input_text.google_home_speak
+
+ condition: []
+
+ action:
+ - service: script.speech_engine
+ data_template:
+ media_player: "media_player.google_home"
+ message: "{{ trigger.to_state.state }}"
--- /dev/null
+######################################################################
+# Night Time
+# - Switch off all covers
+######################################################################
+
+- alias: "Modalità Notte"
+ initial_state: 'off'
+
+ trigger:
+ - platform: state
+ entity_id: input_boolean.home_mode_night
+ to: 'on'
+
+ condition: []
+# condition: state
+# entity_id: input_boolean.home_mode_away
+# state: 'off'
+
+ action:
+ - service: cover.set_cover_position
+ data:
+ entity_id: cover.tapparella_globale
+ position: 15
+
+ - service: cover.set_cover_position
+ data:
+ entity_id: cover.tapparella_camera
+ position: 0
--- /dev/null
+######################################################################
+# Welcome message
+#
+# Operations:
+# - script.speech_engine
+######################################################################
+
+- alias: Saluto di benvenuto
+ initial_state: 'on'
+
+ trigger:
+ - platform: zone
+ entity_id:
+ - person.giorgio
+ - person.laura
+ # - person.anna
+ zone: zone.home
+ event: enter
+# - platform: state
+# entity_id:
+# - device_tracker.s9
+# - device_tracker.a5
+# to: 'home'
+# for: '00:00:30'
+
+ condition: []
+
+ action:
+# - wait_template: >-
+# {# Giorgio #}
+# {% if trigger.entity_id == 'person.giorgio' %}
+# {% if is_state('device_tracker.s9', 'home') %}
+# true
+# {% else %}
+# false
+# {% endif %}
+#
+# {# Laura #}
+# {% elif trigger.entity_id == 'person.laura' %}
+# {% if is_state('device_tracker.a5', 'home') %}
+# true
+# {% else %}
+# false
+# {% endif %}
+#
+# {# Anna #}
+# {% elif trigger.entity_id == 'person.anna' %}
+# {% if is_state('device_tracker.a3', 'home') %}
+# true
+# {% else %}
+# false
+# {% endif %}
+#
+# {# Others #}
+# {% else %}
+# false
+# {% endif %}
+#
+# timeout: '00:30:00'
+# continue_on_timeout: 'false'
+
+ - wait_template: "{{ is_state('binary_sensor.porta_casa', 'on') }}"
+ timeout: '00:30:00'
+ continue_on_timeout: 'false'
+
+ - delay: 00:00:05
+
+ - service: script.speech_engine
+ data_template:
+ message: !include ../templates/welcome_message.yaml
+ enable_greeting: 0
+
+######################################################################
+# Hourly message
+#
+# Operations:
+# - script.speech_engine
+######################################################################
+
+- alias: "Saluto orario"
+ initial_state: 'off'
+
+ trigger:
+ - platform: time
+ at: '12:00:00'
+
+ condition: []
+
+ action:
+ - service: script.speech_engine
+ data_template:
+ message: >-
+ {% set hour = now().strftime('%H') %}
+ "Sono le {{ hour }} e tutto va bene."
--- /dev/null
+######################################################################\r
+# Startup Automation: Restart on Error\r
+######################################################################\r
+\r
+- alias: "Startup: Restart on Error"\r
+\r
+ trigger:\r
+ - platform: homeassistant\r
+ event: start\r
+ \r
+ action:\r
+ - delay: 00:00:60\r
+ - condition: state\r
+ entity_id: persistent_notification.invalid_config\r
+ state: 'notifying'\r
+ - service: script.homeassistant_restart\r
+\r
+######################################################################\r
+# Startup Automation: Google Sync\r
+######################################################################\r
+\r
+- alias: "Startup: Google Sync"\r
+\r
+ trigger:\r
+ - platform: homeassistant\r
+ event: start\r
+\r
+ action:\r
+ - service: script.homeassistant_google_home_sync\r
--- /dev/null
+######################################################################
+# Test Mode: Enable Action
+######################################################################
+
+- alias: "Modalità Test: Azione on"
+ initial_state: 'on'
+
+ trigger:
+ - platform: state
+ entity_id: input_boolean.test_mode
+ to: 'on'
+
+ action:\r
+
+ - service: automation.turn_off
+ entity_id: automation.startup_restart_on_error
+
+ - service: automation.turn_off
+ entity_id: automation.startup_google_sync
+
+######################################################################
+# Test Mode: Disable Action
+######################################################################
+
+- alias: "Modalità Test: Azione off"
+ initial_state: 'on'
+
+ trigger:
+ - platform: state
+ entity_id: input_boolean.test_mode
+ to: 'off'
+
+ action:
+ - service: automation.turn_on
+ entity_id: automation.startup_restart_on_error
+
+ - service: automation.turn_on
+ entity_id: automation.startup_google_sync
--- /dev/null
+######################################################################
+# Themes: Management of Day/Night Mode
+######################################################################
+
+- alias: "Temi: Modalità giorno/Notte"
+ initial_state: 'on'
+
+ trigger:
+ - platform: state
+ entity_id: input_boolean.home_mode_day
+ to: 'on'
+ - platform: state
+ entity_id: input_boolean.home_mode_night
+ to: 'on'
+ - platform: state
+ entity_id: input_boolean.home_mode_away
+ to: 'on'
+
+ action:
+ - service: frontend.set_theme
+ data_template:
+ name: >-
+ {% if trigger.entity_id == 'input_boolean.home_mode_day' %}
+ default
+ {% endif %}
+ {% if trigger.entity_id == 'input_boolean.home_mode_night' %}
+ darkish
+ {% endif %}
+ {% if trigger.entity_id == 'input_boolean.home_mode_away' %}
+ reeder_dark
+ {% endif %}
--- /dev/null
+######################################################################\r
+# Update Notification: Home Assistant\r
+######################################################################\r
+\r
+- alias: "Update Notification: Home Assistant"\r
+ initial_state: 'on'\r
+\r
+ trigger:\r
+ - platform: state\r
+ entity_id: binary_sensor.updater\r
+ to: 'on'\r
+\r
+ - platform: homeassistant\r
+ event: start\r
+\r
+ condition:\r
+ condition: state\r
+ entity_id: binary_sensor.updater\r
+ state: 'on'\r
+\r
+ action:\r
+ - delay: '00:00:5'\r
+ - service: script.notify_text\r
+ data_template:\r
+ title: "Home Assistant - Aggiornamento"\r
+ message: "E' disponibile un aggiornamento per Home Assistant {{ state_attr('binary_sensor.updater', 'newest_version') }}. {{now().strftime('%Y-%m-%d %I:%M %p')}}"\r
+ notification_id: "update"\r
+ enable_persistent: 1\r
+ \r
+ - service: input_boolean.turn_on\r
+ entity_id: input_boolean.update\r
+\r
+######################################################################\r
+# Update Notification: Shelly\r
+######################################################################\r
+\r
+- alias: "Update Notification: Shelly"\r
+ initial_state: 'on'\r
+\r
+ trigger:\r
+ - platform: state\r
+ entity_id: group.shelly\r
+ to: 'on'\r
+ \r
+ - platform: homeassistant\r
+ event: start\r
+ \r
+ condition:\r
+ condition: state\r
+ entity_id: group.shelly\r
+ state: 'on'\r
+\r
+ action:\r
+ - delay: '00:00:10'\r
+ - service: script.notify_text\r
+ data_template:\r
+ title: "Shelly - Aggiornamento"\r
+ message: "Sono disponibili aggiornamenti per i dispositivi Shelly"\r
+ notification_id: "update"\r
+ enable_persistent: 1\r
+\r
+ - service: input_boolean.turn_on\r
+ entity_id: input_boolean.update\r
+\r
+######################################################################\r
+# Update Notification: HACS\r
+######################################################################\r
+\r
+- alias: "Update Notification: HACS"\r
+ initial_state: 'on'\r
+\r
+ trigger:\r
+ - platform: numeric_state\r
+ entity_id: sensor.hacs\r
+ above: 0\r
+\r
+ action:\r
+ - delay: '00:00:15'\r
+ - service: script.notify_text\r
+ data_template:\r
+ title: "HACS - Aggiornamento"\r
+ message: "Sono disponibili aggiornamenti per i moduli HACS"\r
+ notification_id: "update"\r
+ enable_persistent: 1\r
+\r
+ - service: input_boolean.turn_on\r
+ entity_id: input_boolean.update\r
+\r
+######################################################################\r
+# Update: Aknowledge update\r
+#\r
+# Actions:\r
+# - persistent_notification.dismiss\r
+######################################################################\r
+- alias: "Update: Riconoscimento Aggiornamenti"\r
+ initial_state: 'on'\r
+\r
+ trigger:\r
+ platform: state\r
+ entity_id: input_boolean.update\r
+ to: 'off'\r
+\r
+ action:\r
+ - service: persistent_notification.dismiss\r
+ data_template:\r
+ notification_id: "update"\r
+++ /dev/null
-######################################################################
-# Xiaomi MiJia Door & Window Contact Sensor (MCCGQ01LM)
-######################################################################
-
-- platform: "mqtt"
- name: "Porta Casa"
- state_topic: "zigbee2mqtt/main_door"
- availability_topic: "zigbee2mqtt/bridge/state"
- payload_on: false
- payload_off: true
- value_template: "{{ value_json.contact }}"
- device_class: "door"
-
-######################################################################
-# Xiaomi Aqara Door & Window Contact Sensor (MCCGQ11LM)
-######################################################################
-
-- platform: "mqtt"
- name: "Porta Casa 2"
- state_topic: "zigbee2mqtt/spare_door"
- availability_topic: "zigbee2mqtt/bridge/state"
- payload_on: false
- payload_off: true
- value_template: "{{ value_json.contact }}"
- device_class: "door"
--- /dev/null
+######################################################################
+# Xiaomi MiJia Door & Window Contact Sensor (MCCGQ01LM)
+######################################################################
+
+- platform: "mqtt"
+ name: "Porta Casa"
+ state_topic: "zigbee2mqtt/main_door"
+ availability_topic: "zigbee2mqtt/bridge/state"
+ payload_on: false
+ payload_off: true
+ value_template: "{{ value_json.contact }}"
+ device_class: "door"
+
+######################################################################
+# Xiaomi Aqara Door & Window Contact Sensor (MCCGQ11LM)
+######################################################################
+
+- platform: "mqtt"
+ name: "Porta Casa 2"
+ state_topic: "zigbee2mqtt/spare_door"
+ availability_topic: "zigbee2mqtt/bridge/state"
+ payload_on: false
+ payload_off: true
+ value_template: "{{ value_json.contact }}"
+ device_class: "door"
+++ /dev/null
-######################################################################
-# Group Climate
-######################################################################
-
-climate:
- name: Termostato
- icon: mdi:thermometer
- entities:
- - sensor.termostato_cucina
- - sensor.termostato_sala
- - sensor.termostato_bagno
- - sensor.termostato_studio
- - sensor.termostato_camera
+++ /dev/null
-######################################################################
-# Group Covers
-######################################################################
-
-covers:
- name: Tapparelle
- #icon: mdi:window-closed
- icon: mdi:window-shutter
- entities:
- - cover.tapparella_cucina
- - cover.tapparella_sala
- - cover.tapparella_studio
- - cover.tapparella_camera
+++ /dev/null
-######################################################################
-# Group Lights
-######################################################################
-
-doors:
- name: Porte
- icon: mdi:door
- entities:
- - binary_sensor.porta_casa
+++ /dev/null
-######################################################################
-# Group Lights
-######################################################################
-
-lights:
- name: Luci
- icon: mdi:lightbulb
- entities:
- - light.luce_cucina
- - light.luce_corridoio
- - light.luce_sala
- - light.luce_divano
- - light.luce_bagno
- - light.luce_specchio
- - light.luce_studio
- - light.luce_camera
- - light.luce_balcone
+++ /dev/null
-######################################################################
-# Group Lights Bathroom
-######################################################################
-
-lights_bathroom:
- name: Luci Bagno
- icon: mdi:lightbulb
- entities:
- - light.luce_bagno
- - light.luce_specchio
+++ /dev/null
-######################################################################
-# Group Lights Livingroom
-######################################################################
-
-lights_livingroom:
- name: Luci Sala
- icon: mdi:lightbulb
- entities:
- - light.luce_sala
- - light.luce_divano
-# - light.luce_divano_bianca
+++ /dev/null
-######################################################################
-# People
-######################################################################
-
-people:
- name: Persone
- icon: mdi:account-multiple
- entities:
- # Giorgio
- - person.giorgio
- # Laura
- - person.laura
- # Anna
- - person.anna
- # Assunta
- - person.assunta
-
-######################################################################
-# Residents
-######################################################################
-
-residents:
- name: Abitanti Casa
- icon: mdi:account-multiple
- entities:
- # Giorgio
- - person.giorgio
- # Laura
- - person.laura
- # Anna
- #- person.anna
- # Assunta
- #- person.assunta
+++ /dev/null
-######################################################################
-# Group Shelly Devices
-######################################################################
-
-shelly:
- name: Shelly Devices
- #icon: mdi:thermometer
- entities:
- - sensor.shelly1_status
- - sensor.shelly2_status
- - sensor.shelly3_status
- - sensor.shelly4_status
- - sensor.shelly5_status
- - sensor.shelly6_status
- - sensor.shelly7_status
- - sensor.shelly8_status
- - sensor.shelly9_status
- - sensor.shelly10_status
- - sensor.shelly11_status
- - sensor.shellybulb_status
- - sensor.shellyem_status
- - sensor.shellydw_status
- - sensor.shellyplugs_status
--- /dev/null
+######################################################################
+# Group Climate
+######################################################################
+
+climate:
+ name: Termostato
+ icon: mdi:thermometer
+ entities:
+ - sensor.termostato_cucina
+ - sensor.termostato_sala
+ - sensor.termostato_bagno
+ - sensor.termostato_studio
+ - sensor.termostato_camera
--- /dev/null
+######################################################################
+# Group Covers
+######################################################################
+
+covers:
+ name: Tapparelle
+ #icon: mdi:window-closed
+ icon: mdi:window-shutter
+ entities:
+ - cover.tapparella_cucina
+ - cover.tapparella_sala
+ - cover.tapparella_studio
+ - cover.tapparella_camera
--- /dev/null
+######################################################################
+# Group Lights
+######################################################################
+
+doors:
+ name: Porte
+ icon: mdi:door
+ entities:
+ - binary_sensor.porta_casa
--- /dev/null
+######################################################################
+# Group Lights
+######################################################################
+
+lights:
+ name: Luci
+ icon: mdi:lightbulb
+ entities:
+ - light.luce_cucina
+ - light.luce_corridoio
+ - light.luce_sala
+ - light.luce_divano
+ - light.luce_bagno
+ - light.luce_specchio
+ - light.luce_studio
+ - light.luce_camera
+ - light.luce_balcone
--- /dev/null
+######################################################################
+# Group Lights Bathroom
+######################################################################
+
+lights_bathroom:
+ name: Luci Bagno
+ icon: mdi:lightbulb
+ entities:
+ - light.luce_bagno
+ - light.luce_specchio
--- /dev/null
+######################################################################
+# Group Lights Livingroom
+######################################################################
+
+lights_livingroom:
+ name: Luci Sala
+ icon: mdi:lightbulb
+ entities:
+ - light.luce_sala
+ - light.luce_divano
+# - light.luce_divano_bianca
--- /dev/null
+######################################################################
+# People
+######################################################################
+
+people:
+ name: Persone
+ icon: mdi:account-multiple
+ entities:
+ # Giorgio
+ - person.giorgio
+ # Laura
+ - person.laura
+ # Anna
+ - person.anna
+ # Assunta
+ - person.assunta
+
+######################################################################
+# Residents
+######################################################################
+
+residents:
+ name: Abitanti Casa
+ icon: mdi:account-multiple
+ entities:
+ # Giorgio
+ - person.giorgio
+ # Laura
+ - person.laura
+ # Anna
+ #- person.anna
+ # Assunta
+ #- person.assunta
--- /dev/null
+######################################################################
+# Group Shelly Devices
+######################################################################
+
+shelly:
+ name: Shelly Devices
+ #icon: mdi:thermometer
+ entities:
+ - sensor.shelly1_status
+ - sensor.shelly2_status
+ - sensor.shelly3_status
+ - sensor.shelly4_status
+ - sensor.shelly5_status
+ - sensor.shelly6_status
+ - sensor.shelly7_status
+ - sensor.shelly8_status
+ - sensor.shelly9_status
+ - sensor.shelly10_status
+ - sensor.shelly11_status
+ - sensor.shellybulb_status
+ - sensor.shellyem_status
+ - sensor.shellydw_status
+ - sensor.shellyplugs_status
+++ /dev/null
-######################################################################
-# Script: Laura
-# Inputs:
-# - type:
-# 1 -> bell'affare
-# 2 -> belan
-# 3 -> una schifezza
-# 3 -> ma che schifo è?
-#
-# Operations:
-# - script.volume_manager
-# - media_player.play_media
-######################################################################
-
-laura_voice:
- alias: Voce Laura
- sequence:
- - condition: state
- entity_id: input_boolean.speech_notifications
- state: 'on'
-
- - wait_template: >-
- {% if media_player | length == 0 %}
- {% set media_player = 'media_player.google_home' %}
- {% endif %}
- {{ not is_state(media_player, 'playing') }}
-
- - service: script.volume_manager
- data_template:
- media_player: >-
- {# Check Null Input #}
- {% if media_player | length == 0 %}
- {% set media_player = 'media_player.google_home' %}
- {% endif %}
- {{ media_player }}
- volume_level: "{{ volume_level }}"
-
- - service: media_player.play_media
- data_template:
- entity_id: >-
- {# Check Null Input #}
- {% if media_player | length == 0 %}
- {% set media_player = 'media_player.google_home' %}
- {% endif %}
- {{ media_player }}
- media_content_type: 'audio/mp4'
- media_content_id: >-
- {%- macro set_type() -%}
- {{ range(1,5,1) | random }}
- {%- endmacro -%}
- {% if type is not defined %}
- {% set type = set_type() %}
- {% endif %}
- https://home.giorgioravera.it/local/audio/laura/{{type}}.mp3
-
-laura_voice_1:
- alias: Voce Laura 1
- sequence:
- - service: script.laura_voice
- data:
- type: '1'
-
-laura_voice_2:
- alias: Voce Laura 2
- sequence:
- - service: script.laura_voice
- data:
- type: '2'
-
-laura_voice_3:
- alias: Voce Laura 3
- sequence:
- - service: script.laura_voice
- data:
- type: '3'
-
-laura_voice_4:
- alias: Voce Laura 4
- sequence:
- - service: script.laura_voice
- data:
- type: '4'
-
-######################################################################
-# Script: Babu Frik
-# Inputs:
-# - type:
-# 1 -> I'm babu frik
-# 2 -> heheeee
-#
-# Operations:
-# - script.volume_manager
-# - media_player.play_media
-######################################################################
-
-babu_voice:
- alias: Voce Babu
- sequence:
- - condition: state
- entity_id: input_boolean.speech_notifications
- state: 'on'
-
- - wait_template: >-
- {% if media_player | length == 0 %}
- {% set media_player = 'media_player.google_home' %}
- {% endif %}
- {{ not is_state(media_player, 'playing') }}
-
- - service: script.volume_manager
- data_template:
- media_player: >-
- {# Check Null Input #}
- {% if media_player | length == 0 %}
- {% set media_player = 'media_player.google_home' %}
- {% endif %}
- {{ media_player }}
- volume_level: "{{ volume_level }}"
-
- - service: media_player.play_media
- data_template:
- entity_id: >-
- {# Check Null Input #}
- {% if media_player | length == 0 %}
- {% set media_player = 'media_player.google_home' %}
- {% endif %}
- {{ media_player }}
- media_content_type: 'audio/mp4'
- media_content_id: >-
- {% if type is not defined %}
- {% set type = 1 %}
- {% endif %}
- https://home.giorgioravera.it/local/audio/babu/{{type}}.mp3
-
-babu_voice_1:
- alias: Voce Babu 1
- sequence:
- - service: script.babu_voice
- data:
- type: '1'
-
-babu_voice_2:
- alias: Voce Babu 2
- sequence:
- - service: script.babu_voice
- data:
- type: '2'
+++ /dev/null
-######################################################################
-# Climate: Daily Schedule
-# Inputs:
-# - entity_id
-# - temp1
-# - temp2
-# - temp3
-# - temp4
-# - temp5
-#
-# Operations:
-# - climate.set_temperature
-######################################################################
-
-climate_daily_schedule:
- alias: "Termosifoni: Schedulazione giornaliera"
- sequence:
- - service: climate.set_temperature
- data_template:
- entity_id: "{{ entity_id }}"
- temperature: >-
- {% set current_date_string = now().strftime("%H%M") %}
- {% set time1_string = "0630" %}
- {% set time2_string = "0730" %}
- {% set time3_string = "0900" %}
- {% set time4_string = "1830" %}
- {% set time5_string = "2200" %}
- {% if ((current_date_string|int) >= (time1_string|int)) and ((current_date_string|int) < (time2_string|int)) %}
- {{ temp1 }}
- {% elif ((current_date_string|int) >= (time2_string|int)) and ((current_date_string|int) < (time3_string|int)) %}
- {{ temp2 }}
- {% elif ((current_date_string|int) >= (time3_string|int)) and ((current_date_string|int) < (time4_string|int)) %}
- {{ temp3 }}
- {% elif ((current_date_string|int) >= (time4_string|int)) and ((current_date_string|int) < (time5_string|int)) %}
- {{ temp4 }}
- {% else %}
- {{ temp5 }}
- {% endif %}
-
-######################################################################
-# Climate: Away Mode On
-# Inputs:
-# - entity_id
-# - mode
-#
-# Operations:
-# - climate.set_operation_mode
-# - climate.set_temperature
-######################################################################
-
-climate_away_mode_on:
- alias: "Termosifoni: Attviva Modalità vacanza"
- sequence:
- - service: climate.set_preset_mode
- data_template:
- entity_id: "{{ entity_id }}"
- preset_mode: manual
- - delay: '00:00:5'
- - service: climate.set_temperature
- data_template:
- entity_id: "{{ entity_id }}"
- temperature: 5
- - delay: '00:00:5'
- - service: climate.set_preset_mode
- data_template:
- entity_id: "{{ entity_id }}"
- preset_mode: vacation
- - delay: '00:00:5'
- - service: climate.set_preset_mode
- data_template:
- entity_id: "{{ entity_id }}"
- preset_mode: vacation
-
-######################################################################
-# Climate: Away Mode Off
-# Inputs:
-# - entity_id
-# - mode
-#
-# Operations:
-# - climate.set_operation_mode
-# - climate.set_temperature
-######################################################################
-
-climate_away_mode_off:
- alias: "Termosifoni: Disattiva Modalità vacanza"
- sequence:
- - service: climate.set_preset_mode
- data_template:
- entity_id: "{{ entity_id }}"
- preset_mode: auto
+++ /dev/null
-######################################################################
-# All Covers Operation
-# Inputs:
-# - modus
-#
-# Operations:
-# - cover.{{modus}}_cover
-######################################################################
-
-all_covers_operation:
- alias: "Operazioni su tutte le Tapparelle"
- sequence:
- - service_template: "cover.{{modus}}_cover"
- data:
- entity_id:
- - cover.tapparella_cucina
- - cover.tapparella_sala
- - cover.tapparella_camera
- - cover.tapparella_studio
-
-######################################################################
-# All Covers Position
-# Inputs:
-# - position
-#
-# Operations:
-# - cover.set_cover_position
-######################################################################
-
-all_covers_position:
- alias: "Imposta posizione a tutte le Tapparelle"
- sequence:
- - service: cover.set_cover_position
- data_template:
- entity_id:
- - cover.tapparella_cucina
- - cover.tapparella_sala
- - cover.tapparella_camera
- - cover.tapparella_studio
- position: '{{ position }}'
+++ /dev/null
-######################################################################
-# Home Assistant: Restart
-# - shell_command.docker_restart
-######################################################################
-
-homeassistant_restart:
- alias: "Riavvia Home Assistant"
- sequence:
- - service: shell_command.docker_restart
-
-######################################################################
-# Home Assistant: Ricarica Script
-# - script.reload
-######################################################################
-
-homeassistant_reload_scripts:
- alias: "Ricarica Script"
- sequence:
- - service: script.reload
-
-######################################################################
-# Home Assistant: Ricarica Automazioni
-# - script.reload
-######################################################################
-
-homeassistant_reload_automations:
- alias: "Ricarica Automazioni"
- sequence:
- - service: automation.reload
-
-######################################################################
-# Home Assistant: Clear Log
-# - tts.clear_cache
-# - system_log.clear
-# - recorder.purge
-######################################################################
-
-homeassistant_clearlog:
- alias: "Pulisci Log"
- sequence:
- - service: tts.clear_cache
- - service: system_log.clear
- - service: recorder.purge
- data:
- keep_days: 0
-
-######################################################################
-# Home Assistant: Sync with Google Home
-# - google_assistant.request_sync
-######################################################################
-
-homeassistant_google_home_sync:
- alias: "Sincronizza Google Home"
- sequence:
- - service: google_assistant.request_sync
- data:
- agent_user_id: !secret google_agent
+++ /dev/null
-######################################################################
-# Script: TV Sala Toggle
-# Inputs:
-# - tv
-#
-# Operations:
-# - script.turn_on
-######################################################################
-
-tv_sala_toggle:
- alias: "TV Sala: Accendi/Spegni"
- sequence:
- - service: script.turn_on
- data_template:
- entity_id: >-
- {% if is_state('media_player.tv_sala', 'on') %}
- script.tv_sala_off
- {% else %}
- script.tv_sala_on
- {% endif %}
-
-######################################################################
-# Script: TV Sala On
-# Inputs:
-# - tv
-#
-# Operations:
-# - script.turn_on
-######################################################################
-
-tv_sala_on:
- alias: "TV Sala: Accendi"
- sequence:
- #- service: shell_command.bravia_tvpower
- - service: media_player.toggle
- entity_id: media_player.tv_sala
-
-######################################################################
-# Script: TV Sala Off
-# Inputs:
-# - tv
-#
-# Operations:
-# - script.turn_on
-######################################################################
-
-tv_sala_off:
- alias: "TV Sala: Spegni"
- sequence:
- #- service: shell_command.bravia_poweroff
- - service: media_player.toggle
- entity_id: media_player.tv_sala
+++ /dev/null
-######################################################################
-# Script: Text Notification
-# Inputs:
-# - title
-# - message
-# - notification_id
-# - enable_persistent
-#
-# Operations:
-# - notify.mail
-# - notify.push
-# - persistent_notification.create (if enable_persistent)
-######################################################################
-
-notify_text_internal:
- alias: Notifiche testuali
- sequence:
- - service: notify.mail
- data_template:
- title: "{{ title }}"
- message: "{{ message }}"
-
- - service: notify.push
- data_template:
- title: "{{ title }}"
- message: "{{ message }}"
-
- - condition: template
- value_template: >
- {% if enable_persistent is defined %}
- {% if enable_persistent | int == 1 %}
- true
- {% else %}
- false
- {% endif %}
- {% else %}
- false
- {% endif %}
-
- - service: persistent_notification.create
- data_template:
- title: "{{ title }}"
- message: "{{ message }}"
- notification_id: >-
- {# Check Null Input #}
- {% if notification_id | length == 0 %}
- {% set notification_id = 'generic' %}
- {% endif %}
- {{ notification_id }}
-
-notify_text:
- alias: Notifiche testuali
- sequence:
- - condition: state
- entity_id: input_boolean.text_notifications
- state: 'on'
-
- - service: script.notify_text_internal
- data_template:
- title: >-
- {# Check Null Input #}
- {% if title | length == 0 %}
- {% set title = 'Home Assistant' %}
- {% endif %}
- {{ title }}
- message: "{{ message }}"
- notification_id: "{{ notification_id }}"
- enable_persistent: "{{ enable_persistent }}"
-
-######################################################################
-# Script: Volume Manager
-# Input:
-# - media_player
-# - volume_level
-#
-# Operations:
-# - media_player.volume_set
-######################################################################
-
-volume_manager:
- alias: Gestione Volume
- sequence:
- - service: media_player.volume_set
- data_template:
- entity_id: >-
- {# Check Null Input #}
- {% if media_player | length == 0 %}
- {% set media_player = 'media_player.google_home' %}
- {% endif %}
- {{ media_player }}
- volume_level: >-
- {# Default Values #}
- {% set defaultVolume = 0.30 %}
- {% set maxDayVolume = 0.60 %}
- {% set maxNightVolume = 0.20 %}
-
- {# Check Null Input #}
- {% if volume_level | length == 0 %}
- {% set volume_level = defaultVolume %}
- {% endif %}
-
- {# Day/Night mode #}
- {% if is_state('input_boolean.home_mode_night', 'off') %}
- {% if ((volume_level)|float) > ((maxDayVolume)|float) %}
- {{ maxDayVolume }}
- {% else %}
- {{ volume_level }}
- {% endif %}
- {% else %}
- {% if ((volume_level)|float) > ((maxNightVolume)|float) %}
- {{ maxNightVolume }}
- {% else %}
- {{ volume_level }}
- {% endif %}
- {% endif %}
-
-######################################################################
-# Script: Voice Notification
-# Input:
-# - media_player
-# - volume_level
-# - language
-# - message
-#
-# Operations:
-# - script.notify_volume_manager
-# - tts.google_translate_say
-######################################################################
-
-notify_voice:
- alias: Notifiche vocali
- sequence:
- - condition: state
- entity_id: input_boolean.speech_notifications
- state: 'on'
-
- - wait_template: >-
- {% if media_player | length == 0 %}
- {% set media_player = 'media_player.google_home' %}
- {% endif %}
- {{ not is_state(media_player, 'playing') }}
-
- - service: script.volume_manager
- data_template:
- media_player: "{{ media_player }}"
- volume_level: "{{ volume_level }}"
-
- - service: tts.google_translate_say
- data_template:
- entity_id: >-
- {# Check Null Input #}
- {% if media_player | length == 0 %}
- {% set media_player = 'media_player.google_home' %}
- {% endif %}
- {{ media_player }}
- language: >-
- {# Check Null Input #}
- {% if language | length == 0 %}
- {% set language = 'it' %}
- {% endif %}
- {{ language }}
- message: "{{ message }}"
-
- - service: script.volume_manager
-
-######################################################################
-# Script: Global Notification (Text+Voice)
-# Inputs:
-# - title
-# - media_player
-# - volume_level
-# _ language
-# - message
-# - notification_id
-# - enable_persistent
-#
-# Operations:
-# - notify_text
-# - notify_voice
-######################################################################
-
-notify_all:
- alias: Notifiche globali (Testo+Voce)
- sequence:
- - service: script.notify_text
- data_template:
- title: "{{ title }}"
- message: "{{ message }}"
- notification_id: "{{ notification_id }}"
- enable_persistent: "{{ enable_persistent }}"
-
- - service: script.notify_voice
- data_template:
- media_player: "{{ media_player }}"
- volume_level: "{{ volume_level }}"
- language: "{{ language }}"
- message: "{{ message }}"
+++ /dev/null
-######################################################################
-# Shelly: Upgrade
-# - mqtt.publish
-######################################################################
-
-shelly_upgrade:
- alias: "Shelly: Aggiornamento Firmware"
- sequence:
- # Shelly 2 Tapparella Cucina
- - service: mqtt.publish
- data:
- topic: 'shellies/shellyswitch-55980F/command'
- payload: 'update_fw'
-
- # Shelly 2 Tapparella Sala
- - service: mqtt.publish
- data:
- topic: 'shellies/shellyswitch25-6919BD/command'
- payload: 'update_fw'
-
- # Shelly 2 Tapparella Studio
- - service: mqtt.publish
- data:
- topic: 'shellies/shellyswitch-13572B/command'
- payload: 'update_fw'
-
- # Shelly 2 Tapparella Camera
- - service: mqtt.publish
- data:
- topic: 'shellies/shellyswitch-559C49/command'
- payload: 'update_fw'
-
- # Shelly 1 Luce Corridoio
- - service: mqtt.publish
- data:
- topic: 'shellies/shelly1-24D1EE/command'
- payload: 'update_fw'
-
- # Shelly 1 Luce Cucina
- - service: mqtt.publish
- data:
- topic: 'shellies/shelly1-93B27D/command'
- payload: 'update_fw'
-
- # Shelly 1 Luce Sala
- - service: mqtt.publish
- data:
- topic: 'shellies/shelly1-C426F9/command'
- payload: 'update_fw'
-
- # Shelly Bulb Luce Divano
- - service: mqtt.publish
- data:
- topic: 'shellies/shellybulb-BC8610/command'
- payload: 'update_fw'
-
- # Shelly 2.5 Luci Bagno
- - service: mqtt.publish
- data:
- topic: 'shellies/shellyswitch25-7457D8/command'
- payload: 'update_fw'
-
- # Shelly 1 Luce Studio
- - service: mqtt.publish
- data:
- topic: 'shellies/shelly1-59E18C/command'
- payload: 'update_fw'
-
- # Shelly Dimmer Luce Camera
- - service: mqtt.publish
- data:
- topic: 'shellies/shellydimmer-D46CF2/command'
- payload: 'update_fw'
-
- # Shelly 1 Luce Balcone
- - service: mqtt.publish
- data:
- topic: 'shellies/shelly1-C423C8/command'
- payload: 'update_fw'
-
- # Shelly EM
- - service: mqtt.publish
- data:
- topic: 'shellies/shellyem-B9E1A0/command'
- payload: 'update_fw'
-
- # Shelly Door/Window
- - service: mqtt.publish
- data:
- topic: 'shellies/shellydw-B88F53/command'
- payload: 'update_fw'
-
- # Shelly Plug S
- - service: mqtt.publish
- data:
- topic: 'shellies/shellyplug-s-7A31CB/command'
- payload: 'update_fw'
-
-# # Shelly 1 TBD
-# - service: mqtt.publish
-# data:
-# topic: 'shellies/shelly1-24D1A8/command'
-# payload: 'update_fw'
-
-######################################################################
-# Shelly: Reboot
-# - shell_command.shelly_reboot
-######################################################################
-shelly_reboot:
- alias: "Shelly: Riavvia Dispositivi"
- sequence:
- - service: shell_command.shelly_reboot
+++ /dev/null
-######################################################################
-# Script: Speech Engine
-# Inputs:
-# - media_player
-# - volume_level
-# - message
-# - enable_greeting
-# - enable_status
-# - enable_location
-# - location_people_start
-# - location_people_num
-# - enable_car
-#
-# Operations:
-# - script.notify_voice (greeting + message)
-######################################################################
-
-speech_engine:
- alias: Speech Engine
- sequence:
- - service: script.notify_voice
- data_template:
- media_player: "{{ media_player }}"
- volume_level: "{{ volume_level }}"
- message: !include ../templates/speech_message.yaml
-
-######################################################################
-# Script: Speech Status
-#
-# Operations:
-# - script.speech_engine
-######################################################################
-
-speech_status:
- alias: Stato Casa
- sequence:
- - service: script.speech_engine
- data:
- enable_greeting: 1
- enable_status: 1
-
-######################################################################
-# Speech Consumption
-#
-# Operations:
-# - script.speech_engine
-######################################################################
-
-speech_consumption:
- alias: Consumo Energetico
- sequence:
- - service: script.speech_engine
- data_template:
- message: >-
- "Il consumo istantaneo è pari a {{ states.sensor.potenza_istantanea.state }} watt"
--- /dev/null
+######################################################################
+# Script: Laura
+# Inputs:
+# - type:
+# 1 -> bell'affare
+# 2 -> belan
+# 3 -> una schifezza
+# 3 -> ma che schifo è?
+#
+# Operations:
+# - script.volume_manager
+# - media_player.play_media
+######################################################################
+
+laura_voice:
+ alias: Voce Laura
+ sequence:
+ - condition: state
+ entity_id: input_boolean.speech_notifications
+ state: 'on'
+
+ - wait_template: >-
+ {% if media_player | length == 0 %}
+ {% set media_player = 'media_player.google_home' %}
+ {% endif %}
+ {{ not is_state(media_player, 'playing') }}
+
+ - service: script.volume_manager
+ data_template:
+ media_player: >-
+ {# Check Null Input #}
+ {% if media_player | length == 0 %}
+ {% set media_player = 'media_player.google_home' %}
+ {% endif %}
+ {{ media_player }}
+ volume_level: "{{ volume_level }}"
+
+ - service: media_player.play_media
+ data_template:
+ entity_id: >-
+ {# Check Null Input #}
+ {% if media_player | length == 0 %}
+ {% set media_player = 'media_player.google_home' %}
+ {% endif %}
+ {{ media_player }}
+ media_content_type: 'audio/mp4'
+ media_content_id: >-
+ {%- macro set_type() -%}
+ {{ range(1,5,1) | random }}
+ {%- endmacro -%}
+ {% if type is not defined %}
+ {% set type = set_type() %}
+ {% endif %}
+ https://home.giorgioravera.it/local/audio/laura/{{type}}.mp3
+
+laura_voice_1:
+ alias: Voce Laura 1
+ sequence:
+ - service: script.laura_voice
+ data:
+ type: '1'
+
+laura_voice_2:
+ alias: Voce Laura 2
+ sequence:
+ - service: script.laura_voice
+ data:
+ type: '2'
+
+laura_voice_3:
+ alias: Voce Laura 3
+ sequence:
+ - service: script.laura_voice
+ data:
+ type: '3'
+
+laura_voice_4:
+ alias: Voce Laura 4
+ sequence:
+ - service: script.laura_voice
+ data:
+ type: '4'
+
+######################################################################
+# Script: Babu Frik
+# Inputs:
+# - type:
+# 1 -> I'm babu frik
+# 2 -> heheeee
+#
+# Operations:
+# - script.volume_manager
+# - media_player.play_media
+######################################################################
+
+babu_voice:
+ alias: Voce Babu
+ sequence:
+ - condition: state
+ entity_id: input_boolean.speech_notifications
+ state: 'on'
+
+ - wait_template: >-
+ {% if media_player | length == 0 %}
+ {% set media_player = 'media_player.google_home' %}
+ {% endif %}
+ {{ not is_state(media_player, 'playing') }}
+
+ - service: script.volume_manager
+ data_template:
+ media_player: >-
+ {# Check Null Input #}
+ {% if media_player | length == 0 %}
+ {% set media_player = 'media_player.google_home' %}
+ {% endif %}
+ {{ media_player }}
+ volume_level: "{{ volume_level }}"
+
+ - service: media_player.play_media
+ data_template:
+ entity_id: >-
+ {# Check Null Input #}
+ {% if media_player | length == 0 %}
+ {% set media_player = 'media_player.google_home' %}
+ {% endif %}
+ {{ media_player }}
+ media_content_type: 'audio/mp4'
+ media_content_id: >-
+ {% if type is not defined %}
+ {% set type = 1 %}
+ {% endif %}
+ https://home.giorgioravera.it/local/audio/babu/{{type}}.mp3
+
+babu_voice_1:
+ alias: Voce Babu 1
+ sequence:
+ - service: script.babu_voice
+ data:
+ type: '1'
+
+babu_voice_2:
+ alias: Voce Babu 2
+ sequence:
+ - service: script.babu_voice
+ data:
+ type: '2'
--- /dev/null
+######################################################################
+# Climate: Daily Schedule
+# Inputs:
+# - entity_id
+# - temp1
+# - temp2
+# - temp3
+# - temp4
+# - temp5
+#
+# Operations:
+# - climate.set_temperature
+######################################################################
+
+climate_daily_schedule:
+ alias: "Termosifoni: Schedulazione giornaliera"
+ sequence:
+ - service: climate.set_temperature
+ data_template:
+ entity_id: "{{ entity_id }}"
+ temperature: >-
+ {% set current_date_string = now().strftime("%H%M") %}
+ {% set time1_string = "0630" %}
+ {% set time2_string = "0730" %}
+ {% set time3_string = "0900" %}
+ {% set time4_string = "1830" %}
+ {% set time5_string = "2200" %}
+ {% if ((current_date_string|int) >= (time1_string|int)) and ((current_date_string|int) < (time2_string|int)) %}
+ {{ temp1 }}
+ {% elif ((current_date_string|int) >= (time2_string|int)) and ((current_date_string|int) < (time3_string|int)) %}
+ {{ temp2 }}
+ {% elif ((current_date_string|int) >= (time3_string|int)) and ((current_date_string|int) < (time4_string|int)) %}
+ {{ temp3 }}
+ {% elif ((current_date_string|int) >= (time4_string|int)) and ((current_date_string|int) < (time5_string|int)) %}
+ {{ temp4 }}
+ {% else %}
+ {{ temp5 }}
+ {% endif %}
+
+######################################################################
+# Climate: Away Mode On
+# Inputs:
+# - entity_id
+# - mode
+#
+# Operations:
+# - climate.set_operation_mode
+# - climate.set_temperature
+######################################################################
+
+climate_away_mode_on:
+ alias: "Termosifoni: Attviva Modalità vacanza"
+ sequence:
+ - service: climate.set_preset_mode
+ data_template:
+ entity_id: "{{ entity_id }}"
+ preset_mode: manual
+ - delay: '00:00:5'
+ - service: climate.set_temperature
+ data_template:
+ entity_id: "{{ entity_id }}"
+ temperature: 5
+ - delay: '00:00:5'
+ - service: climate.set_preset_mode
+ data_template:
+ entity_id: "{{ entity_id }}"
+ preset_mode: vacation
+ - delay: '00:00:5'
+ - service: climate.set_preset_mode
+ data_template:
+ entity_id: "{{ entity_id }}"
+ preset_mode: vacation
+
+######################################################################
+# Climate: Away Mode Off
+# Inputs:
+# - entity_id
+# - mode
+#
+# Operations:
+# - climate.set_operation_mode
+# - climate.set_temperature
+######################################################################
+
+climate_away_mode_off:
+ alias: "Termosifoni: Disattiva Modalità vacanza"
+ sequence:
+ - service: climate.set_preset_mode
+ data_template:
+ entity_id: "{{ entity_id }}"
+ preset_mode: auto
--- /dev/null
+######################################################################
+# All Covers Operation
+# Inputs:
+# - modus
+#
+# Operations:
+# - cover.{{modus}}_cover
+######################################################################
+
+all_covers_operation:
+ alias: "Operazioni su tutte le Tapparelle"
+ sequence:
+ - service_template: "cover.{{modus}}_cover"
+ data:
+ entity_id:
+ - cover.tapparella_cucina
+ - cover.tapparella_sala
+ - cover.tapparella_camera
+ - cover.tapparella_studio
+
+######################################################################
+# All Covers Position
+# Inputs:
+# - position
+#
+# Operations:
+# - cover.set_cover_position
+######################################################################
+
+all_covers_position:
+ alias: "Imposta posizione a tutte le Tapparelle"
+ sequence:
+ - service: cover.set_cover_position
+ data_template:
+ entity_id:
+ - cover.tapparella_cucina
+ - cover.tapparella_sala
+ - cover.tapparella_camera
+ - cover.tapparella_studio
+ position: '{{ position }}'
--- /dev/null
+######################################################################
+# Home Assistant: Restart
+# - shell_command.docker_restart
+######################################################################
+
+homeassistant_restart:
+ alias: "Riavvia Home Assistant"
+ sequence:
+ - service: shell_command.docker_restart
+
+######################################################################
+# Home Assistant: Ricarica Script
+# - script.reload
+######################################################################
+
+homeassistant_reload_scripts:
+ alias: "Ricarica Script"
+ sequence:
+ - service: script.reload
+
+######################################################################
+# Home Assistant: Ricarica Automazioni
+# - script.reload
+######################################################################
+
+homeassistant_reload_automations:
+ alias: "Ricarica Automazioni"
+ sequence:
+ - service: automation.reload
+
+######################################################################
+# Home Assistant: Clear Log
+# - tts.clear_cache
+# - system_log.clear
+# - recorder.purge
+######################################################################
+
+homeassistant_clearlog:
+ alias: "Pulisci Log"
+ sequence:
+ - service: tts.clear_cache
+ - service: system_log.clear
+ - service: recorder.purge
+ data:
+ keep_days: 0
+
+######################################################################
+# Home Assistant: Sync with Google Home
+# - google_assistant.request_sync
+######################################################################
+
+homeassistant_google_home_sync:
+ alias: "Sincronizza Google Home"
+ sequence:
+ - service: google_assistant.request_sync
+ data:
+ agent_user_id: !secret google_agent
--- /dev/null
+######################################################################
+# Script: TV Sala Toggle
+# Inputs:
+# - tv
+#
+# Operations:
+# - script.turn_on
+######################################################################
+
+tv_sala_toggle:
+ alias: "TV Sala: Accendi/Spegni"
+ sequence:
+ - service: script.turn_on
+ data_template:
+ entity_id: >-
+ {% if is_state('media_player.tv_sala', 'on') %}
+ script.tv_sala_off
+ {% else %}
+ script.tv_sala_on
+ {% endif %}
+
+######################################################################
+# Script: TV Sala On
+# Inputs:
+# - tv
+#
+# Operations:
+# - script.turn_on
+######################################################################
+
+tv_sala_on:
+ alias: "TV Sala: Accendi"
+ sequence:
+ #- service: shell_command.bravia_tvpower
+ - service: media_player.toggle
+ entity_id: media_player.tv_sala
+
+######################################################################
+# Script: TV Sala Off
+# Inputs:
+# - tv
+#
+# Operations:
+# - script.turn_on
+######################################################################
+
+tv_sala_off:
+ alias: "TV Sala: Spegni"
+ sequence:
+ #- service: shell_command.bravia_poweroff
+ - service: media_player.toggle
+ entity_id: media_player.tv_sala
--- /dev/null
+######################################################################
+# Script: Text Notification
+# Inputs:
+# - title
+# - message
+# - notification_id
+# - enable_persistent
+#
+# Operations:
+# - notify.mail
+# - notify.push
+# - persistent_notification.create (if enable_persistent)
+######################################################################
+
+notify_text_internal:
+ alias: Notifiche testuali
+ sequence:
+ - service: notify.mail
+ data_template:
+ title: "{{ title }}"
+ message: "{{ message }}"
+
+ - service: notify.push
+ data_template:
+ title: "{{ title }}"
+ message: "{{ message }}"
+
+ - condition: template
+ value_template: >
+ {% if enable_persistent is defined %}
+ {% if enable_persistent | int == 1 %}
+ true
+ {% else %}
+ false
+ {% endif %}
+ {% else %}
+ false
+ {% endif %}
+
+ - service: persistent_notification.create
+ data_template:
+ title: "{{ title }}"
+ message: "{{ message }}"
+ notification_id: >-
+ {# Check Null Input #}
+ {% if notification_id | length == 0 %}
+ {% set notification_id = 'generic' %}
+ {% endif %}
+ {{ notification_id }}
+
+notify_text:
+ alias: Notifiche testuali
+ sequence:
+ - condition: state
+ entity_id: input_boolean.text_notifications
+ state: 'on'
+
+ - service: script.notify_text_internal
+ data_template:
+ title: >-
+ {# Check Null Input #}
+ {% if title | length == 0 %}
+ {% set title = 'Home Assistant' %}
+ {% endif %}
+ {{ title }}
+ message: "{{ message }}"
+ notification_id: "{{ notification_id }}"
+ enable_persistent: "{{ enable_persistent }}"
+
+######################################################################
+# Script: Volume Manager
+# Input:
+# - media_player
+# - volume_level
+#
+# Operations:
+# - media_player.volume_set
+######################################################################
+
+volume_manager:
+ alias: Gestione Volume
+ sequence:
+ - service: media_player.volume_set
+ data_template:
+ entity_id: >-
+ {# Check Null Input #}
+ {% if media_player | length == 0 %}
+ {% set media_player = 'media_player.google_home' %}
+ {% endif %}
+ {{ media_player }}
+ volume_level: >-
+ {# Default Values #}
+ {% set defaultVolume = 0.30 %}
+ {% set maxDayVolume = 0.60 %}
+ {% set maxNightVolume = 0.20 %}
+
+ {# Check Null Input #}
+ {% if volume_level | length == 0 %}
+ {% set volume_level = defaultVolume %}
+ {% endif %}
+
+ {# Day/Night mode #}
+ {% if is_state('input_boolean.home_mode_night', 'off') %}
+ {% if ((volume_level)|float) > ((maxDayVolume)|float) %}
+ {{ maxDayVolume }}
+ {% else %}
+ {{ volume_level }}
+ {% endif %}
+ {% else %}
+ {% if ((volume_level)|float) > ((maxNightVolume)|float) %}
+ {{ maxNightVolume }}
+ {% else %}
+ {{ volume_level }}
+ {% endif %}
+ {% endif %}
+
+######################################################################
+# Script: Voice Notification
+# Input:
+# - media_player
+# - volume_level
+# - language
+# - message
+#
+# Operations:
+# - script.notify_volume_manager
+# - tts.google_translate_say
+######################################################################
+
+notify_voice:
+ alias: Notifiche vocali
+ sequence:
+ - condition: state
+ entity_id: input_boolean.speech_notifications
+ state: 'on'
+
+ - wait_template: >-
+ {% if media_player | length == 0 %}
+ {% set media_player = 'media_player.google_home' %}
+ {% endif %}
+ {{ not is_state(media_player, 'playing') }}
+
+ - service: script.volume_manager
+ data_template:
+ media_player: "{{ media_player }}"
+ volume_level: "{{ volume_level }}"
+
+ - service: tts.google_translate_say
+ data_template:
+ entity_id: >-
+ {# Check Null Input #}
+ {% if media_player | length == 0 %}
+ {% set media_player = 'media_player.google_home' %}
+ {% endif %}
+ {{ media_player }}
+ language: >-
+ {# Check Null Input #}
+ {% if language | length == 0 %}
+ {% set language = 'it' %}
+ {% endif %}
+ {{ language }}
+ message: "{{ message }}"
+
+ - service: script.volume_manager
+
+######################################################################
+# Script: Global Notification (Text+Voice)
+# Inputs:
+# - title
+# - media_player
+# - volume_level
+# _ language
+# - message
+# - notification_id
+# - enable_persistent
+#
+# Operations:
+# - notify_text
+# - notify_voice
+######################################################################
+
+notify_all:
+ alias: Notifiche globali (Testo+Voce)
+ sequence:
+ - service: script.notify_text
+ data_template:
+ title: "{{ title }}"
+ message: "{{ message }}"
+ notification_id: "{{ notification_id }}"
+ enable_persistent: "{{ enable_persistent }}"
+
+ - service: script.notify_voice
+ data_template:
+ media_player: "{{ media_player }}"
+ volume_level: "{{ volume_level }}"
+ language: "{{ language }}"
+ message: "{{ message }}"
--- /dev/null
+######################################################################
+# Shelly: Upgrade
+# - mqtt.publish
+######################################################################
+
+shelly_upgrade:
+ alias: "Shelly: Aggiornamento Firmware"
+ sequence:
+ # Shelly 2 Tapparella Cucina
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shellyswitch-55980F/command'
+ payload: 'update_fw'
+
+ # Shelly 2 Tapparella Sala
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shellyswitch25-6919BD/command'
+ payload: 'update_fw'
+
+ # Shelly 2 Tapparella Studio
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shellyswitch-13572B/command'
+ payload: 'update_fw'
+
+ # Shelly 2 Tapparella Camera
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shellyswitch-559C49/command'
+ payload: 'update_fw'
+
+ # Shelly 1 Luce Corridoio
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shelly1-24D1EE/command'
+ payload: 'update_fw'
+
+ # Shelly 1 Luce Cucina
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shelly1-93B27D/command'
+ payload: 'update_fw'
+
+ # Shelly 1 Luce Sala
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shelly1-C426F9/command'
+ payload: 'update_fw'
+
+ # Shelly Bulb Luce Divano
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shellybulb-BC8610/command'
+ payload: 'update_fw'
+
+ # Shelly 2.5 Luci Bagno
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shellyswitch25-7457D8/command'
+ payload: 'update_fw'
+
+ # Shelly 1 Luce Studio
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shelly1-59E18C/command'
+ payload: 'update_fw'
+
+ # Shelly Dimmer Luce Camera
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shellydimmer-D46CF2/command'
+ payload: 'update_fw'
+
+ # Shelly 1 Luce Balcone
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shelly1-C423C8/command'
+ payload: 'update_fw'
+
+ # Shelly EM
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shellyem-B9E1A0/command'
+ payload: 'update_fw'
+
+ # Shelly Door/Window
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shellydw-B88F53/command'
+ payload: 'update_fw'
+
+ # Shelly Plug S
+ - service: mqtt.publish
+ data:
+ topic: 'shellies/shellyplug-s-7A31CB/command'
+ payload: 'update_fw'
+
+# # Shelly 1 TBD
+# - service: mqtt.publish
+# data:
+# topic: 'shellies/shelly1-24D1A8/command'
+# payload: 'update_fw'
+
+######################################################################
+# Shelly: Reboot
+# - shell_command.shelly_reboot
+######################################################################
+shelly_reboot:
+ alias: "Shelly: Riavvia Dispositivi"
+ sequence:
+ - service: shell_command.shelly_reboot
--- /dev/null
+######################################################################
+# Script: Speech Engine
+# Inputs:
+# - media_player
+# - volume_level
+# - message
+# - enable_greeting
+# - enable_status
+# - enable_location
+# - location_people_start
+# - location_people_num
+# - enable_car
+#
+# Operations:
+# - script.notify_voice (greeting + message)
+######################################################################
+
+speech_engine:
+ alias: Speech Engine
+ sequence:
+ - service: script.notify_voice
+ data_template:
+ media_player: "{{ media_player }}"
+ volume_level: "{{ volume_level }}"
+ message: !include ../templates/speech_message.yaml
+
+######################################################################
+# Script: Speech Status
+#
+# Operations:
+# - script.speech_engine
+######################################################################
+
+speech_status:
+ alias: Stato Casa
+ sequence:
+ - service: script.speech_engine
+ data:
+ enable_greeting: 1
+ enable_status: 1
+
+######################################################################
+# Speech Consumption
+#
+# Operations:
+# - script.speech_engine
+######################################################################
+
+speech_consumption:
+ alias: Consumo Energetico
+ sequence:
+ - service: script.speech_engine
+ data_template:
+ message: >-
+ "Il consumo istantaneo è pari a {{ states.sensor.potenza_istantanea.state }} watt"
+++ /dev/null
-######################################################################\r
-# WXKG01LM - Xiaomi MiJia wireless switch\r
-######################################################################\r
-\r
-- platform: "mqtt"\r
- name: "Pulsante: Stato"\r
- state_topic: "zigbee2mqtt/wireless_switch"\r
- availability_topic: "zigbee2mqtt/bridge/state"\r
- icon: "mdi:toggle-switch"\r
- value_template: "{{ value_json.click }}"\r
--- /dev/null
+######################################################################\r
+# WXKG01LM - Xiaomi MiJia wireless switch\r
+######################################################################\r
+\r
+- platform: "mqtt"\r
+ name: "Pulsante: Stato"\r
+ state_topic: "zigbee2mqtt/wireless_switch"\r
+ availability_topic: "zigbee2mqtt/bridge/state"\r
+ icon: "mdi:toggle-switch"\r
+ value_template: "{{ value_json.click }}"\r
+++ /dev/null
-######################################################################
-# MCCGQ01LM - Xiaomi MiJia door & window contact sensor
-######################################################################
-
-- platform: "mqtt"
- name: "Porta Casa: Batteria"
- state_topic: "zigbee2mqtt/main_door"
- availability_topic: "zigbee2mqtt/bridge/state"
- unit_of_measurement: "%"
- device_class: "battery"
- value_template: "{{ value_json.battery }}"
-
-- platform: "mqtt"
- name: "Porta Casa: Stato Link"
- state_topic: "zigbee2mqtt/main_door"
- availability_topic: "zigbee2mqtt/bridge/state"
- unit_of_measurement: "%"
- value_template: "{{ value_json.linkquality }}"
-
-######################################################################
-# MCCGQ11LM - Xiaomi Aqara door & window contact sensor
-######################################################################
-
-- platform: "mqtt"
- name: "Porta Casa 2: Batteria"
- state_topic: "zigbee2mqtt/spare_door"
- availability_topic: "zigbee2mqtt/bridge/state"
- unit_of_measurement: "%"
- device_class: "battery"
- value_template: "{{ value_json.battery }}"
-
-- platform: "mqtt"
- name: "Porta Casa 2: Stato Link"
- state_topic: "zigbee2mqtt/spare_door"
- availability_topic: "zigbee2mqtt/bridge/state"
- unit_of_measurement: "%"
- value_template: "{{ value_json.linkquality }}"
-
-######################################################################
-# WXKG01LM - Xiaomi MiJia wireless switch
-######################################################################
-
-- platform: "mqtt"
- name: "Pulsante: Batteria"
- state_topic: "zigbee2mqtt/wireless_switch"
- availability_topic: "zigbee2mqtt/bridge/state"
- unit_of_measurement: "%"
- device_class: "battery"
- value_template: "{{ value_json.battery }}"
-
-- platform: "mqtt"
- name: "Pulsante: Stato Link"
- state_topic: "zigbee2mqtt/wireless_switch"
- availability_topic: "zigbee2mqtt/bridge/state"
- unit_of_measurement: "-"
- value_template: "{{ value_json.linkquality }}"
--- /dev/null
+######################################################################
+# MCCGQ01LM - Xiaomi MiJia door & window contact sensor
+######################################################################
+
+- platform: "mqtt"
+ name: "Porta Casa: Batteria"
+ state_topic: "zigbee2mqtt/main_door"
+ availability_topic: "zigbee2mqtt/bridge/state"
+ unit_of_measurement: "%"
+ device_class: "battery"
+ value_template: "{{ value_json.battery }}"
+
+- platform: "mqtt"
+ name: "Porta Casa: Stato Link"
+ state_topic: "zigbee2mqtt/main_door"
+ availability_topic: "zigbee2mqtt/bridge/state"
+ unit_of_measurement: "%"
+ value_template: "{{ value_json.linkquality }}"
+
+######################################################################
+# MCCGQ11LM - Xiaomi Aqara door & window contact sensor
+######################################################################
+
+- platform: "mqtt"
+ name: "Porta Casa 2: Batteria"
+ state_topic: "zigbee2mqtt/spare_door"
+ availability_topic: "zigbee2mqtt/bridge/state"
+ unit_of_measurement: "%"
+ device_class: "battery"
+ value_template: "{{ value_json.battery }}"
+
+- platform: "mqtt"
+ name: "Porta Casa 2: Stato Link"
+ state_topic: "zigbee2mqtt/spare_door"
+ availability_topic: "zigbee2mqtt/bridge/state"
+ unit_of_measurement: "%"
+ value_template: "{{ value_json.linkquality }}"
+
+######################################################################
+# WXKG01LM - Xiaomi MiJia wireless switch
+######################################################################
+
+- platform: "mqtt"
+ name: "Pulsante: Batteria"
+ state_topic: "zigbee2mqtt/wireless_switch"
+ availability_topic: "zigbee2mqtt/bridge/state"
+ unit_of_measurement: "%"
+ device_class: "battery"
+ value_template: "{{ value_json.battery }}"
+
+- platform: "mqtt"
+ name: "Pulsante: Stato Link"
+ state_topic: "zigbee2mqtt/wireless_switch"
+ availability_topic: "zigbee2mqtt/bridge/state"
+ unit_of_measurement: "-"
+ value_template: "{{ value_json.linkquality }}"