A Python script to synchronize Pi-hole configurations between two instances using the Teleporter API. Downloads a backup from one Pi-hole server and uploads it to another, useful for keeping primary and secondary Pi-hole instances in sync.
./pihole_backup_restore.py --host1 pihole1.local --host2 pihole2.local --passwd yourpassword| Argument | Description |
|---|---|
--host1, -1 |
Source Pi-hole host (backup downloaded from here) |
--host2, -2 |
Destination Pi-hole host (backup uploaded here) |
--passwd, -p |
Password for both Pi-hole instances (must be the same) |
--port |
Non-standard port (optional) |
--ssl |
Connect via HTTPS (optional) |
-v |
Verbose output |
-vv |
Debug output |
- Configuration settings
- DHCP leases
- Gravity database (adlists, groups, domains, clients)
To sync configurations daily at 3 AM:
0 3 * * * /path/to/pihole_backup_restore.py -1 pihole1.local -2 pihole2.local -p yourpassword
A python web server to control dpms (Display Power Management Signaling) via simple GET requests. Built for integration with Home Assistant, using the rest_command service.
[Unit]
Description=Web Service for managing screen status
After=screenweb.service
[Service]
ExecStart=/bin/sh -c "/usr/bin/python3 /home/pi/screen_server.py"
WorkingDirectory=/home/pi
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi
Group=pi
[Install]
WantedBy=multi-user.target
rest_command:
pidisplay_on:
url: http://raspberrypi.local:8000/on
method: GET
content_type: 'application/json; charset=utf-8'
pidisplay_off:
url: http://raspberrypi.local:8000/off
method: GET
content_type: 'application/json; charset=utf-8'
pidisplay_set:
url: "{{ 'http://raspberrypi.local:8000/set/' + value|string }}"
method: GET
content_type: 'application/json; charset=utf-8'
- Turn On
action:
- service: rest_command.pidisplay_on
- Turn Off
action:
- service: rest_command.pidisplay_off
- Set Timeout
action:
- service: rest_command.pidisplay_set
data:
value: 3600