Skip to content

Commit b3d2ad5

Browse files
committed
Add Pi-hole configuration to README with details on syncing blocking state across HA DNS nodes. #1588
1 parent be4d0c0 commit b3d2ad5

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

config/packages/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ When a package has a dedicated blog post or video, I link it right inside the YA
8383
| [phynplus.yaml](phynplus.yaml) | Installing Phyn Plus and wiring its leak events into HA automations. | [Blog](https://www.vcloudinfo.com/2020/05/phyn-plus-smart-water-shutoff-device.html) |
8484
| [powerwall.yaml](powerwall.yaml) | Monitoring Tesla Powerwall health + what to automate when the grid drops. | [Blog](https://www.vcloudinfo.com/2018/01/going-green-to-save-some-green-in-2018.html) |
8585
| [vacuum.yaml](vacuum.yaml) | Keeping Neato/Dreame bots smart with HA scenes and maintenance timers. | [Blog](https://www.vcloudinfo.com/2020/05/home-assistant-neato-vacuum-automation.html) |
86+
| [pihole_ha.yaml](pihole_ha.yaml) | Sync Pi-hole blocking state across HA DNS nodes. | |
8687
| [grafana.yaml.disabled](grafana.yaml.disabled) | Rendering Grafana dashboards to images for Lovelace and social posts. | [Blog](https://www.vcloudinfo.com/2018/01/going-green-to-save-some-green-in-2018.html) · [Blog](https://www.vcloudinfo.com/2018/09/re-installing-tesla-solar-panels-again.html) · [Video](https://youtu.be/BartadUzGOA) |
8788
| [august.yaml](august.yaml) | Smart lock control and status from HA. | [YouTube short](https://youtu.be/UdcCeAyo9Ak?si=O-f607NHbRLKZxao) |
8889

config/packages/pihole_ha.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
######################################################################
2+
# @CCOSTAN - Follow Me on X
3+
# For more info visit https://www.vcloudinfo.com/click-here
4+
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
5+
# -------------------------------------------------------------------
6+
# Pi-hole HA Sync - Mirror blocking state across DNS nodes
7+
# Keep Pi-hole blocking on docker_10 and docker_14 in lockstep.
8+
# -------------------------------------------------------------------
9+
# Notes: Uses switch.pi_hole + switch.pi_hole_2 from the Pi-hole integration.
10+
######################################################################
11+
12+
automation:
13+
- id: pihole_ha_sync_blocking_state
14+
alias: "Pi-hole HA Sync - Blocking State"
15+
description: "Mirror Pi-hole blocking state between primary and secondary DNS nodes."
16+
trigger:
17+
- platform: state
18+
entity_id:
19+
- switch.pi_hole
20+
- switch.pi_hole_2
21+
action:
22+
- choose:
23+
- conditions:
24+
- condition: template
25+
value_template: >-
26+
{{ trigger.entity_id == 'switch.pi_hole'
27+
and trigger.to_state.state == 'off'
28+
and states('switch.pi_hole_2') != 'off' }}
29+
sequence:
30+
- service: switch.turn_off
31+
target:
32+
entity_id: switch.pi_hole_2
33+
- conditions:
34+
- condition: template
35+
value_template: >-
36+
{{ trigger.entity_id == 'switch.pi_hole'
37+
and trigger.to_state.state == 'on'
38+
and states('switch.pi_hole_2') != 'on' }}
39+
sequence:
40+
- service: switch.turn_on
41+
target:
42+
entity_id: switch.pi_hole_2
43+
- conditions:
44+
- condition: template
45+
value_template: >-
46+
{{ trigger.entity_id == 'switch.pi_hole_2'
47+
and trigger.to_state.state == 'off'
48+
and states('switch.pi_hole') != 'off' }}
49+
sequence:
50+
- service: switch.turn_off
51+
target:
52+
entity_id: switch.pi_hole
53+
- conditions:
54+
- condition: template
55+
value_template: >-
56+
{{ trigger.entity_id == 'switch.pi_hole_2'
57+
and trigger.to_state.state == 'on'
58+
and states('switch.pi_hole') != 'on' }}
59+
sequence:
60+
- service: switch.turn_on
61+
target:
62+
entity_id: switch.pi_hole
63+
mode: single

0 commit comments

Comments
 (0)