Here you can find some Windows Scripts (batch files) that can be used for the Windows users of Domoticz. There are a lot of scripts you can find on this Wiki and the Domoticz forum but the most of them aren't usable in Windows.
This Batch file makes a backup from your daily backup's on a Windows Domoticz Installation to a shared network location. For example your nas. The standard option makes a nice backup but when your Harddisk or SSD in your Windows Machine crashes you have nothing to restore because the backup was stored on the same drive.
Turn on the Backup feature in Domoticz
First of all you need to turn on the Backup feature in Domoticz. Go to "Settings", go to the tab "System" and check the option "Activate Automatic Backup"
Domoticz makes now hourly, daily and monthly backups in your Domoticz\Backups folder. (for example c:\Program Files (x86)\Domoticz\Backups).
Make a share on your nas and check it is possible to read/write data to it from the Windows Machine were Domoticz is running on to. Look at the manual of your NAS device how to make a share and adjust the rights for it.
Make the Batch script
Hit the "Windows Key" + "R". Type in the Run As window: Notepad.exe In notepad paste the following script:
@ECHO OFF XCOPY "C:\Program Files (x86)\Domoticz\backups\hourly" "\\NAS\Apps\Domoticz\Backup" /I /C /D /Y EXIT
Adjust the paths to your own situation:
The first location (C:\Program Files (x86)\Domoticz\backups\hourly) is the "hourly" map on the Domoticz computer. Here Domoticz makes every hour a new backup and overwrites the last one so there will always be 24 files in this map.
The Second location (\\NAS\Apps\Domoticz\Backup) is the share location in my nas. Adjust this to your location.
Now save this file in your Documents Folder under the name: "Backup.bat"
Use the Task Scheduler to schedule this Batch file
Hit the "Windows Key" + "R". Type in the Run As window: taskschd.msc
The Task Scheduler will open.
1. In the Actions Pane, click Create Basic Task.
2. Give the Task a name for example: "Backup Domoticz" hit next.
3. Select when the task starts: "Daily", hit next.
4. In the next window you can select the start time. Chose the time you want to make the backup and hit next.
5. Select "Run a program" if not selected and hit next.
6. Select you recently made "Backup.bat" file in this window and hit next.
7. Hit Finish to complete this task.
The task you created will now run every day at the given time at step 4.
I have adjusted the task so it will run every hour. To do this you can double click on the task then:
1. Go to the tab Triggers.
2. Double click the trigger "Daily"
3. Check the option "Repeat task every hour"
4. Hit "OK" two times.