I've written a Perl script to automate backup of the Z-Wave interface. As you know, this is normally done thru the HS3 web interface: Plug-ins->Z-Wave->Controller Management. Under Z-Wave Interfaces, expand an interface, then under Actions, select "Back Up this interface", change the filename if desired, then hit START.
The script performs essentially the same actions:
1) a GET to retrieve the form and element names
2) a POST to set the action to "Back Up this interface"
3) a GET to retrieve the default filename and submit button properties
4) a POST to submit the backup action
The script takes one parameter, the HS3 hostname. This defaults to localhost, so if run on the HS3 machine it can be omitted.
You will need to install Perl in order to use this...
Linux ==============================
Perl is installed by default in most Linux distributions. On the Raspberry Pi, some additional modules are required. At the shell prompt enter:
Windows =================================
On Windows, ActivePerl, Strawberry Perl and Cygwin are options.
http://www.activestate.com/activeperl/downloads
http://strawberryperl.com/
http://cygwin.com/
I'll recommend ActivePerl since it's default install is smallest. Download & run the installer appropriate for your architecture (32 or 64 bit). Select "typical" install and take all the defaults.
=============================
I developed this on the Raspberry Pi (a z-net and another one). Initially I was thinking of setting up a cron job to run the backup. However I needed to verify it would run on windows,so I tried it under Cygwin on my desktop box, then I installed ActivePerl on my Hometroller. Then I set up this event, which I think is the cleanest way:
Caveats:
I only have one interface so I can't test a multiple interface case. However it was written it with that in mind, and from the way the page is structured I think it has a fair chance of working.
EDIT 1: added revision 'r1' (2017-01-28). Based on new info, the backup file name in multiple interface installations can be problematic. This update attempts to address this.
EDIT 2: replaced previous revisions with 'r2' (2017-01-31). adds action => updatetime which seems to be required by the page.
EDIT 3: revision 'r3' (2017-03-03) adds basic authorization capability. Username & password can be hardcoded into the file or provided on command line via -l username/password.
EDIT 4: Improved procedure for Linux install.
EDIT 5: revision 'r4' (2017-07-21) has improved retry mechanism needed in multi-interface installations.
EDIT 6: Updated screenshot to show purge of old files.
EDIT 7: revision 'r5' (2018-04-05) fix seems to avoid zwave plugin losing its mind and pegging the CPU 10-30 minutes after backup.
EDIT 8: revision 'r6' (2018-12-12) fix for issue backing up Raspberry Pi 'internal' interface -- simplify file name generation.
zwbkup.zip
The script performs essentially the same actions:
1) a GET to retrieve the form and element names
2) a POST to set the action to "Back Up this interface"
3) a GET to retrieve the default filename and submit button properties
4) a POST to submit the backup action
The script takes one parameter, the HS3 hostname. This defaults to localhost, so if run on the HS3 machine it can be omitted.
You will need to install Perl in order to use this...
Linux ==============================
Perl is installed by default in most Linux distributions. On the Raspberry Pi, some additional modules are required. At the shell prompt enter:
Code:
sudo apt-get update sudo apt-get -y install libwww-perl
On Windows, ActivePerl, Strawberry Perl and Cygwin are options.
http://www.activestate.com/activeperl/downloads
http://strawberryperl.com/
http://cygwin.com/
I'll recommend ActivePerl since it's default install is smallest. Download & run the installer appropriate for your architecture (32 or 64 bit). Select "typical" install and take all the defaults.
=============================
I developed this on the Raspberry Pi (a z-net and another one). Initially I was thinking of setting up a cron job to run the backup. However I needed to verify it would run on windows,so I tried it under Cygwin on my desktop box, then I installed ActivePerl on my Hometroller. Then I set up this event, which I think is the cleanest way:
Caveats:
I only have one interface so I can't test a multiple interface case. However it was written it with that in mind, and from the way the page is structured I think it has a fair chance of working.
EDIT 1: added revision 'r1' (2017-01-28). Based on new info, the backup file name in multiple interface installations can be problematic. This update attempts to address this.
EDIT 2: replaced previous revisions with 'r2' (2017-01-31). adds action => updatetime which seems to be required by the page.
EDIT 3: revision 'r3' (2017-03-03) adds basic authorization capability. Username & password can be hardcoded into the file or provided on command line via -l username/password.
EDIT 4: Improved procedure for Linux install.
EDIT 5: revision 'r4' (2017-07-21) has improved retry mechanism needed in multi-interface installations.
EDIT 6: Updated screenshot to show purge of old files.
EDIT 7: revision 'r5' (2018-04-05) fix seems to avoid zwave plugin losing its mind and pegging the CPU 10-30 minutes after backup.
EDIT 8: revision 'r6' (2018-12-12) fix for issue backing up Raspberry Pi 'internal' interface -- simplify file name generation.
zwbkup.zip
Comment