]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Created Update Package
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Tue, 23 May 2023 02:16:05 +0000 (04:16 +0200)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Tue, 23 May 2023 02:16:05 +0000 (04:16 +0200)
automations/update_notifications.yaml [deleted file]
groups/update.yaml [deleted file]
input_boolean/update.yaml [deleted file]
packages/update/update_engine.yaml [new file with mode: 0644]
packages/update/update_types.yaml [new file with mode: 0644]

diff --git a/automations/update_notifications.yaml b/automations/update_notifications.yaml
deleted file mode 100644 (file)
index d497847..0000000
+++ /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 (file)
index 9b4f793..0000000
+++ /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 (file)
index d81bb04..0000000
+++ /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 (file)
index 0000000..08752ad
--- /dev/null
@@ -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 (file)
index 0000000..55fabf7
--- /dev/null
@@ -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