]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Added script to manage shelly upgrade script to remote update fw
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Mon, 11 Mar 2019 18:39:13 +0000 (19:39 +0100)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Mon, 11 Mar 2019 18:39:13 +0000 (19:39 +0100)
script/all_covers.yaml [deleted file]
script/covers.yaml [new file with mode: 0644]
script/mqtt.yaml [new file with mode: 0644]
shell_command/shelly.yaml [new file with mode: 0644]
shell_scripts/shelly_upgrade.sh [new file with mode: 0755]
ui-lovelace.yaml

diff --git a/script/all_covers.yaml b/script/all_covers.yaml
deleted file mode 100644 (file)
index d6aaa8a..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-######################################################################
-# All Covers Operation
-# Inputs:
-# - modus
-#
-# Operations:
-# - cover.{{modus}}_cover
-######################################################################
-
-all_covers_operation:
-  alias: "Operazioni su tutte le Tapparelle"
-  sequence:
-    - service_template: "cover.{{modus}}_cover"
-      data:
-        entity_id: 
-          - cover.tapparella_cucina
-          - cover.tapparella_sala
-          - cover.tapparella_camera
-          - cover.tapparella_studio
-
-######################################################################
-# All Covers Position
-# Inputs:
-# - position
-#
-# Operations:
-# - cover.set_cover_position
-######################################################################
-
-all_covers_position:
-  alias: "Imposta posizione a tutte le Tapparelle"
-  sequence:
-    - service: cover.set_cover_position
-      data_template:
-        entity_id: 
-          - cover.tapparella_cucina
-          - cover.tapparella_sala
-          - cover.tapparella_camera
-          - cover.tapparella_studio
-        position: '{{ position }}'
diff --git a/script/covers.yaml b/script/covers.yaml
new file mode 100644 (file)
index 0000000..d6aaa8a
--- /dev/null
@@ -0,0 +1,40 @@
+######################################################################
+# All Covers Operation
+# Inputs:
+# - modus
+#
+# Operations:
+# - cover.{{modus}}_cover
+######################################################################
+
+all_covers_operation:
+  alias: "Operazioni su tutte le Tapparelle"
+  sequence:
+    - service_template: "cover.{{modus}}_cover"
+      data:
+        entity_id: 
+          - cover.tapparella_cucina
+          - cover.tapparella_sala
+          - cover.tapparella_camera
+          - cover.tapparella_studio
+
+######################################################################
+# All Covers Position
+# Inputs:
+# - position
+#
+# Operations:
+# - cover.set_cover_position
+######################################################################
+
+all_covers_position:
+  alias: "Imposta posizione a tutte le Tapparelle"
+  sequence:
+    - service: cover.set_cover_position
+      data_template:
+        entity_id: 
+          - cover.tapparella_cucina
+          - cover.tapparella_sala
+          - cover.tapparella_camera
+          - cover.tapparella_studio
+        position: '{{ position }}'
diff --git a/script/mqtt.yaml b/script/mqtt.yaml
new file mode 100644 (file)
index 0000000..d8417ca
--- /dev/null
@@ -0,0 +1,31 @@
+######################################################################
+# MQTT: Shelly Upgrade
+# - mqtt.publish
+######################################################################
+
+shelly_upgrade:
+  alias: "Shelly: Aggiornamento Firmware"
+  sequence:
+    # Shelly 2 Tapparella Cucina
+    - service: mqtt.publish
+      data:
+        topic: 'shellies/shellyswitch-55980F/command'
+        payload: 'update_fw'
+        
+    # Shelly 2 Tapparella Sala
+    - service: mqtt.publish
+      data:
+        topic: 'shellies/shellyswitch-135454/command'
+        payload: 'update_fw'
+
+    # Shelly 2 Tapparella Studio
+    - service: mqtt.publish
+      data:
+        topic: 'shellies/shellyswitch-13572B/command'
+        payload: 'update_fw'
+
+    # Shelly 2 Tapparella Camera
+    - service: mqtt.publish
+      data:
+        topic: 'shellies/shellyswitch-559C49/command'
+        payload: 'update_fw'
diff --git a/shell_command/shelly.yaml b/shell_command/shelly.yaml
new file mode 100644 (file)
index 0000000..e3f4c9e
--- /dev/null
@@ -0,0 +1 @@
+shelly_upgrade: /etc/homeassistant/shell_scripts/shelly_upgrade.sh
diff --git a/shell_scripts/shelly_upgrade.sh b/shell_scripts/shelly_upgrade.sh
new file mode 100755 (executable)
index 0000000..816d12e
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+HOST=$(awk '/mqtt_host/ { print  $2 }' ../secrets.yaml)
+USER=$(awk '/mqtt_user/ { print  $2 }' ../secrets.yaml)
+PASSWORD=$(awk '/mqtt_password/ { print  $2 }' ../secrets.yaml)
+SHELLY_ID=(
+       55980F
+       135454
+       13572B
+       559C49
+)
+
+echo "Upgrade Shelly Firmware"
+
+for i in "${SHELLY_ID[@]}"
+do
+       echo mosquitto_pub -h $HOST -d -u $USER -P $PASSWORD -t shellies/shellyswitch-$i/command -m update_fw
+done
+
+echo "Done"
index 8cc546ce4fc8507426abdb8823ddc40ea85fc521..d518ac1c1da3c7fcd0074b13b80983e816b2ab3c 100644 (file)
@@ -368,4 +368,8 @@ views:
         - script.homeassistant_restart
         - script.homeassistant_clearlog
         - script.homeassistant_upgrade
-
+      - type: entities
+        title: Operazione sui Dispositivi
+        show_header_toggle: false
+        entities: 
+        - script.shelly_upgrade