Pi-Hole Integration

It works for me as well. Have you specified your hostname including protocol? For me it works like this: „https://yourpiholeserver.org

Thanks. Thought I had tried that but tried it again this morning with http://[IP] and now the Thing comes Online.

Thanks again.

You have to switch the Pihole_Server_Status to OFF to disable blocking.

Pihole_Server_Disable_Blocking is a ‘shortcut’ that let’s you access directly some actions. See here

Hmmm I tried that but that did not work. Also the documentation states that the channel is read only.

My item “PiHole Server Status” is connected to the channel “Status”

I tried again tonight but I cannot disable blocking through this channel. Are you sure that this is working for you?

It works for me too

Yes the disable-enable channel works for me too. But the enabled switch channel does only work in read only mode. Switching it off will not switch off the blocking mode on the pihole.

Oh, I’m sorry. I have two rules for that, too

configuration: {}
triggers:
  - id: "3"
    configuration:
      command: OFF
      itemName: Pihole_Server_Status
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      config: pihole:server:8b41e07cde
      time: 5
    type: pihole.disableBlocking
configuration: {}
triggers:
  - id: "3"
    configuration:
      command: ON
      itemName: Pihole_Server_Status
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      config: pihole:server:8b41e07cde
    type: pihole.enableBlocking

But disable not work yet. See here

Yes I also have a rule in place but it could be a lot easier if the switch channel was writable:

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: pihole1_toggle
    type: core.ItemCommandTrigger
  - id: "3"
    configuration:
      itemName: pihole2_toggle
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/javascript
      script: |-
        function main(triggerItem, command) {
          var blocking = "ON" === command ? "ENABLE" : "DISABLE";
          if ("pihole1_toggle" === triggerItem) {
            items.pihole1_disable.sendCommand(blocking);
          } else {
            items.pihole2_disable.sendCommand(blocking);
          }
        }

        var triggerItem = event.itemName;
        var command = event.receivedCommand;

        main(triggerItem, command);
    type: script.ScriptAction

My apologies if this has been covered already (or just a plain stupid question). I’m using pihole v6 current release and I’m struggling to get the connection from the binding/thing established. Can anyone indicate exactly where I need to go in pihole to grab the ‘token’ specified in the pihole server thing? Every value I’ve tried to pull from pihole ends up giving me

COMMUNICATION_ERROR

Exception while sending request to Pi-hole. java.net.ConnectException: Connection refused

To my shame, I’ve still got this PR laying around:

I hope to find some time for it soon! But in the meantime, I hope/assume it helps you.

Hello!

Perhaps the link below can help with the authentication token process:

A few months ago I created a “connector” for PiHole via MQTT.

My code can also be seen at the link below:

I hope this information can help.

No worries, I’ll wait for the update. Thx much for the help.

Cheers

Which update? It works now.

I agree with @ErikDB . Nothing to wait for, I have it working now with OH 5.1.4 and pi-hole 6.4

In the Pi-hole settings go to Web Interface/API
Display Expert settings then click on Configure app password

I think there may be a typo and it should say API password.

The docs on the main branch have been updated, so with the next release, the official docs will also be updated:

Thanks, I’ve tried exactly the steps brianlay outlined above in pihole. In pihole6 the configure app password resets the web interface password as well. If I try to use the newly generated long password in the oh thing config I still get connection refused from the openhab thing.

Stupid question, but this appears to be linked to 2FA, does one need to have 2FA enabled for the api access to work?

No.
Make sure, if you are using the pihole ip adress, you have the http:// in front of it.

Confirmed. And the error is an explicit connection refused.