Hi All. I am using adguard and the integration as well… now I see that adguard added a function to block certain services like here:
I was wondering if this also can be added in the integration as well?
Hi All. I am using adguard and the integration as well… now I see that adguard added a function to block certain services like here:
I was wondering if this also can be added in the integration as well?
I was just about to post a new thread on this. I have upvoted this - this is the one thing that is missing in this add-on and would be extremely useful.
Upvoted.
For now i just created a command_line switch for this purpose.
For example, to block YouTube
switch:
# rest
- platform: command_line
switches:
youtube:
command_on: '/usr/bin/curl -X POST -m 10000 -H "Authorization: Basic **BASE64_Username:password**" -H "Content-Type: application/json" -d "[\"youtube\"]" http://adguardIP:port/control/blocked_services/set'
command_off: '/usr/bin/curl -X POST -m 10000 -H "Authorization: Basic **BASE64_Username:password**" -H "Content-Type: application/json" -d "[\"\"]" http://adguardIP:port/control/blocked_services/set'
to block Discord and YouTube
switch:
# rest
- platform: command_line
switches:
discordyoutube:
command_on: '/usr/bin/curl -X POST -m 10000 -H "Authorization: Basic **BASE64_Username:password**" -H "Content-Type: application/json" -d "[\"discord\",\"youtube\"]" http://adguardIP:port/control/blocked_services/set'
command_off: '/usr/bin/curl -X POST -m 10000 -H "Authorization: Basic **BASE64_Username:password**" -H "Content-Type: application/json" -d "[\"\"]" http://adguardIP:port/control/blocked_services/set'
I think cleaner method is to create series of switches/toggles for each services that will build the json body, and then an “APPLY” button to actually sends the curl command.
I just don’t know how to do that…
Where did u find those commands ? From the component ?
What Port should I use? the standard 8123 for HA, or a different port specific for adguard? (no idea where to find a specific port for adguard)
Default port for adguard is 3000
Ok, thanks!
Thanks!
By default, there was no port set for the webinterface of Adguard.
I set it to 3000 and it worked
Is it possible to block clients using the api?
I’d like to be able to block clients via home assistant.
When I do that I lose access within HA. Did you find that as well?
Does this still work? I’ve been trying to setup a switch but I’m not having any luck. The web interface is accessed on port 80, so no IP specified. Here is my switch config.
- platform: command_line
switches:
youtube:
command_on: '/usr/bin/curl -X POST -m 10000 -H "Authorization: Basic **BASE64_myusername:mypassword**" -H "Content-Type: application/json" -d "[\"youtube\"]" http://webinterfaceip/control/blocked_services/set'
command_off: '/usr/bin/curl -X POST -m 10000 -H "Authorization: Basic **myusername:mypassword**" -H "Content-Type: application/json" -d "[\"\"]" http://webinterfaceip/control/blocked_services/set'
Hi,
Kindly advise if this is still working?
I have tried and does not seem to be working.
I have the same question . Is it still work ? Because when I´ve set to block services example snapchat it is still available on client. And not all ads is blocked too. I ´ve instaled adguard hom on my iphone and ther is adblocking ok .
I’m not sure if this helps, but thought I’d point this link out as I just solved a similar problem for some of my needs. Link to thread.
Where do I get the username/password and the Adguard host/port from? I installed it on my HA as an Adguard add-on so I can access the web interface but only through the HA admin dashboard (clicking on Open UI). So, it’s not clear to me where to get the auth and connection details from to be able to send API calls to Adguard…
I ended up figuring out how to access the AdGuard add-on for API requests. See blog post here with instructions and screenshots: How to block LAN clients from accessing YouTube and other media with AdGuard and Home Assistant — Liran Tal