From: Giorgio Ravera Date: Mon, 11 Mar 2019 18:39:13 +0000 (+0100) Subject: Added script to manage shelly upgrade script to remote update fw X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=7758ec89d3e37185e4e7c6ee56a859ea76669898;p=homeassistant.git Added script to manage shelly upgrade script to remote update fw --- diff --git a/script/all_covers.yaml b/script/all_covers.yaml deleted file mode 100644 index d6aaa8a3..00000000 --- a/script/all_covers.yaml +++ /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 index 00000000..d6aaa8a3 --- /dev/null +++ b/script/covers.yaml @@ -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 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