Page 4 of 9
Re: Plugin - Wan IP Checker
Posted: Monday 29 January 2018 22:54
by ycahome
domoticzag wrote: ↑Monday 29 January 2018 22:29
.... I would need to do some Python exercises first, I am an experienced C programmer but this is just a little bit different.
Its only a matter of some lines.
Plugin updates it's sensor only if there is an actual IP change.
We can add a plugin parameter to enable/disable notification and an alert immediate after update.
If you can wait, I can upload a new version...
Re: Plugin - Wan IP Checker
Posted: Monday 29 January 2018 22:55
by domoticzag
ycahome wrote: ↑Monday 29 January 2018 22:54
domoticzag wrote: ↑Monday 29 January 2018 22:29
.... I would need to do some Python exercises first, I am an experienced C programmer but this is just a little bit different.
Its only a matter of some lines.
Plugin updates it's sensor only if there is an actual IP change.
We can add a plugin parameter to enable/disable notification and an alert immediate after update.
If you can wait, I can upload a new version...
That would be awsome, thanks in advance!
Re: Plugin - Wan IP Checker
Posted: Monday 29 January 2018 22:58
by ycahome
I would look into, tomorow morning.
Bye
Re: Plugin - Wan IP Checker
Posted: Monday 29 January 2018 23:07
by manjh
ycahome wrote: ↑Monday 29 January 2018 22:54
domoticzag wrote: ↑Monday 29 January 2018 22:29
.... I would need to do some Python exercises first, I am an experienced C programmer but this is just a little bit different.
Its only a matter of some lines.
Plugin updates it's sensor only if there is an actual IP change.
We can add a plugin parameter to enable/disable notification and an alert immediate after update.
If you can wait, I can upload a new version...
I think it might be just as easy to have a Domoticz script react to a change in the text device that the plugin updates once the address changes.
But this would result in one single e-mail.
My solution is more complex, but it will keep sending one warning mail per day until I take action.
Re: Plugin - Wan IP Checker
Posted: Tuesday 30 January 2018 11:12
by ycahome
Version 1.2.0 released to include Notification option.
Make sure that you have properly setup your "Settings/Notifications" and/or "Settings/Email"
Hope you like it!
Re: Plugin - Wan IP Checker
Posted: Wednesday 31 January 2018 10:52
by calouis
Hello
I have the following message :
Code: Select all
Insert Custom Icon From Zip failed on file '/home/pi/domoticz/plugins/WAN-IP-CHECKER/wanipaddress.zip' with error 'Error opening zip file'
Can you help me?
Re: Plugin - Wan IP Checker
Posted: Wednesday 31 January 2018 11:03
by ycahome
calouis wrote: ↑Wednesday 31 January 2018 10:52
Hello
I have the following message :
Code: Select all
Insert Custom Icon From Zip failed on file '/home/pi/domoticz/plugins/WAN-IP-CHECKER/wanipaddress.zip' with error 'Error opening zip file'
Can you help me?
Sorry for that, is just a forgotten code test.
try again now by replacing the plugin code.
Re: Plugin - Wan IP Checker
Posted: Wednesday 31 January 2018 11:19
by calouis
Yes, it's good now
merci
Re: Plugin - Wan IP Checker
Posted: Wednesday 31 January 2018 18:55
by manjh
Where is the new code? I checked github but no luck... can you provide a link?
Re: Plugin - Wan IP Checker
Posted: Wednesday 31 January 2018 19:25
by manjh
manjh wrote: ↑Wednesday 31 January 2018 18:55
Where is the new code? I checked github but no luck... can you provide a link?
Sorry, just saw that you actually updated the code in the first post. Got it.
Now that I have it running, need a little guidance:
1. if I enable notification, will it send an e-mail? To which mail address?
2. what does the field "IP address"mean?
Re: Plugin - Wan IP Checker
Posted: Wednesday 31 January 2018 19:35
by ycahome
manjh wrote: ↑Wednesday 31 January 2018 19:25
Sorry, just saw that you actually updated the code in the first post. Got it.
Now that I have it running, need a little guidance:
1. if I enable notification, will it send an e-mail? To which mail address?
2. what does the field "IP address"mean?
1. If you enable notifications, Domoticz notification settings will be used
2. "IP address" is a typo (Corrected now). Actually means "Check My IP URL" and is the URL that returns your WAN IP.
Re: Plugin - Wan IP Checker
Posted: Wednesday 31 January 2018 21:54
by manjh
ycahome wrote: ↑Wednesday 31 January 2018 19:35
manjh wrote: ↑Wednesday 31 January 2018 19:25
Sorry, just saw that you actually updated the code in the first post. Got it.
Now that I have it running, need a little guidance:
1. if I enable notification, will it send an e-mail? To which mail address?
2. what does the field "IP address"mean?
1. If you enable notifications, Domoticz notification settings will be used
2. "IP address" is a typo (Corrected now). Actually means "Check My IP URL" and is the URL that returns your WAN IP.
OK, understand # 1. Does the plugin send one single notification, or repeating?
As for #2: what is it used for? Compare to the outside IP address? Or should I fill in a site like WhoAmI?
Re: Plugin - Wan IP Checker
Posted: Thursday 01 February 2018 8:15
by ycahome
manjh wrote: ↑Wednesday 31 January 2018 21:54
OK, understand # 1. Does the plugin send one single notification, or repeating?
As for #2: what is it used for? Compare to the outside IP address? Or should I fill in a site like WhoAmI?
1. Single notification (one for each notification option set on settings) for every WAN IP change.
2. You can use the default one or another. Its up to you.
I have created a F.A.Q section on the first post in order to help other users with their questions.

