Page 1 of 9
Python Plugin: Wan IP Checker
Posted: Thursday 23 February 2017 11:34
by ycahome
Hi there.
I have managed to port emme's script bellow
viewtopic.php?t=14489
to a domoticz python plugin.
Plugin updates a "General,Text" Value with your Wan IP Address. This value can be used later on in order to update any scripts or notify you upon IP change.
I hope you like it.
Find newest version GitHub:
https://github.com/ycahome/WAN-IP-CHECKER.git
Installation instructions:
- Make sure you have Python3 installed!
Code: Select all
sudo apt-get install python3
sudo apt-get install python3-dev
Installation from GitHub:
Code: Select all
cd plugins
mkdir WAN-IP-CHECKER
sudo apt-get update
sudo apt-get install git
git clone https://github.com/ycahome/WAN-IP-CHECKER.git WAN-IP-CHECKER
cd WAN-IP-CHECKER
sudo chmod +x plugin.py
sudo /etc/init.d/domoticz.sh restart
Old Way Installation:
- Create Plugin Folder "WAN-IP-CHECKER" under "domoticz/plugins" folder
- Save this script as "plugin.py" on "WAN-IP-CHECKER" folder
- Restart domoticz service.
- Add a new entry of this Hardware on your domoticz installation (Setup/Hardware/select and add "Wan Ip Checker")
- NOTE:When userid/pw checking is active, make sure to add 127.0.0.* to the Local Networks field on the Settings of your Domoticz. ( many thanks to manjh for his help)
What am going to see?:
- Plugin will auto-add one Text Counter on your "Utility" Section named "<Your Hardware Name>- WAN IP 1".
F.A.Q
1. if I enable notification, will it send an e-mail? To which mail address?
- If you enable notifications, Domoticz notification settings will be used
2. what does the field "Check My IP URL" mean?
- is the URL that returns your WAN IP
3. Does the plugin send one single notification, or repeating?
- Single notification (one for each notification option set on settings) for every WAN IP change.
4. "Check My IP URL" .What is it used for? Compare to the outside IP address? Or should I fill in a site like WhoAmI?
- You can use the default one or another. Its up to you.
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 12:13
by emme
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 15:05
by JimmyH1969
Hi, Nice.... do you need to create a variable? I added it to the plugin folder but can't see it anywhere
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 15:14
by ycahome
if everything goes as designed

