Page 9 of 9

Re: Python Plugin: Wan IP Checker

Posted: Sunday 05 April 2020 22:41
by ycahome
iTDB wrote: Sunday 05 April 2020 21:21 It looks like you need to set the Timer to 60 sec, otherwise you will get next error every minute
Error: IP Checker hardware (Idx) thread seems to have ended unexpectedly
Is there a way to set that to 1 or 2 hours without this error.
This is the behaviour of domoticz. Cannot be modified by a plugin.

Re: Python Plugin: Wan IP Checker

Posted: Saturday 02 May 2020 14:38
by Bob123bob
I made a pull request that fix this issue https://github.com/ycahome/WAN-IP-CHECKER/pull/2
Check changes here : https://github.com/ycahome/WAN-IP-CHECKER/pull/2/files
or
Use my fork instead at https://github.com/gilmrt/Domoticz-WAN- ... ker-Plugin
or
Wait for pull request to be merged and update

The issue was the heartbeat run only at poll interval and must run less that every 30s
I applied recommandations
Warning: Setting this interval to greater than 30 seconds will cause a 'thread seems to have ended unexpectedly' message to be written to the log file every 30 seconds. The plugin will function correctly but this message can not be suppressed because it is a standard warning from Domoticz that a piece of hardware may have stopped responding.
If a plugin wants to heartbeat every 100 seconds it should be coded with the heartbeat interval set to 10, 20 or 25 seconds and only take action every 6th, 5th or 4th time the callback is invoked.

Re: Python Plugin: Wan IP Checker

Posted: Sunday 03 May 2020 9:07
by ycahome
Bob123bob wrote: Saturday 02 May 2020 14:38 I made a pull request that fix this issue https://github.com/ycahome/WAN-IP-CHECKER/pull/2
........

Your Pull Request has been merged. regards.


Current version:
v.1.2.6 : Fix (by gilmrt) for "Error: IP WAN hardware (XX) thread seems to have ended unexpectedly"

Re: Plugin - Wan IP Checker

Posted: Monday 01 November 2021 16:09
by pe1ago
andi216 wrote: Wednesday 30 August 2017 16:37 Hello
How can I send a notification to the Telegram if it changes wan ip?
(A simple method ... I'm not a programmer)
Same question here. Is there already a solution to send a Telegram message?

Re: Plugin - Wan IP Checker

Posted: Monday 01 November 2021 20:58
by ycahome
pe1ago wrote: Monday 01 November 2021 16:09
andi216 wrote: Wednesday 30 August 2017 16:37 Hello
How can I send a notification to the Telegram if it changes wan ip?
(A simple method ... I'm not a programmer)
Same question here. Is there already a solution to send a Telegram message?
I didn't had the chance to test it but, I think that if you set telegram's settings at Setup/Settings/Notifications/Telegram and enable Notifications on th plugin, you will get a notification for every WAN ip change. I personally receive it by email.

Actually, plugin uses Domoticz's notification settings.

regards,

Re: Python Plugin: Wan IP Checker

Posted: Thursday 11 November 2021 15:12
by pe1ago
First Thanks. That works but it will not sent the new WAN ip address only a change message.
I like to get the IP so I now how to get back into domoticz without the need for a DDNS.
Any chance? :roll:

Re: Python Plugin: Wan IP Checker

Posted: Thursday 11 November 2021 16:08
by ycahome
pe1ago wrote: Thursday 11 November 2021 15:12 First Thanks. That works but it will not sent the new WAN ip address only a change message.
I like to get the IP so I now how to get back into domoticz without the need for a DDNS.
Any chance? :roll:
Hello,

what this plugin is designed to do (with "notify" enabled) is to send an email with:
- subject "WAN-IP-Changed"
-body the new WAN IP address.

can you post here what you receive?

Re: Python Plugin: Wan IP Checker

Posted: Thursday 11 November 2021 16:19
by pe1ago
I have personal reasons not to work with email on Domoticz, al do it works that way.
I love to receive a telegram with the new IP. If possible of coarse.

Re: Python Plugin: Wan IP Checker

Posted: Thursday 11 November 2021 16:55
by ycahome
pe1ago wrote: Thursday 11 November 2021 16:19 I have personal reasons not to work with email on Domoticz, al do it works that way.
I love to receive a telegram with the new IP. If possible of coarse.
You have sent 4 posts to this forum.
in 1 of them you mention that the message you get "not contains the WAN IP"
on another you say that you don't want to use email but telegram.

cannot imagine what are the other two posts :lol: :lol: :lol: :D :roll: :o

Maybe you can try to search awhile before you post.
Start with some tests to see how notification system of Domoticz really works (its only 4 posts above after all)

Re: Python Plugin: Wan IP Checker

Posted: Friday 19 January 2024 20:42
by Hesmink
Is there any way to force the checker to request only for ipv4?

I now get an ipv6 address from https://ifconfig.me/ip

Re: Python Plugin: Wan IP Checker

Posted: Friday 19 January 2024 20:48
by Hesmink
Hesmink wrote: Friday 19 January 2024 20:42 Is there any way to force the checker to request only for ipv4?

I now get an ipv6 address from https://ifconfig.me/ip
To answer my own question: https://ipv4.icanhazip.com

Re: Python Plugin: Wan IP Checker

Posted: Saturday 20 January 2024 7:04
by lost
Hesmink wrote: Friday 19 January 2024 20:48 To answer my own question: https://ipv4.icanhazip.com
Not using this plugin, but from a lua time script that checks for changes periodically (stores them in a user var & if changed sends a mail with info+access links or at least once a week) I use theses URLs to get both:

https://api.ipify.org
https://api64.ipify.org

IPv6 can also be retrieved direcly from machine interface /sbin/ifconfig or similar tool as this one is global, but using external URLs allows checking true connectivity is OK & make both checks the same. IPv6 should almost never change are providers prefixes are not.

IMO, that's useful to get both: Already being compelled to use some hot-spots AP that were not under my control (hotels etc, especially in foreign countries where mobile phone network could also not be used) with no more available DHCP leases for hours due to heavy use by many people: So no IPv4 connectivity. But ipV6, addressing being global, could be used and having the address needed as in such case DNS may also be affected by lack of IPv4 (external port filtered in AP configuration), so no domain usable.

=> My advice: Don't choose, get both & in a way that may be used offline if needed (mail client that keep already loaded messages locally)!

Re: Python Plugin: Wan IP Checker

Posted: Friday 22 November 2024 11:49
by Cdzn
Hi guys. This method does`t work anymore?
viewtopic.php?t=14489&sid=03c00c6ca0ceb ... 1dc0c1cc57

Re: Python Plugin: Wan IP Checker

Posted: Friday 22 November 2024 12:07
by Fredom
Cdzn wrote: Friday 22 November 2024 11:49 Hi guys. This method does`t work anymore?
viewtopic.php?t=14489&sid=03c00c6ca0ceb ... 1dc0c1cc57
This wan works for me for years now

Code: Select all

return {
	on = {
		timer = { 'every 1 minutes' }
	},

	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/your name/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

}

Don't forgot not to chance in this line your name

Re: Python Plugin: Wan IP Checker

Posted: Saturday 30 November 2024 18:23
by dyter
I create a device "Ping Internet" for alert if internet down or wan changed

Code: Select all

commandArray = {}
if devicechanged['Ping Internet'] then
    time = os.date("%H:%M")
    if devicechanged['Ping Internet'] == 'On' then
        commandArray['SendNotification']= 'Internet maison rétablit à '..time..'#####telegram'
        local function get_ip(url)
            local result = (io.popen('curl -m 1 -s ' .. url):read("*a")):match("%d+%.%d+%.%d+%.%d+")
            return result
        end
        ipwan = get_ip('https://api.ipify.org') or get_ip('https://icanhazip.com') or get_ip('https://ifconfig.me')
        print(ipwan or "Erreur")
        if ipwan ~= uservariables["ipwan"] then
            commandArray['Variable:ipwan']= ipwan
    	    commandArray['SendNotification']= 'Attention adresse WAN changée: '..ipwan..'#####telegram'
        end
    	if otherdevices['Escaliers'] == 'On' then
    		commandArray['Escaliers']='Off'
    	end
    elseif devicechanged['Ping Internet'] == 'Off' then
    	if (time < '08:00' or time > '19:00') and otherdevices['Alarme'] == "En service" then
    		commandArray['Escaliers']='On'
    	end
    end
end
return commandArray


Re: Python Plugin: Wan IP Checker

Posted: Thursday 26 December 2024 20:45
by sincze
Hesmink wrote: Friday 19 January 2024 20:48
Hesmink wrote: Friday 19 January 2024 20:42 Is there any way to force the checker to request only for ipv4?

I now get an ipv6 address from https://ifconfig.me/ip
To answer my own question: https://ipv4.icanhazip.com
Thanks that helped ;-) I was trying the "-4 ifconfig.me" way but that did not work out ;-)