Page 1 of 1

Python Plugin: Pi-hole Summary

Posted: Sunday 10 December 2017 23:53
by Xorfor
I have created a Python plugin to monitor summary data from Pi-hole (a black hole for internet advertisements):

https://github.com/Xorfor/Domoticz-Pi-hole-Plugin

Version 3.0.0
  1. Plugin rewritten, better coding
  2. Better handling on/off switch
  3. Added device to show last 2 blocked domains

Re: Python Plugin: Pi-hole Summary

Posted: Tuesday 19 December 2017 23:17
by Xorfor
This plugin is completely rewritten. It has now 9(!) devices showing summary data from Pi-hole.

Also a switch is available (if you entered the API token), to switch On/Off Pi-hole.

For some reason, I am not able (yet) to add the Pi-hole image to the devices. Any idea?

Re: Python Plugin: Pi-hole Summary

Posted: Tuesday 26 December 2017 17:03
by cryonic90
I would really like to use this plugin, but I get the following error in the log:
2017-12-26 17:02:48.293 Error: (Pihole) failed to parse parameters, Message or Message,Verb,URL,Headers,Delay expected.
2017-12-26 17:02:48.293 Error: (Pihole) 'CConnection_send' failed 'TypeError':'a bytes-like object is required, not 'dict''.

Can you help me with this?

Re: Python Plugin: Pi-hole Summary

Posted: Tuesday 26 December 2017 20:51
by Xorfor
Which Domoticz version are running? For plugins you better can update to the latest beta.
Also on which OS are you running Domoticz and how are the parameters filled in for this plugin. Can you give me some more details?

Re: Python Plugin: Pi-hole Summary

Posted: Thursday 28 December 2017 19:08
by cryonic90
I'm running this on the latest stable version of Domoticz (8153).
The rest of the settings are the ip address of the pihole server and the port 80.
And ofcourse the API key (which I've checked twice).

But does this mean that this plugin doesn't work with the latest stable version?

edit:
Ok, so updated to the latest beta and indeed, now it does work :) Thanks!

Re: Python Plugin: Pi-hole Summary

Posted: Thursday 28 December 2017 23:22
by Xorfor
:)

Re: Python Plugin: Pi-hole Summary

Posted: Saturday 30 December 2017 13:36
by Xorfor
I moved the plugin to https://github.com/Xorfor/Domoticz-Pi-hole-Plugin

The Percentage device is changed to Custom, so that this device also has the Pi-hole image :)

Re: Python Plugin: Pi-hole Summary

Posted: Saturday 20 January 2018 18:04
by EdwinK
Is it also possible to see the top-10 domains blocked? I know I can go to the Pi-hole admin to see that, but we can do that for the other info as well ;)

Re: Python Plugin: Pi-hole Summary

Posted: Saturday 20 January 2018 21:43
by Xorfor
My first version of the Pi-hole plugin, only had the On/Off switch voor Pi-hole. I use Domoticz not only to turn on/off lights, but also for OSMC (Kodi), receiver, etc. As a kind of remote control ;) .
The other information was easy to add and a kind of bonus.
The top-10 domains blocked can be added, but I am limited in the amount of text in the Text device. Probably a top 3 will be possible. And I can not change the icon for a text device :( .
I will think about this.

Re: Python Plugin: Pi-hole Summary

Posted: Tuesday 13 February 2018 22:33
by Xorfor
Version 3 is available!

Re: Python Plugin: Pi-hole Summary

Posted: Wednesday 21 February 2018 21:50
by remb0
after last update from beta and your plugin i get:

Code: Select all

2018-02-21 21:44:47.499 Error: (Pi-hole) ----> Line 267 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onMessage
2018-02-21 21:44:47.500 Error: (Pi-hole) ----> Line 139 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onMessage
2018-02-21 21:45:47.554 Error: (Pi-hole) 'onMessage' failed 'KeyError'.
2018-02-21 21:45:47.555 Error: (Pi-hole) ----> Line 267 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onMessage
2018-02-21 21:45:47.555 Error: (Pi-hole) ----> Line 139 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onMessage
what can it be?

Re: Python Plugin: Pi-hole Summary

Posted: Thursday 22 February 2018 20:16
by Xorfor
Do you mean that you also updated the Pi-hole plugin?
Try the latest version of the plugin. To be sure:

Install the latest version of the plugin
Goto Setup -> Hardware
Select the Pi-hole hardware
Click on Delete (and Ok)
Click on Add

Re: Python Plugin: Pi-hole Summary

Posted: Sunday 11 March 2018 9:44
by EdwinK
After getting no data for some time, I thought i would reinstall the plugin. First i deleted the older version I had and then added it again.

Code: Select all

 (PI-hole) Device creation failed, Domoticz settings prevent accepting new devices.
I clicked the enable 'new hardware detection for 5 minutes' button, but the above error is shown.

Edit: Fixed.

Re: Python Plugin: Pi-hole Summary

Posted: Friday 30 March 2018 14:44
by emeyedeejay
Raspbian Stretch
Rpi 3 B+
Domoiticz Beta 3.9133

Seeing this in my log suddenly:

Code: Select all

2018-03-30 14:34:22.227 Error: (Pi-hole Summary) 'onHeartbeat' failed 'AttributeError':''str' object has no attribute 'Connect''.
2018-03-30 14:34:22.227 Error: (Pi-hole Summary) ----> Line 283 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:34:22.227 Error: (Pi-hole Summary) ----> Line 244 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:35:22.243 Error: (Pi-hole Summary) 'onHeartbeat' failed 'AttributeError':''str' object has no attribute 'Connect''.
2018-03-30 14:35:22.243 Error: (Pi-hole Summary) ----> Line 283 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:35:22.243 Error: (Pi-hole Summary) ----> Line 244 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:36:22.255 Error: (Pi-hole Summary) 'onHeartbeat' failed 'AttributeError':''str' object has no attribute 'Connect''.
2018-03-30 14:36:22.255 Error: (Pi-hole Summary) ----> Line 283 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:36:22.255 Error: (Pi-hole Summary) ----> Line 244 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:37:22.262 Error: (Pi-hole Summary) 'onHeartbeat' failed 'AttributeError':''str' object has no attribute 'Connect''.
2018-03-30 14:37:22.262 Error: (Pi-hole Summary) ----> Line 283 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:37:22.262 Error: (Pi-hole Summary) ----> Line 244 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:38:22.258 Error: (Pi-hole Summary) 'onHeartbeat' failed 'AttributeError':''str' object has no attribute 'Connect''.
2018-03-30 14:38:22.258 Error: (Pi-hole Summary) ----> Line 283 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:38:22.258 Error: (Pi-hole Summary) ----> Line 244 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:39:22.260 Error: (Pi-hole Summary) 'onHeartbeat' failed 'AttributeError':''str' object has no attribute 'Connect''.
2018-03-30 14:39:22.260 Error: (Pi-hole Summary) ----> Line 283 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:39:22.260 Error: (Pi-hole Summary) ----> Line 244 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:40:22.265 Error: (Pi-hole Summary) 'onHeartbeat' failed 'AttributeError':''str' object has no attribute 'Connect''.
2018-03-30 14:40:22.265 Error: (Pi-hole Summary) ----> Line 283 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-03-30 14:40:22.265 Error: (Pi-hole Summary) ----> Line 244 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat

Re: Python Plugin: Pi-hole Summary

Posted: Sunday 01 April 2018 19:32
by emeyedeejay
Beta v 3.9139
Getting the following on startup.

Code: Select all

2018-04-01 19:28:53.920 (Pi-hole Summary) Initialized version 3.0.1, author 'Xorfor'
2018-04-01 19:28:53.925 (Pi Monitor) Debug logging mask set to: NONE
2018-04-01 19:28:53.962 Error: (Pi Monitor) 'onStart' failed 'KeyError'.
2018-04-01 19:28:53.962 Error: (Pi Monitor) ----> Line 164 in /home/pi/domoticz/plugins/Domoticz-PiMonitor-Plugin/plugin.py, function onStart
2018-04-01 19:28:53.962 Error: (Pi Monitor) ----> Line 59 in /home/pi/domoticz/plugins/Domoticz-PiMonitor-Plugin/plugin.py, function onStart
2018-04-01 19:28:53.966 (Pi-hole Summary) Debug logging mask set to: NONE
2018-04-01 19:28:53.966 (Pi-hole Summary) Image created. ID: 109
2018-04-01 19:28:53.966 (Pi-hole Summary) Devices created.

Re: Python Plugin: Pi-hole Summary

Posted: Sunday 15 April 2018 9:31
by EdwinK
Getting the following error:

Code: Select all

2018-04-15 09:26:46.719 Error: (Pi_Hole) 'onHeartbeat' failed 'AttributeError':''str' object has no attribute 'Connect''.
2018-04-15 09:26:46.719 Error: (Pi_Hole) ----> Line 283 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat
2018-04-15 09:26:46.720 Error: (Pi_Hole) ----> Line 244 in /home/pi/domoticz/plugins/Domoticz-Pi-hole-Plugin/plugin.py, function onHeartbeat

Re: Python Plugin: Pi-hole Summary

Posted: Monday 30 April 2018 12:24
by poudenes
Hi All,

Installed the Plugin from :https://github.com/Xorfor/Domoticz-Pi-hole-Plugin

After install i see lot of Signal Faults. After disable the plugin the errors are gone.

Domoticz: V3.9227 and tried on later builds

Re: Python Plugin: Pi-hole Summary

Posted: Tuesday 25 April 2023 10:40
by Chris12
@Xorfor, it looks like your plug-in does not longer work since the latest versions of Pi-Hole.
For me no values are read anymore since 17/3/2023.

When I check the debug logging I can see messages like:

Code: Select all

 2023-04-25 10:35:54.169 Pi-Hole: (Pi-Hole) Calling message handler 'onMessage'.
2023-04-25 10:35:54.169 Pi-Hole: (Pi-Hole) onMessage called for RecentBlocked
2023-04-25 10:35:54.169 Pi-Hole: (Pi-Hole) Data: []
2023-04-25 10:35:54.169 Pi-Hole: (Pi-Hole) Pushing 'DisconnectDirective' on to queue
2023-04-25 10:35:54.169 (Pi-Hole) Processing 'DisconnectDirective' message
2023-04-25 10:35:54.169 Pi-Hole: (Pi-Hole) Disconnect directive received for '192.168.1.50:80'.
2023-04-25 10:35:54.169 (Pi-Hole) Handling TCP disconnect, socket (192.168.1.50:80) is connected
2023-04-25 10:35:54.169 (Pi-Hole) Queued asynchronous read aborted (192.168.1.50:80), [125] Operation canceled.
2023-04-25 10:35:54.169 Pi-Hole: (Pi-Hole) Pushing 'DisconnectedEvent' on to queue
2023-04-25 10:35:54.169 (Pi-Hole) Processing 'DisconnectDirective' message
2023-04-25 10:35:54.169 Pi-Hole: (Pi-Hole) Disconnect directive received for '192.168.1.50:80'.
2023-04-25 10:35:54.169 (Pi-Hole) Handling TCP disconnect, socket (192.168.1.50:80) is connected
2023-04-25 10:35:54.169 (Pi-Hole) Processing 'DisconnectedEvent' message
2023-04-25 10:35:54.169 (Pi-Hole) Queued asynchronous read aborted (192.168.1.50:80), [125] Operation canceled.
2023-04-25 10:35:54.169 Pi-Hole: (Pi-Hole) Pushing 'DisconnectedEvent' on to queue
2023-04-25 10:35:54.169 Pi-Hole: (Pi-Hole) Disconnect event received for '192.168.1.50:80'.
2023-04-25 10:35:54.169 Pi-Hole: (Pi-Hole) Pushing 'onDisconnectCallback' on to queue
2023-04-25 10:35:54.170 (Pi-Hole) Processing 'DisconnectedEvent' message 
Where 192.168.1.50 is the Pi-Hole system IP.
My domoticz (docker) version: Version: 2021.1 (build 13243)
Pi-Hole version: v5.16.2, FTL v5.22, Web Interface v5.19

Re: Python Plugin: Pi-hole Summary

Posted: Wednesday 27 September 2023 19:37
by sincze
It seems the plugin has been removed from Github ??