Python Plugin: Wan IP Checker
Moderator: leecollings
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Python Plugin: Wan IP Checker
set url to "https://4.ifcfg.me/ip" no "http://4.ifcfg.me/ip"
normal http redirects to https but, I don't know if this redirection is possible via urllib request!!
Edit: Port0 is a variable that never used. you can ignore it.
normal http redirects to https but, I don't know if this redirection is possible via urllib request!!
Edit: Port0 is a variable that never used. you can ignore it.
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
-
- Posts: 8
- Joined: Tuesday 11 July 2017 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8805-b
- Location: France
- Contact:
Re: Python Plugin: Wan IP Checker
- yes, i used htpps no http (was just a test).
- ok for port 0
you've right, i tested this url through my Windows web browser. I use Jessie through terminal (no GUI, it's Jessie light).
Maybe this URL isn't reachable from raspberry... searching a way to let me test it via terminal.
My device is up to date, and fresh installed.
i encountre many issues with urllib with another plugin (Melcloud)...
- ok for port 0
you've right, i tested this url through my Windows web browser. I use Jessie through terminal (no GUI, it's Jessie light).
Maybe this URL isn't reachable from raspberry... searching a way to let me test it via terminal.
My device is up to date, and fresh installed.
i encountre many issues with urllib with another plugin (Melcloud)...
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Python Plugin: Wan IP Checker
Code: Select all
curl https://4.ifcfg.me/ip
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
-
- Posts: 8
- Joined: Tuesday 11 July 2017 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8805-b
- Location: France
- Contact:
Re: Python Plugin: Wan IP Checker
i've already tested it with wget. was unreachable.
i've checked my ip config (static) and it was ok, but i found other issues on my LAN.
After check evrything... In fact, it was a Smart TV player which was nevertheless configured in DHCP which had a reserved IP ... and there was an IP conflict which made crazy my router...
I'm sorry for bothering you.
Thank you for the plugin, and thank you for your responsiveness ...
i've checked my ip config (static) and it was ok, but i found other issues on my LAN.
After check evrything... In fact, it was a Smart TV player which was nevertheless configured in DHCP which had a reserved IP ... and there was an IP conflict which made crazy my router...
I'm sorry for bothering you.
Thank you for the plugin, and thank you for your responsiveness ...
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Python Plugin: Wan IP Checker
glad you sorted this out!!
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Python Plugin: Wan IP Checker
Hello,
Seems that "https://4.ifcfg.me/ip" that is used as default service on the plugin, is unavailable.
Alternatively you can use "http://whatismyip.akamai.com/".
More can be found on article bellow (nice work!):
https://unix.stackexchange.com/question ... ipt/194136
Seems that "https://4.ifcfg.me/ip" that is used as default service on the plugin, is unavailable.
Alternatively you can use "http://whatismyip.akamai.com/".
More can be found on article bellow (nice work!):
https://unix.stackexchange.com/question ... ipt/194136
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
-
- Posts: 708
- Joined: Saturday 27 February 2016 12:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: NL
- Contact:
Re: Python Plugin: Wan IP Checker
Excellent. That fixed it!ycahome wrote: ↑Tuesday 03 April 2018 8:43 Hello,
Seems that "https://4.ifcfg.me/ip" that is used as default service on the plugin, is unavailable.
Alternatively you can use "http://whatismyip.akamai.com/".
More can be found on article bellow (nice work!):
https://unix.stackexchange.com/question ... ipt/194136
Hans
-
- Posts: 15
- Joined: Monday 23 April 2018 10:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Netherlands
- Contact:
Re: Python Plugin: Wan IP Checker
Hi,
I have installed the script. Is it necessary to create a virtual device in Domoticz under Hardware? Which steps are required for this? Besides that, how can you test the script? Thanks in advance for the answers.
I have installed the script. Is it necessary to create a virtual device in Domoticz under Hardware? Which steps are required for this? Besides that, how can you test the script? Thanks in advance for the answers.
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Python Plugin: Wan IP Checker
if you mean that you have installed the plugin then, no additional actions required (apart from the python prerequisites). Device will appear on your utility section.
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
-
- Posts: 15
- Joined: Monday 23 April 2018 10:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Netherlands
- Contact:
Re: Python Plugin: Wan IP Checker
I have installed the latest version of the plugin via GitHub and followed the installation instructions. After the installation I have changed the URL in the plugin.py file from "https://4.ifcfg.me/ip" to "http://whatismyip.akamai.com/". Besides that, I have changed the port 8080 to 14080 as Domoticz is running via port 14080 in my situation. I have assumed that this change is required, but I am not sure. Can you tell me? Finally, I have restarted Domoticz. I don't see any new devices in the Utility section. What can I do to check what is wrong? Thanks in advance for your reaction.
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Python Plugin: Wan IP Checker
enable debug mode for this plugin
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
-
- Posts: 15
- Joined: Monday 23 April 2018 10:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Netherlands
- Contact:
Re: Python Plugin: Wan IP Checker
Solved! I have used the script below. Besides that I created a virtual device (WAN IP) in Domoticz for storing the IP address: Settings – Hardware – Naam: WAN IP – Type: Dummy – Toevoegen. Finally I created a virtual sensor with WAN IP as name and Sensor Type: Text.
return {
on = {
timer = { 'every 4 hours' }
},
logging = {
level = domoticz.LOG_FORCE,
marker = '[WAN IP]'
},
execute = function(dz, devNil)
local dzb = dz.LOG_FORCE
local getIp = 'curl -s http://whatismyip.akamai.com/'
local tmpFile = '/home/pi/domoticz/scripts/wanip.txt'
local actIp = ''
local devIp = dz.devices('WAN IP')
local currIp = devIp.text
os.execute(getIp..' > '..tmpFile)
actIp = io.open(tmpFile):read()
if actIp == nil then actIp = 'Cannot retrieve WAN IP' end
if actIp ~= currIp then
msgTxt = 'WAN IP has changed: '..currIp..' ==> '..actIp
dz.log(msgTxt, dzb)
dz.notify('WAN IP', msgTxt, dz.PRIORITY_EMERGENCY)
devIp.updateText(actIp)
os.execute('rm '..tmpFile)
else
dz.log('No change in WAN IP', dzb)
end
end
}
return {
on = {
timer = { 'every 4 hours' }
},
logging = {
level = domoticz.LOG_FORCE,
marker = '[WAN IP]'
},
execute = function(dz, devNil)
local dzb = dz.LOG_FORCE
local getIp = 'curl -s http://whatismyip.akamai.com/'
local tmpFile = '/home/pi/domoticz/scripts/wanip.txt'
local actIp = ''
local devIp = dz.devices('WAN IP')
local currIp = devIp.text
os.execute(getIp..' > '..tmpFile)
actIp = io.open(tmpFile):read()
if actIp == nil then actIp = 'Cannot retrieve WAN IP' end
if actIp ~= currIp then
msgTxt = 'WAN IP has changed: '..currIp..' ==> '..actIp
dz.log(msgTxt, dzb)
dz.notify('WAN IP', msgTxt, dz.PRIORITY_EMERGENCY)
devIp.updateText(actIp)
os.execute('rm '..tmpFile)
else
dz.log('No change in WAN IP', dzb)
end
end
}
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Python Plugin: Wan IP Checker
This is not a solution to your plugin problem. It's a totally different script that do (or don't do) the same job.cmartens75 wrote: ↑Wednesday 25 April 2018 22:39 Solved! I have used the script below. Besides that I created a virtual device (WAN IP) in Domoticz for storing the IP address: Settings – Hardware – Naam: WAN IP – Type: Dummy – Toevoegen. Finally I created a virtual sensor with WAN IP as name and Sensor Type: Text.
Try to not hijack threads by putting individual scripts on a plugin's thread.
If you want you can create your thread to the respective category.
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
Re: Python Plugin: Wan IP Checker
I'm using https://wtfismyip.com/text and works great.
-
- Posts: 358
- Joined: Tuesday 31 March 2015 22:06
- Target OS: Linux
- Domoticz version: 2024.3
- Location: east netherlands
- Contact:
Re: Python Plugin: Wan IP Checker
maybe some weird question, but is there a wizkid somewhere around here that could make a dyndns out from this script that should do an dynsdns update when the ip has changed?
i have a vps with a subdomain linked to my private ip, but when my provider changes my wan ip, i cannot connect it ofcourse.
at this moment i use the dyndns from my usg gateway that does its job, but i want to use my own (sub)domain..
i have a vps with a subdomain linked to my private ip, but when my provider changes my wan ip, i cannot connect it ofcourse.
at this moment i use the dyndns from my usg gateway that does its job, but i want to use my own (sub)domain..
Raspberry / ESP Boards / Relais / Milight / Hue / OTGW / P1 / Xiaomi / RFXCom / RFLink / ZWave / Conbee II / Z2M / MQTT / A lot of scripts and many more..
Software: Linux, Android and Windows
Software: Linux, Android and Windows
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Python Plugin: Wan IP Checker
Dyndns providers (subscripton based) have scripts to update dynamic IPs. You can try to trigger one of those scripts from domoticz!
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
-
- Posts: 358
- Joined: Tuesday 31 March 2015 22:06
- Target OS: Linux
- Domoticz version: 2024.3
- Location: east netherlands
- Contact:
Re: Python Plugin: Wan IP Checker
Yeah, i know
but i do not want to use others, i just want to use my own vps and (subdomain) dns and be my own dyndns host..
Raspberry / ESP Boards / Relais / Milight / Hue / OTGW / P1 / Xiaomi / RFXCom / RFLink / ZWave / Conbee II / Z2M / MQTT / A lot of scripts and many more..
Software: Linux, Android and Windows
Software: Linux, Android and Windows
-
- Posts: 361
- Joined: Sunday 29 November 2015 21:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: UK
- Contact:
Re: Python Plugin: Wan IP Checker
I hate to sound really stupid but here goes, I installed the plugin and indeed it works flawlessly, I have "Prowl" setup for my push notifications on other things so would like to use this to send me my IP info, where is the General txt value stored so I can do something with it ?
I have no issue with hardware construction and problem solving and software setup I can following instructions but scripting wise at the moment I have to use blockly cause i just can't get my head around anything else and it's not for the lack of trying.
TIA
Dave
I have no issue with hardware construction and problem solving and software setup I can following instructions but scripting wise at the moment I have to use blockly cause i just can't get my head around anything else and it's not for the lack of trying.
TIA
Dave
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Python Plugin: Wan IP Checker
Hi Dave.Dave21w wrote: ↑Wednesday 01 April 2020 10:09 I hate to sound really stupid but here goes, I installed the plugin and indeed it works flawlessly, I have "Prowl" setup for my push notifications on other things so would like to use this to send me my IP info, where is the General txt value stored so I can do something with it ?
I have no issue with hardware construction and problem solving and software setup I can following instructions but scripting wise at the moment I have to use blockly cause i just can't get my head around anything else and it's not for the lack of trying.
TIA
Dave
did you tried blockly Utility device actual value?
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
-
- Posts: 29
- Joined: Friday 29 November 2019 18:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Gent
- Contact:
Re: Python Plugin: Wan IP Checker
It looks like you need to set the Timer to 60 sec, otherwise you will get next error every minute
Is there a way to set that to 1 or 2 hours without this error.Error: IP Checker hardware (Idx) thread seems to have ended unexpectedly
Who is online
Users browsing this forum: Bing [Bot] and 1 guest