My daughters spend far too much time on social media. So I was looking for a way to block it. I have installed the AdGuard Home Add-on. There is the possibility to set filters yourself.
I searched the internet for different rules and merged them into my repository, Social-media Blocklists.
This repository contains rules to block Facebook, Instagram, TikTok, Youtube and Whatsapp. These are suitable for Pi-Hole or AdGuard Home.
Thanks to @Skeletorjus and @radinsky. They found a way to turn it on and off
input_boolean:
allowfacebook:
name: Facebook
icon: mdi:facebook
switch:
- platform: template
switches:
allowfacebook:
value_template: "{{ is_state('input_boolean.allowfacebook', 'on') }}"
icon_template: mdi:facebook
friendly_name: Facebook
turn_on:
- service: input_boolean.turn_on
data:
entity_id: input_boolean.allowfacebook
turn_off:
- service: input_boolean.turn_off
data:
entity_id: input_boolean.allowfacebook
automation:
- id: enable_facebook
alias: Enable Facebook
trigger:
platform: state
entity_id: input_boolean.allowfacebook
to: 'on'
action:
- service: adguard.remove_url
data:
url: "https://raw.githubusercontent.com/gieljnssns/Social-media-Blocklists/master/adguard-facebook.txt"
- id: disable_facebook
alias: Disable Facebook
trigger:
platform: state
entity_id: input_boolean.allowfacebook
to: 'off'
action:
- service: adguard.add_url
data:
url: "https://raw.githubusercontent.com/gieljnssns/Social-media-Blocklists/master/adguard-facebook.txt"
name: Facebook
EDIT: changed the service because enable_url
and disable_url
isn’t working anymore
remove_url
also gives an error, but still works
Logger: homeassistant.components.automation.enable_facebook
Source: components/adguard/__init__.py:85
Integration: Automatisering (documentation, issues)
First occurred: 10:14:00 (2 occurrences)
Last logged: 10:14:00
Enable Facebook: Error executing script. Unexpected error for call_service at pos 1: ('Failed removing URL from AdGuard Home filter', {'response': 'OK 0 rules\n'})
While executing automation automation.enable_facebook
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 253, in _async_step
await getattr(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 460, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1451, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1486, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/components/adguard/__init__.py", line 85, in remove_url
await adguard.filtering.remove_url(call.data.get(CONF_URL))
File "/usr/local/lib/python3.8/site-packages/adguardhome/filtering.py", line 81, in remove_url
raise AdGuardHomeError(
adguardhome.exceptions.AdGuardHomeError: ('Failed removing URL from AdGuard Home filter', {'response': 'OK 0 rules\n'})
I use them all as packages.
If you find other url’s to block social media, you can always fork my repo and make a PR.