Get it figured out then? You can change the password for adguard if you don’t remember what it is but you need to use a CLI utility called htpasswd to generate a hash of the password you want to use, Configuration · AdguardTeam/AdGuardHome Wiki · GitHub
I had adguard running with an automation to enable and disable a url, so i could toggle the blocking filters of ads or adult sites, but this feature looks like its not working or has been depracted, i didn’t see any breaking changes referencing it. I have just installed a new router and its always a struggle to get it setup so i don’t know if the error is with my router set up or my adguard or if the feature to turn on/off by an automation is no longer possible. tia
Found this thread while trying it myself recently. Think I’ve figured it out!
Replace YOUR_ADGUARD_URL and store your user/pass in secrets
This has both a specific Youtube disable/enable/toggle, with an assicated binary sensor to display state. There’s also a generic disable/enable rest_command, but I haven’t figured out how to make it show a nice UI in the developer tools so you have to put in the data field in YAML instead.
Comments welcome!
sensor:
- platform: rest
name: AdGuard Blocked Services
authentication: basic
username: !secret adguard_user
password: !secret adguard_pass
resource: https://YOUR_ADGUARD_URL/control/blocked_services/get
method: GET
scan_interval: 5
json_attributes:
- "ids"
- "schedule"
template:
- binary_sensor:
- name: Adguard Block - Youtube
state: >
{% if "youtube" in state_attr('sensor.adguard_blocked_services', 'ids') %}
True
{% else %}
False
{% endif %}
rest_command:
#Block Youtube
adguard_block_youtube:
authentication: basic
username: !secret adguard_user
password: !secret adguard_pass
url: https://YOUR_ADGUARD_URL/control/blocked_services/set
method: POST
content_type: "application/json"
verify_ssl: true
payload: >
{% set adguard_set = state_attr("sensor.adguard_blocked_services", "ids") %}
{% if adguard_set|length %}
{% set adguard_set = adguard_set + ["youtube"] %}
{% else %}
{% set adguard_set = ["youtube"] %}
{% endif %}
{{adguard_set | to_json }}
#UnBlock Youtube
adguard_unblock_youtube:
authentication: basic
username: !secret adguard_user
password: !secret adguard_pass
url: https://YOUR_ADGUARD_URL/control/blocked_services/set
method: POST
content_type: "application/json"
verify_ssl: true
payload: >
{% set adguard_set = state_attr('sensor.adguard_blocked_services', 'ids') %}
{% if "youtube" in adguard_set %}
{% set remove = adguard_set.index("youtube") %}
{% set adguard_remove = adguard_set | reject("eq","youtube") | list %}
{{ adguard_remove | to_json }}
{% else %}
{{ adguard_set | to_json }}
{% endif %}
adguard_toggle_youtube:
authentication: basic
username: !secret adguard_user
password: !secret adguard_pass
url: https://YOUR_ADGUARD_URL/control/blocked_services/set
method: POST
content_type: "application/json"
verify_ssl: true
payload: >
{% set adguard_set = state_attr("sensor.adguard_blocked_services", "ids") %}
{% if adguard_set|length %}
{% if "youtube" in adguard_set %}
{% set remove = adguard_set.index("youtube") %}
{% set setnew = adguard_set | reject("eq","youtube") | list %}
{% else %}
{% set setnew = adguard_set + ["youtube"] %}
{% endif %}
{% else %}
{% set setnew = ["youtube"] %}
{% endif %}
{{ setnew | to_json }}
#Generic Block/Unblock, requires to be called in YAML mode e.g.
#action: rest_command.adguard_unblock
#data: {
# servicename: "youtube"
#}
adguard_block:
authentication: basic
username: !secret adguard_user
password: !secret adguard_pass
url: https://YOUR_ADGUARD_URL/control/blocked_services/set
method: POST
content_type: "application/json"
verify_ssl: true
payload: >
{% set adguard_set = state_attr("sensor.adguard_blocked_services", "ids") %}
{% if adguard_set|length %}
{% set adguard_set = adguard_set + [servicename] %}
{% else %}
{% set adguard_set = [servicename] %}
{% endif %}
{{adguard_set | to_json }}
adguard_unblock:
authentication: basic
username: !secret adguard_user
password: !secret adguard_pass
url: https://YOUR_ADGUARD_URL/control/blocked_services/set
method: POST
content_type: "application/json"
verify_ssl: true
payload: >
{% set adguard_set = state_attr('sensor.adguard_blocked_services', 'ids') %}
{% if "youtube" in adguard_set %}
{% set remove = adguard_set.index("youtube") %}
{% set adguard_remove = adguard_set | reject("eq","youtube") | list %}
{{ adguard_remove | to_json }}
{% else %}
{{ adguard_set | to_json }}
{% endif %}
adguard_toggle_service:
authentication: basic
username: !secret adguard_user
password: !secret adguard_pass
url: https://YOUR_ADGUARD_URL/control/blocked_services/set
method: POST
content_type: "application/json"
verify_ssl: true
payload: >
{% set adguard_set = state_attr("sensor.adguard_blocked_services", "ids") %}
{% if adguard_set|length %}
{% if "youtube" in adguard_set %}
{% set remove = adguard_set.index(servicename) %}
{% set setnew = adguard_set | reject("eq",servicename) | list %}
{% else %}
{% set setnew = adguard_set + [servicename] %}
{% endif %}
{% else %}
{% set setnew = [servicename] %}
{% endif %}
{{ setnew | to_json }}
