]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Updated HACS management
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Sat, 31 Aug 2024 10:23:54 +0000 (12:23 +0200)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Sat, 31 Aug 2024 10:23:54 +0000 (12:23 +0200)
customizations/home_assistant.yaml
packages/update/update_engine.yaml
packages/update/update_types.yaml

index 591c8fe2d6ea5604e941d212d6368e8a4451806f..356680fe24c824e75f0640e1ed7bce1bf10ac9a2 100644 (file)
@@ -14,9 +14,6 @@ script.homeassistant_reload_automations:
 script.homeassistant_clearlog:
   icon: mdi:file-document
 
-script.homeassistant_upgrade:
-  icon: mdi:update
-
 script.homeassistant_google_home_sync:
   icon: mdi:google-assistant
 
index 0e4e110a5b6d2a5444503d55b358981611992afa..c3f2e3e495fc7600c3013cbc99a2e8daabaa3db3 100644 (file)
@@ -17,37 +17,39 @@ automation:
   - alias: "Update: HACS Notification"
     id: "update_hacs_notification"
 
-    trigger:
-      - platform: numeric_state
-        entity_id: sensor.hacs
-        above: 0
+    variables:
+      pending_update_list: >
+        {{ states.update
+          | selectattr('state','eq','on')
+          | selectattr('entity_id', 'in', states.group.hacs.attributes.entity_id)
+          | map(attribute='entity_id')
+          | list
+        }}
 
+    trigger:
+      - platform: state
+        entity_id: group.hacs
+        to: 'on'
       - platform: homeassistant
         event: start
 
     condition:
-      condition: numeric_state
-      entity_id: sensor.hacs
-      above: 0
+      condition: state
+      entity_id: group.hacs
+      state: 'on'
 
     action:
-      - delay: '00:00:15'
+      - delay: '00:00:10'
       - 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 %}
+            Sono disponibili {{pending_update_list | count }} aggiornamenti per i moduli HACS:
+            {% for entity_id in pending_update_list %}
+                -> {{ state_attr(entity_id, 'friendly_name')|replace(" - Aggiornamento", "") }}: {{ state_attr(entity_id, 'latest_version') }}
+            {%- endfor -%}
           notification_id: "update"
           enable_persistent: true
-
       - service: input_boolean.turn_on
         entity_id: input_boolean.update_hacs
 
@@ -72,3 +74,25 @@ automation:
       - service: persistent_notification.dismiss
         data_template:
           notification_id: "update"
+
+######################################################################
+# Update: Update all
+# - update.install
+######################################################################
+
+#  - alias: "Update: Aggiorna Tutto"
+#    id: "update_aggiorna_tutto"
+#
+#    variables:
+#      pending_update_list: >
+#        {{ states.update
+#          | selectattr('state','eq','on')
+#          | selectattr('entity_id', 'in', states.group.hacs.attributes.entity_id)
+#          | map(attribute='entity_id')
+#          | list
+#        }}
+#
+#    trigger:
+#
+#    action:
+#      - service: update.install
index bc118a8e9d4d3196b7f62b4fcf9fcbe8034ce85c..1a631f4bfacb163119abfe0faa2fbdf5a0b90e95 100644 (file)
@@ -38,9 +38,42 @@ group:
   ######################################################################
   update:
     name: Aggiornamenti Disponibili
-    icon: mdi:package-up
+    icon: mdi:package-check
     entities:
-      #- input_boolean.update_homeassistant
       - input_boolean.update_hacs
       - input_boolean.update_shelly
       - input_boolean.update_bticino
+
+  hacs:
+    name: HACS modules
+    icon: mdi:alpha-h-box
+    entities:
+      - update.auto_entities_update
+      - update.badge_card_update
+      - update.bar_card_update
+      - update.battery_state_card_entity_row_update
+      - update.browser_mod_update
+      - update.button_card_update
+      - update.card_mod_update
+      - update.clock_weather_card_update
+      - update.darkish_theme_update
+      - update.electrolux_care_integration_v2_not_official_update
+      - update.fold_entity_row_update
+      - update.hacs_update
+      - update.home_assistant_swipe_navigation_update
+      - update.horizon_card_update
+      - update.hui_element_update
+      - update.layout_card_update
+      - update.mercedesme_2020_update
+      - update.mini_graph_card_update
+      - update.monitor_docker_update
+      - update.mushroom_themes_update
+      - update.mushroom_update
+      - update.paper_buttons_row_update
+      - update.plotly_graph_card_update
+      - update.reeder_dark_theme_update
+      - update.shelly_em_firmware_update
+      - update.shutter_card_update
+      - update.tabbed_card_update
+      - update.vertical_stack_in_card_update
+      - update.zigbee2mqtt_networkmap_card_update