Skip to content

Commit

Permalink
Beginning preparation for a stable release
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosweet committed Jun 16, 2023
1 parent 0b5a1d6 commit baf3fe8
Show file tree
Hide file tree
Showing 17 changed files with 1,271 additions and 771 deletions.
100 changes: 36 additions & 64 deletions blueprints/automation/caiosweet/notifier_startup_configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ blueprint:
name: Personal Assistant
description: |-
Imposta il nome del tuo assistente personale.
Verrà utilizzato nei titoli dei messaggi testuali e in dashborad.
Verrà utilizzato nei titoli dei messaggi testuali, in plancia, e nelle notifiche di home assistant.
Esempio **[Jarvis - 20:43:12] Garage**
_Choose a name for your personal assistant_
Expand Down Expand Up @@ -252,8 +252,7 @@ blueprint:
sip_server_name:
name: Service Sip server name
description: |-
N. Tel / @user: inserire qui il numero di telefono da chiamare o l’utente telegram.
[Addon](https://github.com/sdesalve/hassio-addons/tree/master/dss_voip) del nostro Admin SDesalve o chiamata tramite [CallMeBot Telegram](https://www.callmebot.com/telegram-call-api/)
Inserire il servizio utilizzato nell'[Addon](https://github.com/sdesalve/hassio-addons/tree/master/dss_voip) del nostro Admin SDesalve
_Service Sip server name_
default: fritz.box:5060
Expand Down Expand Up @@ -478,7 +477,7 @@ action:
entities: >-
{# Backword compatible .endswith('hub') #}
{{states.automation
| select('match','.*[_\s]hub|.*notifier[_\s]', ignorecase=True)
| select('match','.*[_\s]hub|.*notifier[_\s]|centro.notifiche[_\s]', ignorecase=True)
| map(attribute='entity_id') | list }}
- alias: "Creation of the notifier_location_tracker Group from Person"
Expand All @@ -505,25 +504,6 @@ action:
object_id: notifier_player_google
entities: "{{ google_media_player }}"

- alias: "IF DEBUG - GROUP SETTING"
if: "{{ debug }}"
then:
- service: persistent_notification.create
data:
notification_id: "centro_notifiche_config_group"
title: "GROUP Setting"
message: |
```yaml
___
AUTO GROUPS
PERSON: {{ state_attr('group.notifier_location_tracker', 'entity_id') }}
ALEXA: {{ state_attr('group.notifier_player_alexa', 'entity_id') }}
GOOGLE: {{ state_attr('group.notifier_player_google', 'entity_id') }}
___
INTERATION: {{ integration_entities('group') }}
___
```
- alias: "Set the default settings to get started"
if:
- "{{ is_script }}"
Expand Down Expand Up @@ -716,7 +696,7 @@ action:
message: |-
{% set message = data %}
```json
{{ message | to_json(pretty_print=true,sort_keys=False) }}
{{ message | to_json(pretty_print=true,sort_keys=True) }}
```
#------------------------------------------------------------------------------------#
Expand Down Expand Up @@ -846,7 +826,6 @@ action:
{% set DEFAULT_NOTIFY = iif(CN_NOTIFY in ['unavailable', 'unknown'], HA_NOTIFY, CN_NOTIFY)%}
{{ iif(DEFAULT_NOTIFY is string, (DEFAULT_NOTIFY
| regex_replace(find=" *, *", replace=",") | lower).rsplit(","), DEFAULT_NOTIFY) }}
ha_start: "{{ states('sensor.ha_start') }}"
start_message: >-
{{ iif(states('sensor.notifier_config') != "",
states('sensor.notifier_config'), 'Il sistema ') }} è operativo!.
Expand All @@ -861,42 +840,35 @@ action:
title: "{{ icon }} {{ title }}"
message: |
➡ {{ time }}
- choose:
- conditions:
- "{{ 'start' in title }}"
- "{{ is_script }}"
sequence:
- if: "{{ states.sensor.ha_start.state is defined }}"
then:
- service: homeassistant.update_entity
entity_id:
- sensor.ha_start
- sensor.verifica_tempi_setup
- wait_template: "{{ is_state('sensor.notifier_debug_error', 'on') }}"
# - wait_for_trigger:
# - platform: state
# entity_id: sensor.notifier_debug_error
# to:
# - "on"
# - "OK"
timeout: 120
continue_on_timeout: true
- service: script.my_notify
data:
title: "HomeAssistant Start!"
notify: "notify.{{ notify_name }}"
message: |
📬 {{ start_message }} 🕵
🟩 {{ iif(ha_start != 'unknown', ha_start, states('sensor.notifier_debug_error')) }}
alexa:
mode: "{{ repeat.index == 1 }}"
message: "{{ start_message }}"
voice: Giorgio
type: tts
google:
mode: "{{ repeat.index == 1 }}"
message: "{{ start_message }}"
# default:
# - service: "notify.{{ notify_service[0] }}"
# data:
# message: "DEFAULT: {{ icon }} {{ title }} {{ this.entity_id }}"
- if:
- "{{ 'start' in title }}"
- "{{ is_script }}"
then:
- wait_template: "{{ is_state('sensor.notifier_debug_error', 'on') }}"
timeout: 180
continue_on_timeout: true
- if:
- "{{ states.sensor.ha_start.state is defined }}"
then:
- service: homeassistant.update_entity
entity_id:
- sensor.ha_start
# - sensor.verifica_tempi_setup
- wait_template: "{{ states('sensor.ha_start') not in ['Error', 'unknown'] }}"
timeout: "{{ wait.remaining }}"
- service: script.my_notify
data:
title: "HomeAssistant Start!"
notify: "notify.{{ notify_name }}"
message: |
📬 {{ start_message }} 🕵
🟩 {{ iif(states('sensor.ha_start') != 'unknown',
states('sensor.ha_start'), states('sensor.notifier_debug_error')) }}
alexa:
mode: "{{ repeat.index == 1 }}"
message: "{{ start_message }}"
voice: Giorgio
type: tts
google:
mode: "{{ repeat.index == 1 }}"
message: "{{ start_message }}"
174 changes: 87 additions & 87 deletions examples/hub_automations.yaml → examples/example_automations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,93 +6,93 @@ automation:
#----------------------------------------------------------------------------------------------------#
# Home Assistant Start/Final Write/Close/Stop/Restart
#----------------------------------------------------------------------------------------------------#
- alias: Home Assistant Start Stop Hub
description: "Notification Home Assistant Start/Final Write/Close/Stop/Restart"
initial_state: true
mode: queued
max_exceeded: silent
trigger:
- platform: homeassistant
event: start
- platform: homeassistant
event: shutdown
- platform: event
event_type: homeassistant_final_write
- platform: event
event_type: homeassistant_close
- platform: event
event_type: call_service
event_data:
domain: homeassistant
service: restart
- platform: event
event_type: core_config_updated
action:
- variables:
title: >
{{ (trigger.description | regex_replace(find="\W|_|event", replace=" ") | trim | capitalize)
if trigger.description is defined else "TEST" }}
time: "{{(now().time()|string)[:-4]}}"
icon: >
{% if 'stop' in title %}🛑
{% elif 'final' in title %}🏁
{% elif 'close' in title %}⛔
{% elif 'restart' in title %}👍👍
{% elif 'start' in title %}👍
{% elif 'Call' in title %}📞
{% else %}❗❓
{% endif %}
notify_service: >-
{% set DEFAULT_NOTIFY = states('input_select.notifier_text_notify') %}
{{ (DEFAULT_NOTIFY|replace('notify.','')|regex_replace(find=" *, *", replace=",")|lower).rsplit(",")
if DEFAULT_NOTIFY is string else DEFAULT_NOTIFY }}
- choose:
- conditions: "{{ title != 'TEST' }}"
sequence:
- alias: "Repeat text notify"
repeat:
while: "{{ repeat.index <= notify_service | length }}"
sequence:
- variables:
notify_name: "{{ notify_service[repeat.index -1] | replace(' ','_') | lower }}"
- service: "notify.{{ notify_name }}"
data:
title: "{{ icon }} {{ title }}"
message: |
➡ {{ time }}
- choose:
- conditions: "{{ 'start' in title }}"
sequence:
- service: homeassistant.update_entity
entity_id:
- sensor.ha_start
- sensor.verifica_tempi_setup
- wait_for_trigger:
- platform: state
entity_id: sensor.notifier_debug_error
to: "on"
timeout: 120
continue_on_timeout: true
- service: script.my_notify
data:
title: "HomeAssistant Start!"
notify: "notify.{{ notify_name }}"
message: |
📬 Centro Notifiche operativo! 🕵
🟩 {{ states('sensor.ha_start') }}
alexa:
message: >-
Il sistema è operativo!.
voice: Giorgio
type: tts
google:
priority: true
message: >-
Il sistema è operativo!.
default:
- service: "notify.{{ (notify_service | default(['notify']))[0] | replace(' ','_') | lower }}"
data:
message: "DEFAULT: {{ icon }} {{ title }} {{ trigger | replace('_','\_') }} {{ this | replace('_','\_') }}"
# - alias: Home Assistant Start Stop Hub
# description: "Notification Home Assistant Start/Final Write/Close/Stop/Restart"
# initial_state: true
# mode: queued
# max_exceeded: silent
# trigger:
# - platform: homeassistant
# event: start
# - platform: homeassistant
# event: shutdown
# - platform: event
# event_type: homeassistant_final_write
# - platform: event
# event_type: homeassistant_close
# - platform: event
# event_type: call_service
# event_data:
# domain: homeassistant
# service: restart
# - platform: event
# event_type: core_config_updated
# action:
# - variables:
# title: >
# {{ (trigger.description | regex_replace(find="\W|_|event", replace=" ") | trim | capitalize)
# if trigger.description is defined else "TEST" }}
# time: "{{(now().time()|string)[:-4]}}"
# icon: >
# {% if 'stop' in title %}🛑
# {% elif 'final' in title %}🏁
# {% elif 'close' in title %}⛔
# {% elif 'restart' in title %}👍👍
# {% elif 'start' in title %}👍
# {% elif 'Call' in title %}📞
# {% else %}❗❓
# {% endif %}
# notify_service: >-
# {% set DEFAULT_NOTIFY = states('input_select.notifier_text_notify') %}
# {{ (DEFAULT_NOTIFY|replace('notify.','')|regex_replace(find=" *, *", replace=",")|lower).rsplit(",")
# if DEFAULT_NOTIFY is string else DEFAULT_NOTIFY }}
# - choose:
# - conditions: "{{ title != 'TEST' }}"
# sequence:
# - alias: "Repeat text notify"
# repeat:
# while: "{{ repeat.index <= notify_service | length }}"
# sequence:
# - variables:
# notify_name: "{{ notify_service[repeat.index -1] | replace(' ','_') | lower }}"
# - service: "notify.{{ notify_name }}"
# data:
# title: "{{ icon }} {{ title }}"
# message: |
# ➡ {{ time }}
# - choose:
# - conditions: "{{ 'start' in title }}"
# sequence:
# - service: homeassistant.update_entity
# entity_id:
# - sensor.ha_start
# - sensor.verifica_tempi_setup
# - wait_for_trigger:
# - platform: state
# entity_id: sensor.notifier_debug_error
# to: "on"
# timeout: 120
# continue_on_timeout: true
# - service: script.my_notify
# data:
# title: "HomeAssistant Start!"
# notify: "notify.{{ notify_name }}"
# message: |
# 📬 Centro Notifiche operativo! 🕵
# 🟩 {{ states('sensor.ha_start') }}
# alexa:
# message: >-
# Il sistema è operativo!.
# voice: Giorgio
# type: tts
# google:
# priority: true
# message: >-
# Il sistema è operativo!.
# default:
# - service: "notify.{{ (notify_service | default(['notify']))[0] | replace(' ','_') | lower }}"
# data:
# message: "DEFAULT: {{ icon }} {{ title }} {{ trigger | replace('_','\_') }} {{ this | replace('_','\_') }}"

#----------------------------------------------------------------------------------------------------#
# Accesso Fallito # Banned IP persistent_notification.ip_ban title: Banning IP address
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit baf3fe8

Please sign in to comment.