Upload script
This commit is contained in:
parent
2d73925636
commit
4303e248ff
@ -12,7 +12,6 @@ For further details have a look at the Readme.md one level above.
|
||||
|
||||
# Remote Upload
|
||||
|
||||
|
||||
This script will allow you to send an OTA update to your device.
|
||||
|
||||
## Installation
|
||||
@ -22,6 +21,12 @@ Requirements are:
|
||||
|
||||
## Usage
|
||||
|
||||
See ***upload-via-mqtt.sh***
|
||||
|
||||
# Remote Upload - Backend
|
||||
|
||||
## Usage
|
||||
|
||||
```text
|
||||
usage: ota_updater.py [-h] -l BROKER_HOST -p BROKER_PORT [-u BROKER_USERNAME]
|
||||
[-d BROKER_PASSWORD] [-t BASE_TOPIC] -i DEVICE_ID
|
||||
|
27
esp32/host/upload-via-mqtt.sh
Executable file
27
esp32/host/upload-via-mqtt.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!//bin/bash
|
||||
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "Homie prefex and device index must be specified:"
|
||||
echo "$0 <mqtt host> <prefix> <device index>"
|
||||
echo "e.g."
|
||||
echo "$0 192.168.0.2 test/ MyDeviceId"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mqttHost=$1
|
||||
mqttPrefix=$2
|
||||
homieId=$3
|
||||
firmwareFile=../.pio/build/esp32doit-devkit-v1/firmware.bin
|
||||
|
||||
if [ ! -f $firmwareFile ]; then
|
||||
echo "the script $0 must be started in host/ sub directory"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/stay/alive/set" -m "1" -r
|
||||
echo "Waiting ..."
|
||||
mosquitto_sub -h $mqttHost -t "${mqttPrefix}${homieId}/#" -R -C 1
|
||||
python ota_updater.py -l $mqttHost -t "$mqttPrefix" -i "$homieId" $firmwareFile
|
||||
|
||||
mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/stay/alive/set" -m "0" -r
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user