Adguard Home integration - any way to toggle client settings?

So I changed it to add with all the additional parameters you have above, and had it add a test client (test.mydomain.me with an available static ip. That worked great. I then try to use update to change just the global services block setting and it gives me invalid name. Then I strip that last little bit off, change it from update to delete, and it does delete the client.

This done, I readded it and then tried simply updating the ip - invalid name again. Then I tried to do add again, just changing the blocked services to see if it would just change that, and I get a “Client already exists” error.

So your add/delete method works. Really confusing why they don’t have an easy way to just adjust an existing client without recreating it. In any case, thank you so much for helping me get here.

Got the update command to work! The key, it seems, is that the “name” field has to be in there twice - don’t ask me why. Here’s the commands I plan on using to toggle the blocked services on an existing client:

curl -X POST -H "content-Type:application/json" -s -u username:password adguard.domain.name/control/clients/update -d '{"name": "clientname","data":{"name":"clientname","ids": ["192.168.1.192"],"tags": ["device_pc"],"upstreams": [],"filtering_enabled": true,"parental_enabled": true,"safebrowsing_enabled": true,"safesearch_enabled": false,"use_global_blocked_services": true,"use_global_settings": false}}'

curl -X POST -H "content-Type:application/json" -s -u username:password adguard.domain.name/control/clients/update -d '{"name": "clientname","data":{"name":"clientname","ids": ["192.168.1.192"],"tags": ["device_pc"],"upstreams": [],"filtering_enabled": true,"parental_enabled": true,"safebrowsing_enabled": true,"safesearch_enabled": false,"use_global_blocked_services": false,"use_global_settings": false,"blocked_services": ["9gag","activision_blizzard","bilibili","clubhouse","discord","disneyplus","douban","electronic_arts","epic_games","facebook","gog","hulu","icloud_private_relay","instagram","iqiyi","kakaotalk","kik","lazada","leagueoflegends","line","linkedin","mail_ru","mastodon","mercado_libre","minecraft","netflix","nintendo","ok","onlyfans","origin","pinterest","playstation","qq","rakuten_viki","reddit","riot_games","roblox","rockstar_games","shopee","snapchat","steam","telegram","tiktok","tinder","twitch","twitter","ubisoft","valorant","viber","vimeo","vk","voot","wechat","weibo","whatsapp","xboxlive","zhihu"]}}'

My next step is to circle back this evening and see if can get that code into the automation to toggle properly in HA. So, so close!

2 Likes

Glad you got it working!

Guess I have the foundation, anyway. I tried updating the syntax an running the toggle again from HA and still getting nothing. Not sure why, because the helper should’ve set it up right but something’s amiss.

Well, I took the time to double and triple check what we discussed and the HA examples and I was confident all would work with the automation now, but it is not. It seems it might be something basic, but I see an error in the logs

Error: Cannot connect to host 192.168.100.1:81 ssl:default [[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1006)]

(Note: that port number is correct, as the router it runs on has something on 80 already.)

Seems there are a lot of unanswered questions when I search on this, and it works fine from the console so I’m not sure how to proceed at the moment.

Follow up research and trying to hit that URL in a browser leads me to believe an SSL_ERROR_RX_RECORD_TOO_LONG is in play here, too. Wondering if this is due to the very long payload string.

I think I have it! Used my internal proxy URL to redirect it and I think it is working. Exhausted from a long day and fighting a cold so I’m going to continue testing tomorrow and I’ll get an update out.

Okay, confirmed it is working. I am going to mark it as solved, and I’ll note the post with the curl update syntax to highlight that, but the real credit goes to @mhoogenbosch. Just to reiterate, the basic steps are:

  1. Added info for rest enable and disable commands to configuration.yaml
  2. Create input boolean using Helper->Toggle
  3. Create automation.
    Code needed for each can be derived from the posts in the thread. Cheers, all.
1 Like

What is the right ip address format for AGH installed as an addon in HA?
“username:password 192.168.1.123/control/clients/update” not working

Hello @BurntOC
I’m interesting to implement same solution to control my AGH restrictions.
Could you please details how to set it up ?
I’m beginer in HA, and don’t find how to setup.

Thanks in advance for whom who can help me :wink:

Hi,

What is the adguard domain name?
If we set the homeassistant IP then it is not ok, and I get error : Client error occurred when calling resource

Thanks,

It is the name of IP address of the adguard machine.