From: Giorgio Ravera Date: Thu, 21 May 2020 15:10:31 +0000 (+0200) Subject: change name to folder scripts automations and groups X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=50f1071908a6dc9311602c1b79771adec314254b;p=homeassistant.git change name to folder scripts automations and groups --- diff --git a/automation/away_mode.yaml b/automation/away_mode.yaml deleted file mode 100644 index 64bc9c3a..00000000 --- a/automation/away_mode.yaml +++ /dev/null @@ -1,44 +0,0 @@ -###################################################################### -# 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 diff --git a/automation/climate.yaml b/automation/climate.yaml deleted file mode 100644 index 4f14a9e2..00000000 --- a/automation/climate.yaml +++ /dev/null @@ -1,122 +0,0 @@ -###################################################################### -# 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 diff --git a/automation/day.yaml b/automation/day.yaml deleted file mode 100644 index 35e77a28..00000000 --- a/automation/day.yaml +++ /dev/null @@ -1,30 +0,0 @@ -###################################################################### -# 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 diff --git a/automation/doors.yaml b/automation/doors.yaml deleted file mode 100644 index d66b7efe..00000000 --- a/automation/doors.yaml +++ /dev/null @@ -1,29 +0,0 @@ -###################################################################### -# 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' diff --git a/automation/energy.yaml b/automation/energy.yaml deleted file mode 100644 index 6151b2d4..00000000 --- a/automation/energy.yaml +++ /dev/null @@ -1,19 +0,0 @@ -###################################################################### -# 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 diff --git a/automation/home_assistant.yaml b/automation/home_assistant.yaml deleted file mode 100644 index 5ea0785c..00000000 --- a/automation/home_assistant.yaml +++ /dev/null @@ -1,129 +0,0 @@ -###################################################################### -# 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 diff --git a/automation/media_player.yaml b/automation/media_player.yaml deleted file mode 100644 index dcb49015..00000000 --- a/automation/media_player.yaml +++ /dev/null @@ -1,19 +0,0 @@ -###################################################################### -# 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 }}" diff --git a/automation/night.yaml b/automation/night.yaml deleted file mode 100644 index 99870b4c..00000000 --- a/automation/night.yaml +++ /dev/null @@ -1,28 +0,0 @@ -###################################################################### -# 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 diff --git a/automation/speech.yaml b/automation/speech.yaml deleted file mode 100644 index 5d9acdd5..00000000 --- a/automation/speech.yaml +++ /dev/null @@ -1,94 +0,0 @@ -###################################################################### -# 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." diff --git a/automation/startup.yaml b/automation/startup.yaml deleted file mode 100644 index 446f798e..00000000 --- a/automation/startup.yaml +++ /dev/null @@ -1,29 +0,0 @@ -###################################################################### -# Startup Automation: Restart on Error -###################################################################### - -- alias: "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: "Startup: Google Sync" - - trigger: - - platform: homeassistant - event: start - - action: - - service: script.homeassistant_google_home_sync diff --git a/automation/test_mode.yaml b/automation/test_mode.yaml deleted file mode 100644 index 1b970c51..00000000 --- a/automation/test_mode.yaml +++ /dev/null @@ -1,38 +0,0 @@ -###################################################################### -# Test Mode: Enable Action -###################################################################### - -- alias: "Modalità Test: Azione on" - initial_state: 'on' - - trigger: - - platform: state - entity_id: input_boolean.test_mode - to: 'on' - - action: - - - 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 diff --git a/automation/themes.yaml b/automation/themes.yaml deleted file mode 100644 index 6cba55e6..00000000 --- a/automation/themes.yaml +++ /dev/null @@ -1,31 +0,0 @@ -###################################################################### -# 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 %} diff --git a/automation/update_notifications.yaml b/automation/update_notifications.yaml deleted file mode 100644 index 965642ee..00000000 --- a/automation/update_notifications.yaml +++ /dev/null @@ -1,106 +0,0 @@ -###################################################################### -# Update Notification: Home Assistant -###################################################################### - -- alias: "Update Notification: Home Assistant" - initial_state: 'on' - - trigger: - - platform: state - entity_id: binary_sensor.updater - to: 'on' - - - platform: homeassistant - event: start - - condition: - condition: state - entity_id: binary_sensor.updater - state: 'on' - - action: - - delay: '00:00:5' - - service: script.notify_text - data_template: - title: "Home Assistant - Aggiornamento" - message: "E' disponibile un aggiornamento per Home Assistant {{ state_attr('binary_sensor.updater', 'newest_version') }}. {{now().strftime('%Y-%m-%d %I:%M %p')}}" - notification_id: "update" - enable_persistent: 1 - - - service: input_boolean.turn_on - entity_id: input_boolean.update - -###################################################################### -# Update Notification: Shelly -###################################################################### - -- alias: "Update Notification: Shelly" - initial_state: 'on' - - trigger: - - platform: state - entity_id: group.shelly - to: 'on' - - - platform: homeassistant - event: start - - condition: - condition: state - entity_id: group.shelly - state: 'on' - - action: - - delay: '00:00:10' - - service: script.notify_text - data_template: - title: "Shelly - Aggiornamento" - message: "Sono disponibili aggiornamenti per i dispositivi Shelly" - notification_id: "update" - enable_persistent: 1 - - - service: input_boolean.turn_on - entity_id: input_boolean.update - -###################################################################### -# Update Notification: HACS -###################################################################### - -- alias: "Update Notification: HACS" - initial_state: 'on' - - trigger: - - platform: numeric_state - entity_id: sensor.hacs - above: 0 - - action: - - delay: '00:00:15' - - service: script.notify_text - data_template: - title: "HACS - Aggiornamento" - message: "Sono disponibili aggiornamenti per i moduli HACS" - notification_id: "update" - enable_persistent: 1 - - - service: input_boolean.turn_on - entity_id: input_boolean.update - -###################################################################### -# Update: Aknowledge update -# -# Actions: -# - persistent_notification.dismiss -###################################################################### -- alias: "Update: Riconoscimento Aggiornamenti" - initial_state: 'on' - - trigger: - platform: state - entity_id: input_boolean.update - to: 'off' - - action: - - service: persistent_notification.dismiss - data_template: - notification_id: "update" diff --git a/automations/away_mode.yaml b/automations/away_mode.yaml new file mode 100644 index 00000000..64bc9c3a --- /dev/null +++ b/automations/away_mode.yaml @@ -0,0 +1,44 @@ +###################################################################### +# 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 diff --git a/automations/climate.yaml b/automations/climate.yaml new file mode 100644 index 00000000..4f14a9e2 --- /dev/null +++ b/automations/climate.yaml @@ -0,0 +1,122 @@ +###################################################################### +# 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 diff --git a/automations/day.yaml b/automations/day.yaml new file mode 100644 index 00000000..35e77a28 --- /dev/null +++ b/automations/day.yaml @@ -0,0 +1,30 @@ +###################################################################### +# 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 diff --git a/automations/doors.yaml b/automations/doors.yaml new file mode 100644 index 00000000..d66b7efe --- /dev/null +++ b/automations/doors.yaml @@ -0,0 +1,29 @@ +###################################################################### +# 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' diff --git a/automations/energy.yaml b/automations/energy.yaml new file mode 100644 index 00000000..6151b2d4 --- /dev/null +++ b/automations/energy.yaml @@ -0,0 +1,19 @@ +###################################################################### +# 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 diff --git a/automations/home_assistant.yaml b/automations/home_assistant.yaml new file mode 100644 index 00000000..5ea0785c --- /dev/null +++ b/automations/home_assistant.yaml @@ -0,0 +1,129 @@ +###################################################################### +# 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 diff --git a/automations/media_player.yaml b/automations/media_player.yaml new file mode 100644 index 00000000..dcb49015 --- /dev/null +++ b/automations/media_player.yaml @@ -0,0 +1,19 @@ +###################################################################### +# 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 }}" diff --git a/automations/night.yaml b/automations/night.yaml new file mode 100644 index 00000000..99870b4c --- /dev/null +++ b/automations/night.yaml @@ -0,0 +1,28 @@ +###################################################################### +# 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 diff --git a/automations/speech.yaml b/automations/speech.yaml new file mode 100644 index 00000000..5d9acdd5 --- /dev/null +++ b/automations/speech.yaml @@ -0,0 +1,94 @@ +###################################################################### +# 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." diff --git a/automations/startup.yaml b/automations/startup.yaml new file mode 100644 index 00000000..446f798e --- /dev/null +++ b/automations/startup.yaml @@ -0,0 +1,29 @@ +###################################################################### +# Startup Automation: Restart on Error +###################################################################### + +- alias: "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: "Startup: Google Sync" + + trigger: + - platform: homeassistant + event: start + + action: + - service: script.homeassistant_google_home_sync diff --git a/automations/test_mode.yaml b/automations/test_mode.yaml new file mode 100644 index 00000000..1b970c51 --- /dev/null +++ b/automations/test_mode.yaml @@ -0,0 +1,38 @@ +###################################################################### +# Test Mode: Enable Action +###################################################################### + +- alias: "Modalità Test: Azione on" + initial_state: 'on' + + trigger: + - platform: state + entity_id: input_boolean.test_mode + to: 'on' + + action: + + - 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 diff --git a/automations/themes.yaml b/automations/themes.yaml new file mode 100644 index 00000000..6cba55e6 --- /dev/null +++ b/automations/themes.yaml @@ -0,0 +1,31 @@ +###################################################################### +# 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 %} diff --git a/automations/update_notifications.yaml b/automations/update_notifications.yaml new file mode 100644 index 00000000..965642ee --- /dev/null +++ b/automations/update_notifications.yaml @@ -0,0 +1,106 @@ +###################################################################### +# Update Notification: Home Assistant +###################################################################### + +- alias: "Update Notification: Home Assistant" + initial_state: 'on' + + trigger: + - platform: state + entity_id: binary_sensor.updater + to: 'on' + + - platform: homeassistant + event: start + + condition: + condition: state + entity_id: binary_sensor.updater + state: 'on' + + action: + - delay: '00:00:5' + - service: script.notify_text + data_template: + title: "Home Assistant - Aggiornamento" + message: "E' disponibile un aggiornamento per Home Assistant {{ state_attr('binary_sensor.updater', 'newest_version') }}. {{now().strftime('%Y-%m-%d %I:%M %p')}}" + notification_id: "update" + enable_persistent: 1 + + - service: input_boolean.turn_on + entity_id: input_boolean.update + +###################################################################### +# Update Notification: Shelly +###################################################################### + +- alias: "Update Notification: Shelly" + initial_state: 'on' + + trigger: + - platform: state + entity_id: group.shelly + to: 'on' + + - platform: homeassistant + event: start + + condition: + condition: state + entity_id: group.shelly + state: 'on' + + action: + - delay: '00:00:10' + - service: script.notify_text + data_template: + title: "Shelly - Aggiornamento" + message: "Sono disponibili aggiornamenti per i dispositivi Shelly" + notification_id: "update" + enable_persistent: 1 + + - service: input_boolean.turn_on + entity_id: input_boolean.update + +###################################################################### +# Update Notification: HACS +###################################################################### + +- alias: "Update Notification: HACS" + initial_state: 'on' + + trigger: + - platform: numeric_state + entity_id: sensor.hacs + above: 0 + + action: + - delay: '00:00:15' + - service: script.notify_text + data_template: + title: "HACS - Aggiornamento" + message: "Sono disponibili aggiornamenti per i moduli HACS" + notification_id: "update" + enable_persistent: 1 + + - service: input_boolean.turn_on + entity_id: input_boolean.update + +###################################################################### +# Update: Aknowledge update +# +# Actions: +# - persistent_notification.dismiss +###################################################################### +- alias: "Update: Riconoscimento Aggiornamenti" + initial_state: 'on' + + trigger: + platform: state + entity_id: input_boolean.update + to: 'off' + + action: + - service: persistent_notification.dismiss + data_template: + notification_id: "update" diff --git a/binary_sensor/doors.yaml b/binary_sensor/doors.yaml deleted file mode 100644 index 0ed9ae29..00000000 --- a/binary_sensor/doors.yaml +++ /dev/null @@ -1,25 +0,0 @@ -###################################################################### -# 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" diff --git a/binary_sensor/doors.yaml.disabled b/binary_sensor/doors.yaml.disabled new file mode 100644 index 00000000..0ed9ae29 --- /dev/null +++ b/binary_sensor/doors.yaml.disabled @@ -0,0 +1,25 @@ +###################################################################### +# 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" diff --git a/group/climate.yaml b/group/climate.yaml deleted file mode 100644 index 8f68f5da..00000000 --- a/group/climate.yaml +++ /dev/null @@ -1,13 +0,0 @@ -###################################################################### -# Group Climate -###################################################################### - -climate: - name: Termostato - icon: mdi:thermometer - entities: - - sensor.termostato_cucina - - sensor.termostato_sala - - sensor.termostato_bagno - - sensor.termostato_studio - - sensor.termostato_camera diff --git a/group/covers.yaml b/group/covers.yaml deleted file mode 100644 index e9b86c48..00000000 --- a/group/covers.yaml +++ /dev/null @@ -1,13 +0,0 @@ -###################################################################### -# 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 diff --git a/group/doors.yaml b/group/doors.yaml deleted file mode 100644 index 263b1e37..00000000 --- a/group/doors.yaml +++ /dev/null @@ -1,9 +0,0 @@ -###################################################################### -# Group Lights -###################################################################### - -doors: - name: Porte - icon: mdi:door - entities: - - binary_sensor.porta_casa diff --git a/group/lights.yaml b/group/lights.yaml deleted file mode 100644 index 30bf7dca..00000000 --- a/group/lights.yaml +++ /dev/null @@ -1,17 +0,0 @@ -###################################################################### -# 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 diff --git a/group/lights_bathroom.yaml b/group/lights_bathroom.yaml deleted file mode 100644 index fb3207e1..00000000 --- a/group/lights_bathroom.yaml +++ /dev/null @@ -1,10 +0,0 @@ -###################################################################### -# Group Lights Bathroom -###################################################################### - -lights_bathroom: - name: Luci Bagno - icon: mdi:lightbulb - entities: - - light.luce_bagno - - light.luce_specchio diff --git a/group/lights_livingroom.yaml b/group/lights_livingroom.yaml deleted file mode 100644 index 10ca1036..00000000 --- a/group/lights_livingroom.yaml +++ /dev/null @@ -1,11 +0,0 @@ -###################################################################### -# Group Lights Livingroom -###################################################################### - -lights_livingroom: - name: Luci Sala - icon: mdi:lightbulb - entities: - - light.luce_sala - - light.luce_divano -# - light.luce_divano_bianca diff --git a/group/people.yaml b/group/people.yaml deleted file mode 100644 index 9c9559ed..00000000 --- a/group/people.yaml +++ /dev/null @@ -1,33 +0,0 @@ -###################################################################### -# 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 diff --git a/group/shelly.yaml b/group/shelly.yaml deleted file mode 100644 index be320201..00000000 --- a/group/shelly.yaml +++ /dev/null @@ -1,23 +0,0 @@ -###################################################################### -# 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 diff --git a/groups/climate.yaml b/groups/climate.yaml new file mode 100644 index 00000000..8f68f5da --- /dev/null +++ b/groups/climate.yaml @@ -0,0 +1,13 @@ +###################################################################### +# Group Climate +###################################################################### + +climate: + name: Termostato + icon: mdi:thermometer + entities: + - sensor.termostato_cucina + - sensor.termostato_sala + - sensor.termostato_bagno + - sensor.termostato_studio + - sensor.termostato_camera diff --git a/groups/covers.yaml b/groups/covers.yaml new file mode 100644 index 00000000..e9b86c48 --- /dev/null +++ b/groups/covers.yaml @@ -0,0 +1,13 @@ +###################################################################### +# 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 diff --git a/groups/doors.yaml b/groups/doors.yaml new file mode 100644 index 00000000..263b1e37 --- /dev/null +++ b/groups/doors.yaml @@ -0,0 +1,9 @@ +###################################################################### +# Group Lights +###################################################################### + +doors: + name: Porte + icon: mdi:door + entities: + - binary_sensor.porta_casa diff --git a/groups/lights.yaml b/groups/lights.yaml new file mode 100644 index 00000000..30bf7dca --- /dev/null +++ b/groups/lights.yaml @@ -0,0 +1,17 @@ +###################################################################### +# 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 diff --git a/groups/lights_bathroom.yaml b/groups/lights_bathroom.yaml new file mode 100644 index 00000000..fb3207e1 --- /dev/null +++ b/groups/lights_bathroom.yaml @@ -0,0 +1,10 @@ +###################################################################### +# Group Lights Bathroom +###################################################################### + +lights_bathroom: + name: Luci Bagno + icon: mdi:lightbulb + entities: + - light.luce_bagno + - light.luce_specchio diff --git a/groups/lights_livingroom.yaml b/groups/lights_livingroom.yaml new file mode 100644 index 00000000..10ca1036 --- /dev/null +++ b/groups/lights_livingroom.yaml @@ -0,0 +1,11 @@ +###################################################################### +# Group Lights Livingroom +###################################################################### + +lights_livingroom: + name: Luci Sala + icon: mdi:lightbulb + entities: + - light.luce_sala + - light.luce_divano +# - light.luce_divano_bianca diff --git a/groups/people.yaml b/groups/people.yaml new file mode 100644 index 00000000..9c9559ed --- /dev/null +++ b/groups/people.yaml @@ -0,0 +1,33 @@ +###################################################################### +# 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 diff --git a/groups/shelly.yaml b/groups/shelly.yaml new file mode 100644 index 00000000..be320201 --- /dev/null +++ b/groups/shelly.yaml @@ -0,0 +1,23 @@ +###################################################################### +# 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 diff --git a/script/audio.yaml b/script/audio.yaml deleted file mode 100644 index f4658f56..00000000 --- a/script/audio.yaml +++ /dev/null @@ -1,146 +0,0 @@ -###################################################################### -# 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' diff --git a/script/climate.yaml b/script/climate.yaml deleted file mode 100644 index 704c5d73..00000000 --- a/script/climate.yaml +++ /dev/null @@ -1,91 +0,0 @@ -###################################################################### -# 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 diff --git a/script/covers.yaml.disabled b/script/covers.yaml.disabled deleted file mode 100644 index d6aaa8a3..00000000 --- a/script/covers.yaml.disabled +++ /dev/null @@ -1,40 +0,0 @@ -###################################################################### -# 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 }}' diff --git a/script/home_assistant.yaml b/script/home_assistant.yaml deleted file mode 100644 index 4b0d41ec..00000000 --- a/script/home_assistant.yaml +++ /dev/null @@ -1,57 +0,0 @@ -###################################################################### -# 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 diff --git a/script/media_player.yaml b/script/media_player.yaml deleted file mode 100644 index 0a6258b9..00000000 --- a/script/media_player.yaml +++ /dev/null @@ -1,52 +0,0 @@ -###################################################################### -# 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 diff --git a/script/notify.yaml b/script/notify.yaml deleted file mode 100644 index 5c7382c9..00000000 --- a/script/notify.yaml +++ /dev/null @@ -1,197 +0,0 @@ -###################################################################### -# 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 }}" diff --git a/script/shelly.yaml b/script/shelly.yaml deleted file mode 100644 index d9b3ae48..00000000 --- a/script/shelly.yaml +++ /dev/null @@ -1,112 +0,0 @@ -###################################################################### -# 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 diff --git a/script/speech_engine.yaml b/script/speech_engine.yaml deleted file mode 100644 index 3c557650..00000000 --- a/script/speech_engine.yaml +++ /dev/null @@ -1,55 +0,0 @@ -###################################################################### -# 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" diff --git a/scripts/audio.yaml b/scripts/audio.yaml new file mode 100644 index 00000000..f4658f56 --- /dev/null +++ b/scripts/audio.yaml @@ -0,0 +1,146 @@ +###################################################################### +# 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' diff --git a/scripts/climate.yaml b/scripts/climate.yaml new file mode 100644 index 00000000..704c5d73 --- /dev/null +++ b/scripts/climate.yaml @@ -0,0 +1,91 @@ +###################################################################### +# 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 diff --git a/scripts/covers.yaml.disabled b/scripts/covers.yaml.disabled new file mode 100644 index 00000000..d6aaa8a3 --- /dev/null +++ b/scripts/covers.yaml.disabled @@ -0,0 +1,40 @@ +###################################################################### +# 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 }}' diff --git a/scripts/home_assistant.yaml b/scripts/home_assistant.yaml new file mode 100644 index 00000000..4b0d41ec --- /dev/null +++ b/scripts/home_assistant.yaml @@ -0,0 +1,57 @@ +###################################################################### +# 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 diff --git a/scripts/media_player.yaml b/scripts/media_player.yaml new file mode 100644 index 00000000..0a6258b9 --- /dev/null +++ b/scripts/media_player.yaml @@ -0,0 +1,52 @@ +###################################################################### +# 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 diff --git a/scripts/notify.yaml b/scripts/notify.yaml new file mode 100644 index 00000000..5c7382c9 --- /dev/null +++ b/scripts/notify.yaml @@ -0,0 +1,197 @@ +###################################################################### +# 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 }}" diff --git a/scripts/shelly.yaml b/scripts/shelly.yaml new file mode 100644 index 00000000..d9b3ae48 --- /dev/null +++ b/scripts/shelly.yaml @@ -0,0 +1,112 @@ +###################################################################### +# 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 diff --git a/scripts/speech_engine.yaml b/scripts/speech_engine.yaml new file mode 100644 index 00000000..3c557650 --- /dev/null +++ b/scripts/speech_engine.yaml @@ -0,0 +1,55 @@ +###################################################################### +# 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" diff --git a/sensor/switch.yaml b/sensor/switch.yaml deleted file mode 100644 index 135b29ee..00000000 --- a/sensor/switch.yaml +++ /dev/null @@ -1,10 +0,0 @@ -###################################################################### -# WXKG01LM - Xiaomi MiJia wireless switch -###################################################################### - -- platform: "mqtt" - name: "Pulsante: Stato" - state_topic: "zigbee2mqtt/wireless_switch" - availability_topic: "zigbee2mqtt/bridge/state" - icon: "mdi:toggle-switch" - value_template: "{{ value_json.click }}" diff --git a/sensor/switch.yaml.disabled b/sensor/switch.yaml.disabled new file mode 100644 index 00000000..135b29ee --- /dev/null +++ b/sensor/switch.yaml.disabled @@ -0,0 +1,10 @@ +###################################################################### +# WXKG01LM - Xiaomi MiJia wireless switch +###################################################################### + +- platform: "mqtt" + name: "Pulsante: Stato" + state_topic: "zigbee2mqtt/wireless_switch" + availability_topic: "zigbee2mqtt/bridge/state" + icon: "mdi:toggle-switch" + value_template: "{{ value_json.click }}" diff --git a/sensor/xiaomi.yaml b/sensor/xiaomi.yaml deleted file mode 100644 index 9dd97ce2..00000000 --- a/sensor/xiaomi.yaml +++ /dev/null @@ -1,56 +0,0 @@ -###################################################################### -# 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 }}" diff --git a/sensor/xiaomi.yaml.disabled b/sensor/xiaomi.yaml.disabled new file mode 100644 index 00000000..9dd97ce2 --- /dev/null +++ b/sensor/xiaomi.yaml.disabled @@ -0,0 +1,56 @@ +###################################################################### +# 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 }}"