Python Plugin: Network Pinger (Native ICMP) Topic is solved

Python and python framework
gerardwr
Posts: 76
Joined: Saturday 28 January 2017 12:30
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by gerardwr » Wednesday 15 November 2017 0:05

Dnpwwo wrote:
Tuesday 14 November 2017 23:18
@gerardwr,

You can change the name of the device in Domoticz to anything you want using the normal "Edit" button in the "Switches" tab. The plugin sets a default name but does not rely on it remaining the same.
Yes I understand.

But suppose I would like to Ping 20 devices, you would have to edit the names of these devices individually. Defining the relation between name and IP in 1 place sounded appealing to me.

User avatar
Dnpwwo
Posts: 736
Joined: Sunday 23 March 2014 10:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Dnpwwo » Wednesday 29 November 2017 13:49

November 29th, 2017, version 3.0.1:
  • Devices are created in Domoticz the first time the plugin runs, one to show if the device is found and one to show the response time.
  • Devices that are not found are optionally shown with a red banner in the devices tab (if configured to do so)
  • New version handles DNS names where the IP addresses changes (e.g www.google.com) without creating new devices in Domoticz
Users of the previous version should 'Delete' then 'Add' the plugin via the Hardware page.
Requires recent beta for the response time devices to be updated.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw

gerardwr
Posts: 76
Joined: Saturday 28 January 2017 12:30
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by gerardwr » Wednesday 29 November 2017 16:56

Dnpwwo wrote:
Wednesday 29 November 2017 13:49
November 29th, 2017, version 3.0.1:
Just installed the updated plugin, works excellent!

Defined 3 addresses to ping in setting up, and for every address a "switch" and a "utility" is created automagically.

Schermafbeelding 2017-11-29 om 15.37.52.png
Schermafbeelding 2017-11-29 om 15.37.52.png (58.08 KiB) Viewed 2079 times
Schermafbeelding 2017-11-29 om 15.38.08.png
Schermafbeelding 2017-11-29 om 15.38.08.png (46.96 KiB) Viewed 2079 times

For each "utility" sensor a graph is made by Domoticz, picture below after 6+ hours.
Schermafbeelding 2017-11-29 om 22.25.10.png
Schermafbeelding 2017-11-29 om 22.25.10.png (118.68 KiB) Viewed 2069 times
Just as I wanted, well done, I'm happy :-)

schulpr
Posts: 120
Joined: Thursday 01 January 2015 10:10
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by schulpr » Friday 01 December 2017 13:21

Hi,

I'm getting errors on the last version (3.01):

2017-12-01 12:18:17.675 Error: (Pinger) 'onHeartbeat' failed 'IndexError':'list index out of range'.
2017-12-01 12:18:17.675 Error: (Pinger) ----> Line 181 in /home/pi/domoticz/plugins/pinger/plugin.py, function onHeartbeat
2017-12-01 12:18:17.675 Error: (Pinger) ----> Line 157 in /home/pi/domoticz/plugins/pinger/plugin.py, function onHeartbeat

Any idea what could be wrong?

Regards, Rob

User avatar
Dnpwwo
Posts: 736
Joined: Sunday 23 March 2014 10:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Dnpwwo » Saturday 02 December 2017 3:53

@schulpr,

Yes I do have an idea. I have been testing the plugin with multiple addresses lately and broke it for when only a single address is specified (which I'm guessing you have) :oops:

I've pushed an update to the Pinger example. Version 3.0.3 is here: https://github.com/domoticz/domoticz/bl ... /Pinger.py
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw

schulpr
Posts: 120
Joined: Thursday 01 January 2015 10:10
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by schulpr » Saturday 02 December 2017 9:39

Hi Dnpwwo,

Thank you for the update, the script does work now but I still get an (different) error:

" 2017-12-02 08:27:45.743 Error: (Pinger) Transport not initialized, write directive to '192.168.2.12' ignored. Connectionless transport should be Listening."

I was indeed testing with only one IP-address. I'm trying different plugins to see which one of them fits best for my needs. I like this one because it's easy to install en managed within Domoticz. There is another one (Ultimate Wifi and Bluetooth Presence Detection) that also pings the bluetooth mac-address but this is another type of script.

So I was wondering if it is possible to ping the bluetooth device also in a Python script. (Combine the best of both worlds sort of speak :-).

Thanks for all your work in the Domoticz community. A lot of people are doing a great job here so people with less knowledge can benefit from this.

Kind regards, Rob

gerardwr
Posts: 76
Joined: Saturday 28 January 2017 12:30
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by gerardwr » Saturday 02 December 2017 23:54

schulpr wrote:
Saturday 02 December 2017 9:39
Hi Dnpwwo,

Thank you for the update, the script does work now but I still get an (different) error:

" 2017-12-02 08:27:45.743 Error: (Pinger) Transport not initialized, write directive to '192.168.2.12' ignored. Connectionless transport should be Listening."
Yes, I've got this error too, exactly ON the hour, but not EVERY hour. Error log says

Code: Select all

2017-12-02 14:00:36.358 Error: (pinger) Transport not initialized, write directive to '192.168.0.222' ignored. Connectionless transport should be Listening.
2017-12-02 16:00:36.310 Error: (pinger) Transport not initialized, write directive to '192.168.0.222' ignored. Connectionless transport should be Listening.
2017-12-02 17:01:05.180 Error: (pinger) Transport not initialized, write directive to '192.168.0.222' ignored. Connectionless transport should be Listening.
2017-12-02 18:00:37.015 Error: (pinger) Transport not initialized, write directive to '192.168.0.32' ignored. Connectionless transport should be Listening.
no more this error till 22:45
In addition my error log contains this error EVERY hour

Code: Select all

2017-12-02 22:00:41.612 Error: (pinger) 'onHeartbeat' failed 'KeyError'.
2017-12-02 22:00:41.612 Error: (pinger) ----> Line 181 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onHeartbeat
2017-12-02 22:00:41.612 Error: (pinger) ----> Line 149 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onHeartbeat
schulpr wrote:
Saturday 02 December 2017 9:39
Thanks for all your work in the Domoticz community. A lot of people are doing a great job here so people with less knowledge can benefit from this.
+1 Excellent work!

Despite the errors the plugin works fine !

User avatar
bizziebis
Posts: 539
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi
Domoticz version: 3.8805
Location: The Netherlands
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by bizziebis » Wednesday 06 December 2017 14:26

I cannot get it to work, also not with the latest version of the plugin

Code: Select all

2017-12-06 13:22:04.895 (Ping Status) Started.
2017-12-06 13:22:05.064 (Ping Status) Entering work loop.
2017-12-06 13:22:05.065 (Ping Status) Initialized version 3.0.3, author 'dnpwwo'
2017-12-06 13:22:05.122 Error: (Ping Status) 'onStart' failed 'AttributeError':''Domoticz.Device' object has no attribute 'TimedOut''.
2017-12-06 13:22:05.123 Error: (Ping Status) ----> Line 172 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onStart
2017-12-06 13:22:05.123 Error: (Ping Status) ----> Line 106 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onStart
2017-12-06 13:22:05.123 Error: (Ping Status) ----> Line 189 in /home/pi/domoticz/plugins/Pinger/plugin.py, function UpdateDevice
I'm running Domoticz Version: 3.8337 on a Raspberry Pi 3 with Raspbian Jessie.

The python plugin subsystem seems to be working. Buienradar plugin and NUT UPS plugin are working without any problems.

User avatar
Dnpwwo
Posts: 736
Joined: Sunday 23 March 2014 10:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Dnpwwo » Wednesday 06 December 2017 22:50

@bizziebis,

ICMP and timed out devices are new features, you will need to be on a very recent beta. I'm on 3.8746
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw

User avatar
bizziebis
Posts: 539
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi
Domoticz version: 3.8805
Location: The Netherlands
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by bizziebis » Thursday 07 December 2017 15:25

Thanks, I was to quick with trying and not reading first.. I'm on V3.8775 now and it's working great.

User avatar
bizziebis
Posts: 539
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi
Domoticz version: 3.8805
Location: The Netherlands
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by bizziebis » Monday 22 January 2018 17:59

I noticed that this plugin was the root cause of my memory leak which I also mentioned in the Bug forum. Every hour it will take 0,6MB of memory which will result in almost 20MB memory increase of the Domoticz process each day.

Does anyone else have this problem too?

Velly
Posts: 21
Joined: Sunday 22 October 2017 19:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Velly » Sunday 04 February 2018 20:26

Confirm memory leak

+ getting thessev errors:

018-02-04 21:31:56.039 Error: (Pinger) 'onHeartbeat' failed 'KeyError'.
2018-02-04 21:31:56.039 Error: (Pinger) ----> Line 184 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onHeartbeat
2018-02-04 21:31:56.040 Error: (Pinger) ----> Line 149 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onHeartbeat

User avatar
Dnpwwo
Posts: 736
Joined: Sunday 23 March 2014 10:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Dnpwwo » Wednesday 07 February 2018 12:30

@Velly,

Can you have a look at the plugin.py and make sure you are running version 3.x.x?

I've looked at the code for 3.0.0 on github and can't see how you can get an error at line 149 without getting one at 148 first (which you don't)
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw

Velly
Posts: 21
Joined: Sunday 22 October 2017 19:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Velly » Friday 09 February 2018 15:13

@Dpnwwo

<plugin key="ICMP" name="Pinger (ICMP)" author="dnpwwo" version="3.0.3">

User avatar
Dnpwwo
Posts: 736
Joined: Sunday 23 March 2014 10:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Dnpwwo » Friday 09 February 2018 23:57

@Velly,

Can you try the version here: https://github.com/dnpwwo/Domoticz-Pinger-Plugin and let me know

That is the one I run successfully. Looks like I need to update the example version that ships with Domoticz
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw

Velly
Posts: 21
Joined: Sunday 22 October 2017 19:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Velly » Wednesday 14 February 2018 18:25

@Dnpwwo

Still same:
2018-02-14 19:22:23.264 Error: (Pinger) 'onHeartbeat' failed 'KeyError'.
2018-02-14 19:22:23.264 Error: (Pinger) ----> Line 180 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onHeartbeat
2018-02-14 19:22:23.264 Error: (Pinger) ----> Line 148 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onHeartbeat
NB: however Lines are changed - I did not compare by myself yet with previous plugin version.

I have about 8-10 python plugins working fine: - the second giving same looking errors is PiMonitor:
2018-02-14 19:21:53.663 Error: (PiMonitor) 'onStart' failed 'KeyError'.
2018-02-14 19:21:53.663 Error: (PiMonitor) ----> Line 162 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart
2018-02-14 19:21:53.663 Error: (PiMonitor) ----> Line 56 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart

I am on Jessie pi3 python 3.4

User avatar
Dnpwwo
Posts: 736
Joined: Sunday 23 March 2014 10:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Dnpwwo » Thursday 15 February 2018 13:00

@Velly,

Line 148 makes more sense and I think I understand the problem but I can't understand why I never see it because I think I should as well.

Anyway, I pushed a new version to github that has better handling for the Options dictionary and should resolve this.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw

Velly
Posts: 21
Joined: Sunday 22 October 2017 19:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Velly » Saturday 24 March 2018 20:53

old (3.0.3):
2018-03-24 21:47:10.421 Error: (Pinger) ----> Line 184 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onHeartbeat
string is : "_plugin.onHeartbeat()"

2018-03-24 21:47:10.421 Error: (Pinger) ----> Line 149 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onHeartbeat
string is : " if (Devices[Device].Options["Name"] == self.icmpConn.Name):"

Current up-to-date plugin (3.0.5):

2018-03-24 21:47:10.421 Error: (Pinger) ----> Line 180 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onHeartbeat
string is : "_plugin.onHeartbeat()"
+ 2018-03-24 22:16:27.496 Error: (Pinger) 'onHeartbeat' failed 'AttributeError':''IcmpDevice' object has no attribute 'Name''.
2018-03-24 21:47:10.421 Error: (Pinger) ----> Line 148 in /home/pi/domoticz/plugins/Pinger/plugin.py, function onHeartbeat
string is : " if (("Name" in Devices[Device].Options) and (Devices[Device].Options["Name"] == self.icmpConn.Name)):"



Could you pls take a look onto? - my knowledges in python are near zero level..

Thanks!

nanno
Posts: 2
Joined: Thursday 12 April 2018 14:05
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by nanno » Thursday 12 April 2018 15:17

Hello !

Same problem for me :(

2018-04-12 15:13:09.970 Error: (TEST42) 'onHeartbeat' failed 'AttributeError':''IcmpDevice' object has no attribute 'Name''.
2018-04-12 15:13:09.970 Error: (TEST42) ----> Line 187 in /home/pi/domoticz/plugins/PINGER/plugin.py, function onHeartbeat
2018-04-12 15:13:09.970 Error: (TEST42) ----> Line 155 in /home/pi/domoticz/plugins/PINGER/plugin.py, function onHeartbeat


Running on :
Version: 3.9208
Build Hash: ff40091a
Compile Date: 2018-04-08 17:15:17
dzVents Version: 2.4.4
Python Version: 3.4.2 (default, Oct 19 2014, 14:03:53) [GCC 4.9.1]


Do you have a solution?

Thx !

nanno
Posts: 2
Joined: Thursday 12 April 2018 14:05
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by nanno » Tuesday 12 June 2018 14:37

Hello,

I still have this trouble after updating Python and Domoticz.

What can I do to fix that ?

Thanks !

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests