Pi-Hole Integration

Do you have a new Version?

The Switch don’t work anymore…

hey… I integrated the Pi-Hole yesterday… the switch works well in my case. I do not use a map in the channel in my case (please check that you call the URL with “disable” and not with “disabled”):

- id: status
    channelTypeUID: http:switch
    label: Status
    description: null
    configuration:
      onValue: enable
      offValue: disable
      stateExtension: /admin/api.php?summaryRaw&auth=xxxx
      commandExtension: /admin/api.php?%2$s&auth=xxxxx
      stateTransformation: JSONPATH:$.status∩REGEX:s/led/le/g

Disable and enable the Pi-Hole.
Regards,
Tim

Don’t work for me… Anyone else with text based things?

When I work with your stateExtension, commandExtension my other things don’t work anymore (because of the BaseURL).

Thing http:url:pihole "Pihole" [
	baseURL = "http://192.168.1.17/admin/api.php?summary&auth=xxxx",
	refresh = "120",
	timeout ="5000",
	ignoreSSLErrors = "true"
]
{
	Channels:
      
		Type number : domains_being_blocked [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.domains_being_blocked"
		]
		Type number : dns_queries_today [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.dns_queries_today"
		]
		Type number : ads_blocked_today [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.ads_blocked_today"
		]
		Type number : ads_percentage_today [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.ads_percentage_today"
		]
		Type number : unique_domains [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.unique_domains"
		]
		Type number : queries_forwarded [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.queries_forwarded"
		]
		Type number : queries_cached [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.queries_cached"
		]
		Type number : clients_ever_seen [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.clients_ever_seen"
		]
		Type number : unique_clients [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.unique_clients"
		]
		Type number : dns_queries_all_types [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.dns_queries_all_types"
		]
		Type number : reply_NODATA [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.reply_NODATA"
		]
		Type number : reply_NXDOMAIN [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.reply_NXDOMAIN"
		]
		Type number : reply_CNAME [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.reply_CNAME"
		]
		Type number : reply_IP [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.reply_IP"
		]
		Type number : privacy_level [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.privacy_level"
		]
		Type switch : status [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.status",
			onValue = "enabled",
			offValue = "disabled"
		]
		Type switch : enable_disable "PiHole Command (Enable/Disable)" [
				mode = "WRITEONLY",
				stateExtension = "/admin/api.php?summaryRaw&auth=xxxx",
				commandExtension = "/admin/api.php?%2$s&auth=xxxx",
				stateTransformation = "JSONPATH:$.status∩REGEX:s/led/le/g",
				onValue = "enable",
				offValue = "disable"		
			]


		//GRAVITY LAST UPDATED
		Type string : file_exists [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.gravity_last_updated.file_exists"
		]
		//ABSOLUTE TIME OF LAST UPDATE
		Type number : absolute [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.gravity_last_updated.absolute"
		]
		//RELATIVE TIME OF LAST UPDATE
		Type number : days [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.gravity_last_updated.relative.days"
		]
		Type number : hours [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.gravity_last_updated.relative.hours"
		]
		Type number : minutes [
			mode = "READONLY",
			stateTransformation = "JSONPATH:$.gravity_last_updated.relative.minutes"
		]
}