Python Plugin: Pi-hole Summary Topic is solved

Python and python framework

Moderator: leecollings

Post Reply
Xorfor

Python Plugin: Pi-hole Summary

Post 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
Last edited by Xorfor on Tuesday 13 February 2018 22:32, edited 2 times in total.
Xorfor

Re: Python Plugin: Pi-hole Summary

Post 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?
cryonic90
Posts: 15
Joined: Friday 25 September 2015 10:22
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Pi-hole Summary

Post 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?
Xorfor

Re: Python Plugin: Pi-hole Summary

Post 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?
cryonic90
Posts: 15
Joined: Friday 25 September 2015 10:22
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Pi-hole Summary

Post 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!
Xorfor

Re: Python Plugin: Pi-hole Summary

Post by Xorfor »

:)
Xorfor

Re: Python Plugin: Pi-hole Summary

Post 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 :)
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Pi-hole Summary

Post 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 ;)
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Xorfor

Re: Python Plugin: Pi-hole Summary

Post 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.
Xorfor

Re: Python Plugin: Pi-hole Summary

Post by Xorfor »

Version 3 is available!
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Python Plugin: Pi-hole Summary

Post 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?
Xorfor

Re: Python Plugin: Pi-hole Summary

Post 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
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Pi-hole Summary

Post 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.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
emeyedeejay
Posts: 21
Joined: Sunday 25 March 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Pi-hole Summary

Post 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
emeyedeejay
Posts: 21
Joined: Sunday 25 March 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Pi-hole Summary

Post 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.
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Pi-hole Summary

Post 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
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Python Plugin: Pi-hole Summary

Post 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
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Chris12
Posts: 238
Joined: Tuesday 18 August 2020 8:41
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: NL
Contact:

Re: Python Plugin: Pi-hole Summary

Post 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
Domoticz beta | Dashticz beta | Synology DS415+ | Wall tablet Teclast 11.6inch (Android) | TADO v3 controlled heating
User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Python Plugin: Pi-hole Summary

Post by sincze »

It seems the plugin has been removed from Github ??
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest