From 7758ec89d3e37185e4e7c6ee56a859ea76669898 Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Mon, 11 Mar 2019 19:39:13 +0100 Subject: [PATCH] Added script to manage shelly upgrade script to remote update fw --- script/{all_covers.yaml => covers.yaml} | 0 script/mqtt.yaml | 31 +++++++++++++++++++++++++ shell_command/shelly.yaml | 1 + shell_scripts/shelly_upgrade.sh | 20 ++++++++++++++++ ui-lovelace.yaml | 6 ++++- 5 files changed, 57 insertions(+), 1 deletion(-) rename script/{all_covers.yaml => covers.yaml} (100%) create mode 100644 script/mqtt.yaml create mode 100644 shell_command/shelly.yaml create mode 100755 shell_scripts/shelly_upgrade.sh diff --git a/script/all_covers.yaml b/script/covers.yaml similarity index 100% rename from script/all_covers.yaml rename to script/covers.yaml diff --git a/script/mqtt.yaml b/script/mqtt.yaml new file mode 100644 index 00000000..d8417ca8 --- /dev/null +++ b/script/mqtt.yaml @@ -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 index 00000000..e3f4c9e7 --- /dev/null +++ b/shell_command/shelly.yaml @@ -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 index 00000000..816d12e2 --- /dev/null +++ b/shell_scripts/shelly_upgrade.sh @@ -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" diff --git a/ui-lovelace.yaml b/ui-lovelace.yaml index 8cc546ce..d518ac1c 100644 --- a/ui-lovelace.yaml +++ b/ui-lovelace.yaml @@ -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 -- 2.47.3