Page 1 of 1

Monitoring your Internet connection

Posted: Thu Jun 02, 2016 6:07 am
by krambriw
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....

Re: Monitoring your Internet connection

Posted: Thu Jun 02, 2016 6:07 am
by krambriw
MQTT Client: Publish a message
Skärmklipp.JPG

SchedulGhost: Abort egg timer
Skärmklipp.JPG

SchedulGhost: Start egg timer
Skärmklipp.JPG

Re: Monitoring your Internet connection

Posted: Sat Jun 04, 2016 7:28 am
by krambriw
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 277 times

Re: Monitoring your Internet connection

Posted: Tue Jun 07, 2016 6:23 am
by allalone747
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:

Re: Monitoring your Internet connection

Posted: Thu Jun 16, 2016 11:54 am
by tjabas
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?

Re: Monitoring your Internet connection

Posted: Fri Jun 17, 2016 7:30 pm
by krambriw
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.

Re: Monitoring your Internet connection

Posted: Mon Jun 20, 2016 8:47 pm
by tjabas
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?

Re: Monitoring your Internet connection

Posted: Tue Jun 21, 2016 6:02 am
by krambriw
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/ ... ic_brokers

Maybe try with iot.eclipse.org

Re: Monitoring your Internet connection

Posted: Thu Jun 30, 2016 10:19 am
by tjabas
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?

Re: Monitoring your Internet connection

Posted: Thu Jun 30, 2016 12:51 pm
by krambriw
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...

Re: Monitoring your Internet connection

Posted: Sun Sep 25, 2016 6:31 am
by m19brandon
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. :)