I’m trying something and since I’m no programmer this is a bit out of my league.
My router has OpenWRT and adblock, but … I want to suspend adblock temporarily with Homey. I had this in the past for PiHole with a GET command. But PiHole is running in docker on my NAS and when datascrubbing is taking place, the performance of docker becomes so bad my DNS fails and my wife has no internet. Big problem for me. So, I turned to adblock on OpenWRT. Works good to, but no easy way to disable it. It works from the commandline on my computer, but now to get it working in Homey.
First, I have to get a token:
curl https://router-ip/cgi-bin/luci/rpc/auth --insecure --data '{“id”: 1, “method”: “login”, “params”: [“username>”, “password”]}
This gives me a result like:
{“id”:1,“result”:“token”,“error”:null}
Those are my first two problems. I need to get the token stored in a variable and I need to make an insecure call (router is running a self signed certificate).
Then, to get it running in Homey, I need to translate this command into something Homey will understand:
curl -X POST https://router-ip/cgi-bin/luci/rpc/sys?auth=token --insecure --data ‘{“id”: “1”, “method”: “exec”, “params”: ["/etc/init.d/adblock suspend"]}’
I tried a POST JSON card with these options:
- https:///cgi-bin/luci/rpc/sys?auth=
- {“id”: “1”, “method”: “exec”, “params”: ["/etc/init.d/adblock suspend"]}
But that gives me an error: Unexpected Token E in JSON at position 0
The maker of adblock pointed me to a different, simpler solution. A simple web request that executes a custom command on the router. This works, but how to trigger that from Homey.
So I have two working solutions, but now to get either in them in a Homey flow. Any ideas?