Re: Plugin - Wan IP Checker
Posted: Thursday 01 February 2018 9:21
by manjh
Excellent. This is a very valuable plugin.
One more question, and one suggestion:
Q: what happens if the Internet connection fails completely?
Sug: a "test" button might be nice, to simulate a changed IP.
Re: Plugin - Wan IP Checker
Posted: Thursday 01 February 2018 9:30
by manjh
this could be a small bug: I tried a corrupted IP-checker address. The plugin crashes:
Code: Select all
2018-02-01 09:27:03.950 Error: (WAN IP checker) 'onHeartbeat' failed 'ValueError'.
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 151 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 109 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 153 in /usr/lib/python3.4/urllib/request.py, function urlopen
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 440 in /usr/lib/python3.4/urllib/request.py, function open
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 258 in /usr/lib/python3.4/urllib/request.py, function __init__
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 284 in /usr/lib/python3.4/urllib/request.py, function full_url
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 313 in /usr/lib/python3.4/urllib/request.py, function _parse
Re: Plugin - Wan IP Checker
Posted: Thursday 01 February 2018 9:55
by ycahome
manjh wrote: ↑Thursday 01 February 2018 9:30
this could be a small bug: I tried a corrupted IP-checker address. The plugin crashes:
Code: Select all
2018-02-01 09:27:03.950 Error: (WAN IP checker) 'onHeartbeat' failed 'ValueError'.
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 151 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 109 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 153 in /usr/lib/python3.4/urllib/request.py, function urlopen
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 440 in /usr/lib/python3.4/urllib/request.py, function open
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 258 in /usr/lib/python3.4/urllib/request.py, function __init__
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 284 in /usr/lib/python3.4/urllib/request.py, function full_url
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 313 in /usr/lib/python3.4/urllib/request.py, function _parse
This is because plugin does not contain error handling on urlopen (try catch). Maybe on next version.
If a connection fails completely you will not have a way to post your notification so, another method should be in place (SMS or GPRS).
As for the test, we can include a plugin option "Test" (just like "Debug") with a custom function that will fill a random IP and trick the plugin. Maybe on the next version too.
EDIT: Just remembered that Settings/Notifications have "Test" buttons. You can always try those buttons. You want a different approach?
Thank you
Re: Plugin - Wan IP Checker
Posted: Thursday 01 February 2018 10:10
by manjh
ycahome wrote: ↑Thursday 01 February 2018 9:55
manjh wrote: ↑Thursday 01 February 2018 9:30
this could be a small bug: I tried a corrupted IP-checker address. The plugin crashes:
Code: Select all
2018-02-01 09:27:03.950 Error: (WAN IP checker) 'onHeartbeat' failed 'ValueError'.
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 151 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 109 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 153 in /usr/lib/python3.4/urllib/request.py, function urlopen
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 440 in /usr/lib/python3.4/urllib/request.py, function open
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 258 in /usr/lib/python3.4/urllib/request.py, function __init__
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 284 in /usr/lib/python3.4/urllib/request.py, function full_url
2018-02-01 09:27:03.950 Error: (WAN IP checker) ----> Line 313 in /usr/lib/python3.4/urllib/request.py, function _parse
This is because plugin does not contain error handling on urlopen (try catch). Maybe on next version.
If a connection fails completely you will not have a way to post your notification so, another method should be in place (SMS or GPRS).
As for the test, we can include a plugin option "Test" (just like "Debug") with a custom function that will fill a random IP and trick the plugin. Maybe on the next version too.
EDIT: Just remembered that Settings/Notifications have "Test" buttons. You can always try those buttons. You want a different approach?
Thank you
Hmmm... it failed, and it does not get back on its feet any more. I restored the correct value but the plugin still crashes...
For now I have disabled it and will do some more testing later.
As for the test functions: I agree but the test on settings/notifications actually test only that functionality. By adding a test button to the plugin, you could actually test the whole path, including the plugin.
One way to do it is to make the last known IP available to the HW screen. The user could change that, and see the plugin react.
Re: Plugin - Wan IP Checker
Posted: Thursday 01 February 2018 12:04
by ycahome
manjh wrote: ↑Thursday 01 February 2018 10:10
Version upgraded to 1.2.1
bug fixes, error handling and timeout on urlopen added.
Re: Plugin - Wan IP Checker
Posted: Thursday 01 February 2018 12:41
by manjh
Hmmm. replaced the code in the plugin.py, restarted Domoticz, and enabled the plugin.
Code: Select all
2018-02-01 12:40:01.517 Error: (WAN IP checker) 'onHeartbeat' failed 'ValueError'.
2018-02-01 12:40:01.517 Error: (WAN IP checker) ----> Line 151 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2018-02-01 12:40:01.517 Error: (WAN IP checker) ----> Line 102 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2018-02-01 12:40:01.517 Error: (WAN IP checker) ----> Line 153 in /usr/lib/python3.4/urllib/request.py, function urlopen
2018-02-01 12:40:01.517 Error: (WAN IP checker) ----> Line 440 in /usr/lib/python3.4/urllib/request.py, function open
2018-02-01 12:40:01.517 Error: (WAN IP checker) ----> Line 258 in /usr/lib/python3.4/urllib/request.py, function __init__
2018-02-01 12:40:01.517 Error: (WAN IP checker) ----> Line 284 in /usr/lib/python3.4/urllib/request.py, function full_url
2018-02-01 12:40:01.517 Error: (WAN IP checker) ----> Line 313 in /usr/lib/python3.4/urllib/request.py, function _parse
2018-02-01 12:40:03.075 dzVents: Warning! WAN IP has changed!
Re: Plugin - Wan IP Checker
Posted: Thursday 01 February 2018 12:45
by manjh
Usability suggestion: add plugin version number to the title as shown on the HW page of Domoticz.