From: Giorgio Ravera Date: Tue, 23 May 2023 02:16:05 +0000 (+0200) Subject: Created Update Package X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=17f1cc7ae6ec8ee5e3aa9b5c6b97dea647b1c34b;p=homeassistant.git Created Update Package --- diff --git a/automations/update_notifications.yaml b/automations/update_notifications.yaml deleted file mode 100644 index d4978471..00000000 --- a/automations/update_notifications.yaml +++ /dev/null @@ -1,60 +0,0 @@ -###################################################################### -# Update Notification: HACS -###################################################################### - -- alias: "Update Notification: HACS" - - trigger: - - platform: numeric_state - entity_id: sensor.hacs - above: 0 - - - platform: homeassistant - event: start - - condition: - condition: numeric_state - entity_id: sensor.hacs - above: 0 - - action: - - delay: '00:00:15' - - service: script.notify_text - data_template: - title: "HACS - Aggiornamento" - message: > - {% set update_number = states('sensor.hacs') %} - {% if is_state('sensor.hacs', '1') %} - E' disponibile un aggiornamento per i moduli HACS: - {% else %} - Sono disponibili {{ update_number }} aggiornamenti per i moduli HACS: - {% endif %} - {% for update in states.sensor.hacs.attributes['repositories'] %} - - {{ update['display_name'] }}: {{ update['available_version'] }} - {%- endfor %} - notification_id: "update" - enable_persistent: true - - - service: input_boolean.turn_on - entity_id: input_boolean.update_hacs - -###################################################################### -# Update: Aknowledge update -# -# Actions: -# - persistent_notification.dismiss -###################################################################### -- alias: "Update: Riconoscimento Aggiornamenti" - - trigger: - platform: state - entity_id: - - input_boolean.update_homeassistant - - input_boolean.update_shelly - - input_boolean.update_hacs - to: 'off' - - action: - - service: persistent_notification.dismiss - data_template: - notification_id: "update" diff --git a/groups/update.yaml b/groups/update.yaml deleted file mode 100644 index 9b4f7930..00000000 --- a/groups/update.yaml +++ /dev/null @@ -1,11 +0,0 @@ -###################################################################### -# Group Update Availability -###################################################################### - -update: - name: Aggiornamenti Disponibili - icon: mdi:cellphone-arrow-down - entities: - - input_boolean.update_homeassistant - - input_boolean.update_shelly - - input_boolean.update_hacs diff --git a/input_boolean/update.yaml b/input_boolean/update.yaml deleted file mode 100644 index d81bb04e..00000000 --- a/input_boolean/update.yaml +++ /dev/null @@ -1,26 +0,0 @@ -###################################################################### -# Update: Home Assistant -###################################################################### - -update_homeassistant: - name: Aggiornamento Home Assistant - initial: off - icon: mdi:cellphone-arrow-down - -###################################################################### -# Update: Shelly -###################################################################### - -update_shelly: - name: Aggiornamento Shelly - initial: off - icon: mdi:cellphone-arrow-down - -###################################################################### -# Update: HACS -###################################################################### - -update_hacs: - name: Aggiornamenti HACS - initial: off - icon: mdi:cellphone-arrow-down diff --git a/packages/update/update_engine.yaml b/packages/update/update_engine.yaml new file mode 100644 index 00000000..08752ad0 --- /dev/null +++ b/packages/update/update_engine.yaml @@ -0,0 +1,72 @@ +###################################################################### +# Update Package - Template - Sensor +###################################################################### + +#template: +# - sensor: +# # Pending Update +# - name: pending_update +# state: > +# {{ states.update | default([]) | selectattr('state','eq','on') | list | count | int(0) }} + +automation: + + ###################################################################### + # Update Notification: HACS + ###################################################################### + - alias: "Update: HACS Notification" + + trigger: + - platform: numeric_state + entity_id: sensor.hacs + above: 0 + + - platform: homeassistant + event: start + + condition: + condition: numeric_state + entity_id: sensor.hacs + above: 0 + + action: + - delay: '00:00:15' + - service: script.notify_text + data_template: + title: "HACS - Aggiornamento" + message: > + {% set update_number = states('sensor.hacs') %} + {% if is_state('sensor.hacs', '1') %} + E' disponibile un aggiornamento per i moduli HACS: + {% else %} + Sono disponibili {{ update_number }} aggiornamenti per i moduli HACS: + {% endif %} + {% for update in states.sensor.hacs.attributes['repositories'] %} + - {{ update['display_name'] }}: {{ update['available_version'] }} + {%- endfor %} + notification_id: "update" + enable_persistent: true + + - service: input_boolean.turn_on + entity_id: input_boolean.update_hacs + + ###################################################################### + # Update: Aknowledge update + # + # Actions: + # - persistent_notification.dismiss + ###################################################################### + - alias: "Update: Riconoscimento Aggiornamenti" + + trigger: + platform: state + entity_id: + #- input_boolean.update_homeassistant + - input_boolean.update_hacs + - input_boolean.update_shelly + to: 'off' + + action: + - service: persistent_notification.dismiss + data_template: + notification_id: "update" diff --git a/packages/update/update_types.yaml b/packages/update/update_types.yaml new file mode 100644 index 00000000..55fabf7a --- /dev/null +++ b/packages/update/update_types.yaml @@ -0,0 +1,39 @@ +###################################################################### +# Update Package - Types - Input Booleans +###################################################################### + +input_boolean: + # Home Assistant + #update_homeassistant: + # name: Aggiornamento Home Assistant + # initial: off + # icon: mdi:cellphone-arrow-down + + # HACS + update_hacs: + name: Aggiornamenti HACS + initial: off + icon: mdi:cellphone-arrow-down + + # Shelly + update_shelly: + name: Aggiornamento Shelly + initial: off + icon: mdi:cellphone-arrow-down + +###################################################################### +# Update Package - Types - Group +###################################################################### + +group: + + ###################################################################### + # Group Update Availability + ###################################################################### + update: + name: Aggiornamenti Disponibili + icon: mdi:cellphone-arrow-down + entities: + #- input_boolean.update_homeassistant + - input_boolean.update_hacs + - input_boolean.update_shelly