Monitoring your Internet connection

Tutorials & Guides

Monitoring your Internet connection

Postby krambriw » Thu Jun 02, 2016 6:07 am

There are several ways you can monitor that your internet connection is alive and functioning. This guide describes how you can achieve this with existing plugins and if the internet connection fails, it will power off/on your router using a rf controlled mains power switch device.

The following plugins are used for this setup:
- SchedulGhost
- MQTT Client
- TellStickDuo (or the RFXtrx or any other plugin able to operate a main power switch)

This is part of a configuration tree showing the actual sample configuration needed

Skärmklipp.JPG


In essence, it works like this:

0) When EventGhost starts up, a power on command is sent to the mains power switch and the macro for the 5 min check is enabled
1) Every 15 seconds (this can be altered of course) a message is published to a specific topic on the MQTT broker somewhere on Internet
2) A response is received more or less instantly and this is received by the MQTT Client that is subscribing to the same topic on the same broker
3) The response is stopping an egg timer and then restarting the same egg timer again as well as disabling the macro for the 5 minute check
4) If the responses stops coming, the egg timer will fire and the TellStickDuo will cycle the power supply to the router. In addition the macro for the 5 minute check will be enabled again
5) Hopefully the internet connection will be re-established when the router has booted up again and then also the macro for the 5 minute check once again will be disabled

In the sample configuration seen above, we are publishing a message to the MQTT broker every 15 seconds and the egg timer will fire if it doesn't get stopped within 1 minute. This can of course be configured differently if you prefer. Maybe publishing once a minute with an egg timer running for 5 minutes is good enough.

Also, when publishing to a public broker, define a topic name that is rather unique to you and your needs

The following pictures will show you the individual settings needed

SchedulGhost: the 2 timers you need to configure

Skärmklipp.JPG


MQTT Client:

Skärmklipp.JPG


The guide is continued in the next post....
Last edited by krambriw on Tue Jun 07, 2016 5:59 am, edited 6 times in total.
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2547
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Monitoring your Internet connection

Postby krambriw » Thu Jun 02, 2016 6:07 am

MQTT Client: Publish a message

Skärmklipp.JPG



SchedulGhost: Abort egg timer

Skärmklipp.JPG



SchedulGhost: Start egg timer

Skärmklipp.JPG
Last edited by krambriw on Thu Jun 02, 2016 6:14 am, edited 1 time in total.
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2547
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Monitoring your Internet connection

Postby krambriw » Sat Jun 04, 2016 7:28 am

This an xml configuration file for the above setup. Just open it in EventGhost. What you need to do in addition is to add and configure the SchedulGhost schedule that is handling the checks. Eventually you also need to add some plugins to your plugins folder if they are missing.

CheckInternet.xml
(3.33 KiB) Downloaded 82 times
Last edited by krambriw on Tue Jun 07, 2016 6:01 am, edited 1 time in total.
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2547
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Monitoring your Internet connection

Postby allalone747 » Tue Jun 07, 2016 6:23 am

Hello Krambriw, thank you for your time in making this tutorial , I am sure like myself others will appreciate your good work for this forum and now your added input with tutorial ,
SchedulGhost is very difficult to configure I am looking forward for a tutorial done on this plugin

Thanks you again
Cheers :roll:
allalone747
Experienced User
 
Posts: 81
Joined: Sun May 03, 2015 2:17 pm

Re: Monitoring your Internet connection

Postby tjabas » Thu Jun 16, 2016 11:54 am

it seems like eventghost gets a little busy when it tasks alot of commands/events, i get sudden reboots that dont have any connection to the ResetRouter event, yet it fires from time to time.

Can i maybe increase the lime for the ,MQTT event 'MQTT.Check_Internet? if that is the case?

and if its possible, were do i change the time?
tjabas
Experienced User
 
Posts: 98
Joined: Sun Feb 07, 2016 6:28 pm

Re: Monitoring your Internet connection

Postby krambriw » Fri Jun 17, 2016 7:30 pm

It is the start egg timer time you should extend (increase, make longer). The thing is that a running egg timer is running in a separate thread. Even if EventGhost gets busy and thereby due to some overload is not able to stop the egg timer, it will fire when the time has passed and cause a reset of your router.
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2547
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Monitoring your Internet connection

Postby tjabas » Mon Jun 20, 2016 8:47 pm

There seems to be some problem with the MQTT, it cant send the massage anymore, even thought i have connection, have you encountered any problem krambriw?
tjabas
Experienced User
 
Posts: 98
Joined: Sun Feb 07, 2016 6:28 pm

Re: Monitoring your Internet connection

Postby krambriw » Tue Jun 21, 2016 6:02 am

No, not really, I am not using that server on a regular basis. There are several public MQTT servers (brokers is a better word) that you can try instead.
https://github.com/mqtt/mqtt.github.io/wiki/public_brokers

Maybe try with iot.eclipse.org
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2547
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Monitoring your Internet connection

Postby tjabas » Thu Jun 30, 2016 10:19 am

Hi krambriw!

i have been using this plugin for a while now and it seems to work pretty well, exept for some strange problems that occurs sometimes.

Sometimes when we loose internet connection the plugin can still send the MQTT message, i have looked into this and the whole house , every computer is down, but still the MQTT can send and recive the message, i cant figure it out, how is that possible?
tjabas
Experienced User
 
Posts: 98
Joined: Sun Feb 07, 2016 6:28 pm

Re: Monitoring your Internet connection

Postby krambriw » Thu Jun 30, 2016 12:51 pm

Well, the only way (to my understanding) the MQTT can send and receive an answer is if the connection with the MQTT broker is established! I do not think there is any caching in between that could cause the connection to look ok even if it is down. Everytime a new message is published to the broker, a new connection is made and thereafter disconnected.

Could it be that you just are losing some services/ports in your internet connection??? But I do not know if this is even possible that such a thing could happen...
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2547
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: Monitoring your Internet connection

Postby m19brandon » Sun Sep 25, 2016 6:31 am

Never thought to use MQTT timeout as a test. I use ping plugin to google's DNS(8.8.8.8) if down at 60 seconds I restart the router. :)
m19brandon
Experienced User
 
Posts: 148
Joined: Mon Feb 03, 2014 10:36 pm


Return to Tutorials & Guides

Who is online

Users browsing this forum: No registered users and 1 guest