]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Moved update notification in shelly package & created automation to force state updat...
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Fri, 5 May 2023 19:02:54 +0000 (21:02 +0200)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Fri, 5 May 2023 19:02:54 +0000 (21:02 +0200)
.storage/lovelace.lovelace_dispositivi
automations/update_notifications.yaml
input_boolean/update.yaml
packages/shelly/shelly_customizations.yaml
packages/shelly/shelly_operations.yaml

index 7da0d274cd0b0352d5c1ed06d74f346fc892a291..2b80fad5773659c68a60b70a9f783dba8084bbcf 100644 (file)
                               "type": "tile",
                               "entity": "script.shelly_upgrade",
                               "name": "Aggiorna Tutto",
-                              "icon": "mdi:package-up",
                               "tap_action": {
                                 "action": "call-service",
                                 "service": "script.shelly_upgrade"
                               "type": "tile",
                               "entity": "script.shelly_reboot",
                               "name": "Riavvia tutto",
-                              "icon": "mdi:restart",
                               "tap_action": {
                                 "action": "call-service",
                                 "service": "script.shelly_reboot"
                               }
+                            },
+                            {
+                              "type": "tile",
+                              "entity": "script.shelly_force_state_update",
+                              "name": "Aggiorna Stato Dispositivi",
+                              "tap_action": {
+                                "action": "call-service",
+                                "service": "script.shelly_force_state_update"
+                              }
                             }
                           ]
                         }
index 7c6666872e0113201ed7a28a79e057c69676ab35..2b7c380cf905844b097edea03f54597688c5ecd0 100644 (file)
@@ -1,40 +1,3 @@
-######################################################################\r
-# Update Notification: Shelly\r
-######################################################################\r
-\r
-- alias: "Update Notification: Shelly"\r
-\r
-  trigger:\r
-    - platform: state\r
-      entity_id: group.shelly\r
-      to: 'on'\r
-\r
-    - platform: homeassistant\r
-      event: start\r
-\r
-  condition:\r
-    condition: state\r
-    entity_id: group.shelly\r
-    state: 'on'\r
-\r
-  action:\r
-    - delay: '00:00:10'\r
-    - service: script.notify_text\r
-      data_template:\r
-        title: "Shelly - Aggiornamento"\r
-        message: >\r
-          Sono disponibili aggiornamenti per i dispositivi Shelly:\r
-          {%- for entity_id in states.group.shelly.attributes.entity_id -%}\r
-            {% if is_state(entity_id, 'on') %}\r
-              -> {{ state_attr(entity_id, 'friendly_name')|replace(" - Aggiornamento Firmware", "") }}: {{ state_attr(entity_id, 'latest_version') }}\r
-            {%- endif -%}\r
-          {%- endfor -%}\r
-        notification_id: "update"\r
-        enable_persistent: true\r
-\r
-    - service: input_boolean.turn_on\r
-      entity_id: input_boolean.update_shelly\r
-\r
 ######################################################################\r
 # Update Notification: HACS\r
 ######################################################################\r
index 369af54edee00d46de399943b68c45fdfd14dda0..756ae2d4412de481e56f696709f0c2b40341aab2 100644 (file)
@@ -1,5 +1,5 @@
 ######################################################################\r
-# Update: Home Assistant \r
+# Update: Home Assistant\r
 ######################################################################\r
 \r
 update_homeassistant:\r
@@ -8,7 +8,7 @@ update_homeassistant:
   icon: mdi:cellphone-arrow-down\r
 \r
 ######################################################################\r
-# Update: Shelly \r
+# Update: Shelly\r
 ######################################################################\r
 \r
 update_shelly:\r
@@ -17,7 +17,7 @@ update_shelly:
   icon: mdi:cellphone-arrow-down\r
 \r
 ######################################################################\r
-# Update: HACS \r
+# Update: HACS\r
 ######################################################################\r
 \r
 update_hacs:\r
index fb46726828e5afab0af057f6cedffcbf536030f2..66e8571b4fdbe27d0b80ec73f2a3c50e1dab5782 100644 (file)
@@ -8,6 +8,8 @@ homeassistant:
       icon: mdi:package-up
     script.shelly_reboot:
       icon: mdi:restart
+    script.shelly_force_state_update:
+      icon: mdi:update
 
     # Shelly 1 - Tapparella Cucina (shellyswitch_55980f)
     sensor.tapparella_cucina_energy:
index 0600e0cc50392ec4283b8c421792629c756418fa..0d34129c0159cea9a854e819b59dad0b22816024 100644 (file)
@@ -9,16 +9,16 @@ script:
   shelly_upgrade:
     alias: "Shelly: Aggiornamento Firmware Collettivo"
     sequence:
-    #  - service: mqtt.publish
-    #    data:
-    #      topic: 'shellies/command'
-    #      payload: 'update_fw'
-    #      qos: 0
-    #      retain: false
-      - service: update.install
-        target:
-          entity_id:
-            - group.shelly
+      - service: mqtt.publish
+        data:
+          topic: 'shellies/command'
+          payload: 'update_fw'
+          qos: 0
+          retain: false
+    #  - service: update.install
+    #    target:
+    #      entity_id:
+    #        - group.shelly
 
   ######################################################################
   # Shelly: Reboot
@@ -28,6 +28,64 @@ script:
     sequence:
       - service: shell_command.shelly_reboot
 
+  ######################################################################
+  # Shelly: Force State Update
+  ######################################################################
+  shelly_force_state_update:
+    alias: "Shelly: Aggiornamento stato dispositivi"
+    sequence:
+      - service: mqtt.publish
+        data:
+          payload: update
+          topic: shellies/command
+
+automation:
+  ######################################################################
+  # Shelly: Update Notification
+  ######################################################################
+  - alias: "Shelly: Update Notification"
+
+    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:
+            {%- for entity_id in states.group.shelly.attributes.entity_id -%}
+              {% if is_state(entity_id, 'on') %}
+                -> {{ state_attr(entity_id, 'friendly_name')|replace(" - Aggiornamento Firmware", "") }}: {{ state_attr(entity_id, 'latest_version') }}
+              {%- endif -%}
+            {%- endfor -%}
+          notification_id: "update"
+          enable_persistent: true
+      - service: input_boolean.turn_on
+        entity_id: input_boolean.update_shelly
+
+  ######################################################################
+  # Shelly: Force State Update at Startup
+  ######################################################################
+  - alias: "Shelly - Startup: Aggiornamento stati"
+
+    trigger:
+      - event: start
+        platform: homeassistant
+
+    action:
+      service: script.shelly_force_state_update
+
 ######################################################################
 # Shelly Package - Operations Shell Command
 ######################################################################