diff --git a/config/packages/README.md b/config/packages/README.md index 30c84b6b..9967ce4a 100755 --- a/config/packages/README.md +++ b/config/packages/README.md @@ -83,6 +83,7 @@ When a package has a dedicated blog post or video, I link it right inside the YA | [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) | | [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) | | [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) | +| [pihole_ha.yaml](pihole_ha.yaml) | Sync Pi-hole blocking state across HA DNS nodes. | | | [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) | | [august.yaml](august.yaml) | Smart lock control and status from HA. | [YouTube short](https://youtu.be/UdcCeAyo9Ak?si=O-f607NHbRLKZxao) | diff --git a/config/packages/pihole_ha.yaml b/config/packages/pihole_ha.yaml new file mode 100644 index 00000000..4cb94732 --- /dev/null +++ b/config/packages/pihole_ha.yaml @@ -0,0 +1,63 @@ +###################################################################### +# @CCOSTAN - Follow Me on X +# For more info visit https://www.vcloudinfo.com/click-here +# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig +# ------------------------------------------------------------------- +# Pi-hole HA Sync - Mirror blocking state across DNS nodes +# Keep Pi-hole blocking on docker_10 and docker_14 in lockstep. +# ------------------------------------------------------------------- +# Notes: Uses switch.pi_hole + switch.pi_hole_2 from the Pi-hole integration. +###################################################################### + +automation: + - id: pihole_ha_sync_blocking_state + alias: "Pi-hole HA Sync - Blocking State" + description: "Mirror Pi-hole blocking state between primary and secondary DNS nodes." + trigger: + - platform: state + entity_id: + - switch.pi_hole + - switch.pi_hole_2 + action: + - choose: + - conditions: + - condition: template + value_template: >- + {{ trigger.entity_id == 'switch.pi_hole' + and trigger.to_state.state == 'off' + and states('switch.pi_hole_2') != 'off' }} + sequence: + - service: switch.turn_off + target: + entity_id: switch.pi_hole_2 + - conditions: + - condition: template + value_template: >- + {{ trigger.entity_id == 'switch.pi_hole' + and trigger.to_state.state == 'on' + and states('switch.pi_hole_2') != 'on' }} + sequence: + - service: switch.turn_on + target: + entity_id: switch.pi_hole_2 + - conditions: + - condition: template + value_template: >- + {{ trigger.entity_id == 'switch.pi_hole_2' + and trigger.to_state.state == 'off' + and states('switch.pi_hole') != 'off' }} + sequence: + - service: switch.turn_off + target: + entity_id: switch.pi_hole + - conditions: + - condition: template + value_template: >- + {{ trigger.entity_id == 'switch.pi_hole_2' + and trigger.to_state.state == 'on' + and states('switch.pi_hole') != 'on' }} + sequence: + - service: switch.turn_on + target: + entity_id: switch.pi_hole + mode: single