2018-01-02 00:00:45 +00:00
#-------------------------------------------
2019-03-14 21:52:47 +00:00
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
2018-01-02 00:00:45 +00:00
# PiHole ad Blocking Related Packages
2019-03-14 21:52:47 +00:00
# https://www.vcloudinfo.com/2019/03/revisiting-the-pi-on-pi-day-with-home-assistant.html
# YouTube Video - https://youtu.be/woA88DFlH5c
2018-01-02 00:00:45 +00:00
#-------------------------------------------
sensor :
- platform : pi_hole
2019-03-14 21:52:47 +00:00
host : 192.168 .10 .11 : 80
2019-03-14 17:19:33 +00:00
location : admin
2019-03-14 21:52:47 +00:00
ssl : false
2019-03-14 17:19:33 +00:00
verify_ssl : false
2018-01-02 00:00:45 +00:00
monitored_conditions :
- ads_blocked_today
- ads_percentage_today
2019-03-14 17:19:33 +00:00
- dns_queries_today
- domains_being_blocked
- queries_cached
- queries_forwarded
2018-01-02 00:00:45 +00:00
- unique_clients
2019-03-14 17:19:33 +00:00
- unique_domains
2018-01-02 00:00:45 +00:00
- platform : template
sensors :
carlopihole :
friendly_name : 'Carlo-PiHole'
2019-03-31 21:13:37 +00:00
entity_id : [ ]
2018-01-02 00:00:45 +00:00
value_template : "{{ 'Online' if is_state('device_tracker.carlopihole', 'home') else 'Offline' }}"
# Pi-Hole switch
switch :
- platform : command_line
switches :
pihole_temp_disable :
command_on : "curl -X GET 'http://192.168.10.11/admin/api.php?enable&auth='"
command_off : "curl -X GET 'http://192.168.10.11/admin/api.php?disable=3600&auth='"
# command_state: "curl -X GET 'http://192.168.10.11/admin/api.php?status'| grep enabled"
# value_template: "{{ value_json.status == 'enabled' }}
#-------------------------------------------
group :
pihole :
entities :
- sensor.carlopihole
- sensor.pi_hole_version
2019-03-14 17:02:02 +00:00
- sensor.pi_hole_dns_unique_clients
- sensor.pi_hole_dns_queries_today
- sensor.pi_hole_ads_blocked_today
- sensor.pi_hole_ads_percentage_today
- sensor.pi_hole_ads_percentage_blocked_today
2018-01-02 00:00:45 +00:00
- switch.pihole_temp_disable
#-------------------------------------------
automation :
- alias : PiHole Daily stats Tweet!
trigger :
platform : time
at : '23:50:00'
action :
2018-06-14 19:33:39 +00:00
- delay : '00:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
2018-03-17 04:56:57 +00:00
- service : script.tweet_engine_image
2018-01-02 00:00:45 +00:00
data_template :
tweet : >
{{ [
2019-03-14 17:02:02 +00:00
"I blocked {{states.sensor.pi_hole_ads_blocked_today.state}} ads. That is {{states.sensor.pi_hole_ads_percentage_blocked_today.state}}% of my internet traffic." ,
"Today was a good day! Why, you ask? Because I blocked {{states.sensor.pi_hole_ads_blocked_today.state}} ads via Pi-Hole!" ,
2018-01-02 00:00:45 +00:00
] | random + " #PiHole #Security Status:({{states.sensor.carlopihole.state}})"}}
2018-03-17 04:56:57 +00:00
image : >-
{{ [
"/config/www/custom_ui/floorplan/images/branding/servers.png" ,
"/config/www/custom_ui/floorplan/images/branding/servers2.png" ,
"/config/www/custom_ui/floorplan/images/branding/servers3.png" ,
"/config/www/custom_ui/floorplan/images/branding/servers4.png"
] | random }}
2018-01-02 00:00:45 +00:00
- alias : PiHole Daily Client Tweet!
trigger :
platform : time
at : '04:30:00'
action :
2018-06-14 19:33:39 +00:00
- delay : '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
2018-03-17 04:56:57 +00:00
- service : script.tweet_engine_image
2018-01-02 00:00:45 +00:00
data_template :
tweet : >
{{ [
2019-03-14 17:02:02 +00:00
"There are currently {{states.sensor.pi_hole_dns_unique_clients.state}} clients on my network." ,
"As reported by #Ubiquiti Routers, There are {{states.sensor.pi_hole_dns_unique_clients.state}} clients on my network." ,
2018-03-17 04:56:57 +00:00
] | random + "#Security https://github.com/CCOSTAN/Home-AssistantConfig#networking"}}
image : >-
{{ [
"/config/www/custom_ui/floorplan/images/branding/servers.png" ,
"/config/www/custom_ui/floorplan/images/branding/servers2.png" ,
"/config/www/custom_ui/floorplan/images/branding/servers3.png" ,
"/config/www/custom_ui/floorplan/images/branding/servers4.png"
] | random }}