, it auto-create a Text Counter on "Utility" Section named "<Your Hardware Name>- WAN IP 1".
Did you added an entry of this specific hardware after Domoticz service restart? (check Installation Instructions on my first post)
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 17:42
by JimmyH1969
Yes, i got it, but from that moment my Domoticz became unresponsive and i could no longer connect to Domoticz. I had to stop the service, delete the plugin.py and start the service again to get acess to domoticz again....
btw this is on Windows

Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 17:51
by ycahome
Although this is built on Linux, I don't think that there is anything bound to Linux architecture. Its a simple python script.
Do you have any logs?
Unfortunately I don't have a Windows based domoticz to test it...
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 19:33
by emme
Simply GREAT!!!!
it works perfectly!!!!
Just a bit more clarification for the install:
you have to be root (not pi) to enter the plugins directory... so you have to issue a
sudo su
before everything else

Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 20:47
by BarryT
Nice idea, but i get a lot of errors...
Code: Select all
2017-02-23 20:46:13.797 (WAN IP) Initialized version 1.0.0, author 'ycahome'
2017-02-23 20:46:13.804 Error: (WAN IP) 'onStart' failed 'URLError'.
2017-02-23 20:46:13.804 Error: (WAN IP) ----> Line 94 in /home/pi/domoticz/plugins/wan-ip-checker/plugin.py, function onStart
2017-02-23 20:46:13.804 Error: (WAN IP) ----> Line 49 in /home/pi/domoticz/plugins/wan-ip-checker/plugin.py, function onStart
2017-02-23 20:46:13.804 Error: (WAN IP) ----> Line 162 in /usr/local/lib/python3.5/urllib/request.py, function urlopen
2017-02-23 20:46:13.804 Error: (WAN IP) ----> Line 465 in /usr/local/lib/python3.5/urllib/request.py, function open
2017-02-23 20:46:13.804 Error: (WAN IP) ----> Line 488 in /usr/local/lib/python3.5/urllib/request.py, function _open
2017-02-23 20:46:13.804 Error: (WAN IP) ----> Line 443 in /usr/local/lib/python3.5/urllib/request.py, function _call_chain
2017-02-23 20:46:13.804 Error: (WAN IP) ----> Line 1310 in /usr/local/lib/python3.5/urllib/request.py, function unknown_open
2017-02-23 20:46:23.322 Error: (WAN IP) 'onHeartbeat' failed 'URLError'.
2017-02-23 20:46:23.322 Error: (WAN IP) ----> Line 102 in /home/pi/domoticz/plugins/wan-ip-checker/plugin.py, function onHeartbeat
2017-02-23 20:46:23.322 Error: (WAN IP) ----> Line 73 in /home/pi/domoticz/plugins/wan-ip-checker/plugin.py, function onHeartbeat
2017-02-23 20:46:23.323 Error: (WAN IP) ----> Line 162 in /usr/local/lib/python3.5/urllib/request.py, function urlopen
2017-02-23 20:46:23.323 Error: (WAN IP) ----> Line 465 in /usr/local/lib/python3.5/urllib/request.py, function open
2017-02-23 20:46:23.323 Error: (WAN IP) ----> Line 488 in /usr/local/lib/python3.5/urllib/request.py, function _open
2017-02-23 20:46:23.323 Error: (WAN IP) ----> Line 443 in /usr/local/lib/python3.5/urllib/request.py, function _call_chain
2017-02-23 20:46:23.323 Error: (WAN IP) ----> Line 1310 in /usr/local/lib/python3.5/urllib/request.py, function unknown_open
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 20:52
by ycahome
I can't tell for sure....
Am suspecting that you should rename your folder to WAN-IP-CHECKER as folders are case sensitive on Linux OS.
Can you try it?
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 20:54
by BarryT
ycahome wrote:I can't tell for sure....
Am suspecting that you should rename your folder to WAN-IP-CHECKER as folders are case sensitive on Linux OS.
Can you try it?
Hold on a sec
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 20:56
by BarryT
Code: Select all
2017-02-23 20:55:02.221 (IPChecker) Exiting work loop...
2017-02-23 20:55:02.264 (IPChecker) Stopped.
2017-02-23 20:55:02.388 Error: (WAN-IP-CHECKER) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/wan-ip-checker/:/usr/local/lib/python35.zip:/usr/local/lib/python3.5/:/usr/local/lib/python3.5/plat-linux:/usr/local/lib/python3.5/lib-dynload'.
2017-02-23 20:55:02.388 Error: (IPChecker) Module Import failed, exception: 'ImportError'
2017-02-23 20:55:02.388 Error: (IPChecker) Module Import failed: ' Name: plugin'
Rebooting now...
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 20:57
by BarryT
Code: Select all
2017-02-23 20:56:51.276 Error: (IPChecker) 'onHeartbeat' failed 'URLError'.
2017-02-23 20:56:51.276 Error: (IPChecker) ----> Line 101 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2017-02-23 20:56:51.276 Error: (IPChecker) ----> Line 72 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2017-02-23 20:56:51.276 Error: (IPChecker) ----> Line 162 in /usr/local/lib/python3.5/urllib/request.py, function urlopen
2017-02-23 20:56:51.276 Error: (IPChecker) ----> Line 465 in /usr/local/lib/python3.5/urllib/request.py, function open
2017-02-23 20:56:51.276 Error: (IPChecker) ----> Line 488 in /usr/local/lib/python3.5/urllib/request.py, function _open
2017-02-23 20:56:51.276 Error: (IPChecker) ----> Line 443 in /usr/local/lib/python3.5/urllib/request.py, function _call_chain
2017-02-23 20:56:51.276 Error: (IPChecker) ----> Line 1310 in /usr/local/lib/python3.5/urllib/request.py, function unknown_open
2017-02-23 20:56:54.957 OpenZWave: Received timeout notification from HomeID: 25487523, NodeID: 9 (0x09)
2017-02-23 20:56:54.959 OpenZWave: All Nodes queried
2017-02-23 20:57:01.301 Error: (IPChecker) 'onHeartbeat' failed 'URLError'.
2017-02-23 20:57:01.302 Error: (IPChecker) ----> Line 101 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2017-02-23 20:57:01.302 Error: (IPChecker) ----> Line 72 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2017-02-23 20:57:01.302 Error: (IPChecker) ----> Line 162 in /usr/local/lib/python3.5/urllib/request.py, function urlopen
2017-02-23 20:57:01.302 Error: (IPChecker) ----> Line 465 in /usr/local/lib/python3.5/urllib/request.py, function open
2017-02-23 20:57:01.302 Error: (IPChecker) ----> Line 488 in /usr/local/lib/python3.5/urllib/request.py, function _open
2017-02-23 20:57:01.302 Error: (IPChecker) ----> Line 443 in /usr/local/lib/python3.5/urllib/request.py, function _call_chain
2017-02-23 20:57:01.302 Error: (IPChecker) ----> Line 1310 in /usr/local/lib/python3.5/urllib/request.py, function unknown_open
2017-02-23 20:57:11.272 Error: (IPChecker) 'onHeartbeat' failed 'URLError'.
2017-02-23 20:57:11.272 Error: (IPChecker) ----> Line 101 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2017-02-23 20:57:11.272 Error: (IPChecker) ----> Line 72 in /home/pi/domoticz/plugins/WAN-IP-CHECKER/plugin.py, function onHeartbeat
2017-02-23 20:57:11.272 Error: (IPChecker) ----> Line 162 in /usr/local/lib/python3.5/urllib/request.py, function urlopen
2017-02-23 20:57:11.272 Error: (IPChecker) ----> Line 465 in /usr/local/lib/python3.5/urllib/request.py, function open
2017-02-23 20:57:11.272 Error: (IPChecker) ----> Line 488 in /usr/local/lib/python3.5/urllib/request.py, function _open
2017-02-23 20:57:11.272 Error: (IPChecker) ----> Line 443 in /usr/local/lib/python3.5/urllib/request.py, function _call_chain
2017-02-23 20:57:11.272 Error: (IPChecker) ----> Line 1310 in /usr/local/lib/python3.5/urllib/request.py, function unknown_open
Still the same
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 21:02
by ycahome
Very strange, This is a raspbian?
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 21:06
by BarryT
ycahome wrote:Very strange, This is a raspbian?
Yes, it is..
2017-02-23 21:03:08.187 Domoticz V3.6775 (c)2012-2017 GizMoCuz
2017-02-23 21:03:08.188 Build Hash: 050cd55, Date: 2017-02-23 12:25:52
2017-02-23 21:03:08.188 Startup Path: /home/pi/domoticz/
2017-02-23 21:03:08.516 EventSystem: reset all events...
2017-02-23 21:03:08.956 PluginSystem: Started, Python version '3.5.0'.
Raspberry 3B with an older sd-card image of domoticz, updated to latest version
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 21:07
by BarryT
I think it has something to do with the Python, since i had to build it from source after getting errors about Python some weeks ago?
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 21:08
by ycahome
let me check on Rpi2 with latest beta
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 21:11
by ycahome
BarryT wrote:I think it has something to do with the Python, since i had to build it from source after getting errors about Python some weeks ago?
Do you have "python3-dev" installed?
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 21:17
by BarryT
ycahome wrote:BarryT wrote:I think it has something to do with the Python, since i had to build it from source after getting errors about Python some weeks ago?
Do you have "python3-dev" installed?
Good question, hold on..
Otherwise, i think i'm going to re-install the rpi because there are just to many (old) files not in use anymore...
** weird, it seems Python 2.7.9 is my main version?
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 21:27
by ycahome
Works Perfectly on my RPi-2B with Latest beta and Raspbian.
You have probably a lack of Python.....
Re: Plugin - Wan IP Checker
Posted: Thursday 23 February 2017 22:07
by JimmyH1969
Not working on Windows. Domoticz restarts every 10 seconds. Nothing in log, but thats hard to see if the system is no longer responding.
