This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Reset Router when Internet lost
#1
I have my LogicMachine remotely behind a router. Sometimes the router looses the Internet for a minute and for unknown reasons the build in VPN does not restart. I have hooked up one KNX actor to the power of the router. Once a day I do I scripted on/off. That has solved the problem temporarily.

Question: how would I go about creating a script that checks if the Internet is available from the LM and if not sends an "off" and after a minute an "on" to the knx actor?

cheers!!!
Reply
#2
Not sure if this is correct approach but you could try ping google.com. Use this script, you will get 0 on success.
Code:
ip = 'google.com'
res = os.execute('ping -c 2 -W 1 ' .. ip)
log(res)
------------------------------
Ctrl+F5
Reply
#3
(31.03.2021, 08:19)Daniel. Wrote: Not sure if this is correct approach but you could try ping google.com. Use this script, you will get 0 on success.
Code:
ip = 'google.com'
res = os.execute('ping -c 2 -W 1 ' .. ip)
log(res)

Thanks! So I did this:

Code:
ip = '192.168.0.1'
res = os.execute('ping -c 2 -W 1 ' .. ip)
if (res == 1) then
  log("Reboot due to VPN down")
  grp.write('4/1/2', false)
  os.sleep(1.5)
  grp.write('4/1/2', true)
end
Reply


Forum Jump: