Channel type pihole:number could not be resolved in Pi-hole Configuration

Hi everyone,

I’m trying to set up a Pi-hole server in my OpenHAB configuration, but I’m running into an error. I’m seeing the message:

Channel type pihole:number could not be resolved

Here’s the configuration I’m using for my Pi-hole thing:

plaintext

Code kopieren

Thing pihole:server:livingroom "Pi-hole" @ "Livingroom"
[
    refreshIntervalSeconds=120,
    hostname="url",
    token="token"
] {
    Channels:
        Type number : domains_being_blocked "Domains Blocked" [ ]
        Type number : dns_queries_today "DNS Queries Today" [ ]
        Type number : ads_blocked_today "Ads Blocked Today" [ ]
        Type number : ads_percentage_today "Ads Percentage Today" [ ]
        Type number : unique_domains "Unique Domains" [ ]
        Type number : queries_forwarded "Queries Forwarded" [ ]
        Type number : queries_cached "Queries Cached" [ ]
        Type number : clients_ever_seen "Clients Ever Seen" [ ]
        Type number : unique_clients "Unique Clients" [ ]
        Type number : dns_queries_all_types "DNS Queries (All Types)" [ ]
        Type number : reply_UNKNOWN "Reply UNKNOWN" [ ]
        Type number : reply_NODATA "Reply NODATA" [ ]
        Type number : reply_NXDOMAIN "Reply NXDOMAIN" [ ]
        Type number : reply_CNAME "Reply CNAME" [ ]
        Type number : reply_IP "Reply IP" [ ]
        Type number : reply_DOMAIN "Reply DOMAIN" [ ]
        Type number : reply_RRNAME "Reply RRNAME" [ ]
        Type number : reply_SERVFAIL "Reply SERVFAIL" [ ]
        Type number : reply_REFUSED "Reply REFUSED" [ ]
        Type number : reply_NOTIMP "Reply NOTIMP" [ ]
        Type number : reply_OTHER "Reply OTHER" [ ]
        Type number : reply_DNSSEC "Reply DNSSEC" [ ]
        Type number : reply_NONE "Reply NONE" [ ]
        Type number : reply_BLOB "Reply BLOB" [ ]
        Type number : dns_queries_all_replies "DNS Queries (All Replies)" [ ]
        Type number : privacy_level "Privacy Level" [ ]
        Type switch : enabled "Status" [ ]
        Type string : disable-enable "Disable Blocking" [ ]
}

I’ve double-checked the binding and configuration, but I’m still unsure what might be causing the error. Here are some questions I have:

  1. Could this be a compatibility issue with the Pi-hole binding version?
  2. Am I missing any additional configuration settings?
  3. Is there an alternative way to define channels that might resolve this issue?

Any advice or insights would be greatly appreciated! Thanks in advance!

You don’t need to define all those channels. So change the configuration to

Thing pihole:server:livingroom "Pi-hole" @ "Livingroom"
[
    refreshIntervalSeconds=120,
    hostname="url",
    token="token"
]

and openHAB will create all the channels by itself.
In fact, the channels are of type “number-channel”, “enabled-channel” and “disable-enable-channel”, but there’s no point defining the channels, as they are not meant to be configurable.

I don’t know if this was changed some time ago so maybe documentation is only outdated…

I am using file based configuration (things, items, etc)
I have created pi-hole thing file (without channels) and then created items file.
Items are not linking autmatically to channels. Maybe something have changed but I always was doing like that (thing file → items file → it was linked autmatically)
Now there is no link. Only way to link it is through the MainUI interface.

Maybe I am doing something wrong or something has changed.
Does anyone has any idea what I can do in that case?

This did never work, as you need to provide the channel UIDs per Item.
But if you are using VS Code with openHAB plugin, the correct way is

  • Create thing in *.things file
  • open *.items file and set the cursor to an empty line
  • change the left menu to show items and things (openHAB logo)
  • maybe update things list (it’s only loaded at startup automatically) by clicking onto the circled arrow right to the things heading
  • scroll to the newly created thing
  • click onto the arrow to the right (on the right side of the thing) to create items for all channels at once
  • change the configuration as you like (but don’t change the uid… :slight_smile: )
1 Like

Thanks Udo. It worked.

1 Like