Just curious if there is a specific reason not to use the State Transformation property on the HTTP thing channels to do the JSONPATH transformation instead of doing the transformation with the profile? And use number channels.
you are correct. This is a ceaner way to solve this. And everything would be in the Code-Tab afterwards.
I think I will adopt this and update the Tutorial.
You can send enable/disable commands through the API also.
Both of them require the API token that you can get from the API/Web interface page in the pi-hole settings. Or from the /et/pihole/setupVars.conf (the WEBPASSWORD entry in that file).
To disable: http://<piholeip>/admin/api.php?disable=<seconds>&auth=<WEBPASSWORD>
To enable: http://<piholeip>/admin/api.php?enable&auth=<WEBPASSWORD>
I think the only way to implement this is by adding two channels; one each for disable and enable.
On my instance; I have added a Number channel for disable.
In the advanced options on the channel…
To disable, you send a command to the linked item and it’ll stick the number into the URL and the pi-hole will get disabled for that long. A value of 0 will disable it indefinitely.
I have not hooked up anything for specific enable commands; have not figured out the best way to handle it. It could be a Switch channel, with the Command URL Extension set to ?enable&auth=<WEBPASSWORD>. This would send the enable command for both ON and OFF states; so I haven’t bothered yet.
It may be interesting for you to check, if there are any updates available for your Pi-Hole.
I do not regularly check the Pi-Hole Dashboard myself and was looking for a way to get notified if i need to update my instance.
Fortunately the api provides a versions endpoint. http://<piholeip>/admin/api.php?versions
You can check if updates are available with a boolean api response and also get the current installed und latest available versions, if you want to display them.
Here is my extension to the basic thing config described in this thread.
It still uses http://<piholeip>/admin/api.php as base endpoint in the http binding and just extends the ?versions in the needed channel configurations.
Oh I just pasted the whole thing from my config to show you how it could look like with the auth part in the url. You don’t have to use the %2$ variable, it is in no way related to authentication.
As BratHuhn pointed out this is already well documented in the binding documentation so I would also recommend to read this first and come back with remaining questions later.