is there away to flash all Shelly's at once ?, As I get more and more Shelly's keeping them up to date is starting to take a some time.
So... I was wondering could you write a MacOS app to flash all shelly's one after another ?, It could go and probe the network via bonjour to find shelly's, device type, current FW version, then do a bulk update.
@rojer is this something you could do?
you can script it with curl.
curl -F [email protected] http://shelly-XXX.local/update
repeat as many times as needed.
i guess you could also auto-discover shelly devices with bonjopurr / avahi (linux) and auto-update them all.
i see a small shell script in this :)
if someone feels like it, please contribute.
is there a curl to probe FW version ?, I m not bad linux scripting.
$ curl -qsS http://shellyswitch25-B955B6.local/rpc/Sys.GetInfo | jq -r .fw_version
2.0.11
$ curl -qsS http://shellyswitch25-B955B6.local/rpc/Sys.GetInfo | jq -r .fw_version 2.0.11
curl -qsS http://shellyswitch1-055FFF.local/rpc/Sys.GetInfo | jq -r .fw_version
-bash: jq: command not found
^C
brew install jq, perhaps?
well, you don't have to use jq, it's just a convenient way to parse JSON in shell (https://stedolan.github.io/jq/).
full response looks liek this:
$ curl -qsS http://shellyswitch25-B955B6.local/rpc/Sys.GetInfo
{"id": "shellyswitch25-B955B6", "app": "switch25", "fw_version": "2.0.11", "fw_id": "20200730-232311/2.0.10-2-g9abbe95-debug", "mg_version": "a5376762", "mg_id": "20200730-232311/ga537676-master", "mac": "9AF4ABB955B6", "arch": "esp8266", "uptime": 88824, "public_key": null, "ram_size": 41208, "ram_free": 26368, "ram_min_free": 19360, "fs_size": 233681, "fs_free": 169174,"wifi": {"sta_ip": "192.168.11.75", "ap_ip": "", "status": "got ip", "ssid": "Over_9000_Internets"}}
@rojer is there anyway I can probe the device to confirm it is running your firmware, it just that when I probe my lan for shelly it is picking all of them up, including those on official firmware.
arp -a | grep shelly
shelly1-f3bee6.local (192.168.3.40) at xxxxxxxxxxxx
shelly1-f2a067.local (192.168.3.41) at xxxxxxxxxxxx
shelly1-f28318.local (192.168.3.42) at xxxxxxxxxxxx
shelly1-f28095.local (192.168.3.43) at xxxxxxxxxxxx
shellyswitch25-05ad13.local (192.168.3.44) at xxxxxxxxxxxx
shellydimmer-f3cd89.local (192.168.3.46) at xxxxxxxxxxxx
shelly1-055fff.local (192.168.3.47) at xxxxxxxxxxxx
shellyswitch25-05b323.local (192.168.3.48) at xxxxxxxxxxxx
shellyrgbw2-b075d3.local (192.168.3.49) at xxxxxxxxxxxx
shellyrgbw2-b0c8bb.local (192.168.3.50) at xxxxxxxxxxxx
shellyrgbw2-b09a29.local (192.168.3.51) at xxxxxxxxxxxx
shellyrgbw2-b0a3ef.local (192.168.3.52) at xxxxxxxxxxxx
yeah, Sys.GetInfo is a generic mos rpc.
ok, we can use one specific to shelly-homekit:
$ curl -qsS http://shellyswitch25-B955B6.local/rpc/Shelly.GetInfo | jq -r .app,.version
switch25
2.0.11
ones not running shelly-homekit will return 404.
ok thanks. I have got most of required values now, current FW, vastest FW on GitHub, download urls from githhub, now I have this I'll start work on a script.
@rojer can you add "Model: xxxx" to firmware section in webUI, so I can use to pull the correct download URL from GitHub, I tried using "App: switch1" but the is no link between the 2. As GitHub uses ShellyXXXX
i can add it, for now you can have an app -> model map in the script
i can add it, for now you can have an app -> model map in the script
any idea how, ever used dictionary's in BASH.
bash has a case statement, google it.
bash has a
casestatement, google it.
cheers, sorted...
Host: shelly1-f3bee6.local
Type: switch1
Model: Shelly1
Current: 2.0.12
Latest: 2.0.12
DURL: https://github.com/mongoose-os-apps/shelly-homekit/releases/download/2.0.12/shelly-homekit-Shelly1.zip
@rojer something just happened curl --silent "https://api.github.com/repos/mongoose-os-apps/shelly-homekit/releases/latest" | jq -r .tag_name no longer working just stopped you changed something?
curl --silent "https://api.github.com/repos/mongoose-os-apps/shelly-homekit/releases/latest" | jq -r .tag_name
null
oh bugger
{"message":"API rate limit exceeded for xx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://developer.github.com/v3/#rate-limiting"}
right, you need to either take a break or add a token. meanwhile, i added model to GetInfo output - https://github.com/mongoose-os-apps/shelly-homekit/commit/8b0beaf4c910eef3f2ae4e2de1d49b17dab41e20
thx, now I'm stuck of how to compare the version number in bash, is it only seems to handle decimal or integer (xx or xx.xx) not xx.xx.xx
any ideas ?
ugly... but possible. google yields https://github.com/cloudflare/semver_bash, which seems decent.
any chance you can add firmware to shelly Dimmer and Shelly Pro?
On Wed, Aug 5, 2020 at 6:37 AM Andy Blackburn notifications@github.com
wrote:
@rojer https://github.com/rojer is there anyway I can probe the device
to confirm it is running your firmware, it just that when I probe my lan
for shelly it is picking all of them up, including those on official
firmware.arp -a | grep shelly
shelly1-f3bee6.local (192.168.3.40) at xxxxxxxxxxxx
shelly1-f2a067.local (192.168.3.41) at xxxxxxxxxxxx
shelly1-f28318.local (192.168.3.42) at xxxxxxxxxxxx
shelly1-f28095.local (192.168.3.43) at xxxxxxxxxxxx
shellyswitch25-05ad13.local (192.168.3.44) at xxxxxxxxxxxx
shellydimmer-f3cd89.local (192.168.3.46) at xxxxxxxxxxxx
shelly1-055fff.local (192.168.3.47) at xxxxxxxxxxxx
shellyswitch25-05b323.local (192.168.3.48) at xxxxxxxxxxxx
shellyrgbw2-b075d3.local (192.168.3.49) at xxxxxxxxxxxx
shellyrgbw2-b0c8bb.local (192.168.3.50) at xxxxxxxxxxxx
shellyrgbw2-b09a29.local (192.168.3.51) at xxxxxxxxxxxx
shellyrgbw2-b0a3ef.local (192.168.3.52) at xxxxxxxxxxxx—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/mongoose-os-apps/shelly-homekit/issues/109#issuecomment-669143389,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AQPL2JKYO6RKGDVSUSBFOKLR7FAA5ANCNFSM4PVJSLZQ
.
ugly... but possible. google yields https://github.com/cloudflare/semver_bash, which seems decent.
thx but managed to code my own way.
@rojer ok here is the 1st beta of script, it dose not flash as line 31 has
[Yy]* ) echo "Now Flashing.."; echo "curl -F file=shelly-flash.zip http://$device/update"; break;;
to actually get it flash replace line 31 with
[Yy]* ) echo "Now Flashing.."; curl -F file=shelly-flash.zip http://$device/update; break;;
let me know what you think, or if I have done something wrong.
hey, this is github! make a PR out of it :)
hey, this is github! make a PR out of it :)
yeah, I will, once you give it the once over, don't want to brick people devices incase I fucked something up 😄
it's a pull _request_, i don't have to merge it straight away. PR only starts the conversation, i can add line comments, etc.
ok
@rojer done https://github.com/mongoose-os-apps/shelly-homekit/pull/110
I have enabled the actual flash process on line 31.
after the flash it waits 10 seconds, for device to reboot, so it can confirm the flash worked.
I forced the code refresh in sample below. thats why current and latest are the same.
```Host: shellyswitch25-8caab505ad13.local
Type: switch25
Model: Shelly25.
Current: 2.0.12
Latest: 2.0.12
DURL: https://github.com/mongoose-os-apps/shelly-homekit/releases/download/2.0.12/shelly-homekit-Shelly25.zip
Do you wish to flash shellyswitch25-8caab505ad13.local to firmware version 2.0.12 ?y
--2020-08-05 19:55:00-- https://github.com/mongoose-os-apps/shelly-homekit/releases/download/2.0.12/shelly-homekit-Shelly25.zip
Resolving github.com (github.com)... 140.82.118.4
Connecting to github.com (github.com)|140.82.118.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/238262758/56d99900-d709-11ea-9d87-21f5ac3f2933?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200805%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200805T185500Z&X-Amz-Expires=300&X-Amz-Signature=d32515bf043a3add7b9da99fe4e100e676b29c151f9ad437779d95ca95719168&X-Amz-SignedHeaders=host&actor_id=0&repo_id=238262758&response-content-disposition=attachment%3B%20filename%3Dshelly-homekit-Shelly25.zip&response-content-type=application%2Foctet-stream [following]
--2020-08-05 19:55:00-- https://github-production-release-asset-2e65be.s3.amazonaws.com/238262758/56d99900-d709-11ea-9d87-21f5ac3f2933?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200805%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200805T185500Z&X-Amz-Expires=300&X-Amz-Signature=d32515bf043a3add7b9da99fe4e100e676b29c151f9ad437779d95ca95719168&X-Amz-SignedHeaders=host&actor_id=0&repo_id=238262758&response-content-disposition=attachment%3B%20filename%3Dshelly-homekit-Shelly25.zip&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.138.187
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.138.187|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 977738 (955K) [application/octet-stream]
Saving to: ‘shelly-flash.zip’
shelly-flash.zip 100%[=============================================================================>] 954.82K 1.66MB/s in 0.6s
2020-08-05 19:55:01 (1.66 MB/s) - ‘shelly-flash.zip’ saved [977738/977738]
Are you sure you want to flash shellyswitch25-8caab505ad13.local to firmware version 2.0.12 ?y
Now Flashing..
waiting for shellyswitch25-8caab505ad13.local to reboot
Successfully flashed shellyswitch25-8caab505ad13.local to 2.0.12
Press enter to continue
otherwise you should get
Host: shellyswitch25-8caab505ad13.local
Type: switch25
Model: Shelly25.
Current: 2.0.12
Latest: 2.0.12
DURL: https://github.com/mongoose-os-apps/shelly-homekit/releases/download/2.0.12/shelly-homekit-Shelly25.zip
shellyswitch25-8caab505ad13.local DOSE NOT NEED UPDATING...
Press enter to continue
```
since this has now been added, so I will close it.