Proposed enhancements to module: "internet_connect_check.pl"

View: New views
4 Messages — Rating Filter:   Alert me  

Proposed enhancements to module: "internet_connect_check.pl"

by Jack Edin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Group opinion sought...

There is a common code module called internet_connect_check.pl...

The description reads: "Uses ping to monitor if your internet connection
is up or down. Useful for those with cable or dsl modems that often go
down for hours at a time."

There are NO Config params...

Well I turned this module on for my MH installation a long time ago. As
I read the shopping list of available modules, this one was a
no-brainer... I want THAT!

Yet it has never worked for me, so I assumed it might be broken.

It was my expectations that were incorrect, however. I thought that MH
would tell me when the internet went down. Speak a message telling me
there was a problem...

So I asked Sean (my coder buddy, and fellow MH user) to look into it and
he told me what he found.

This module will ping Google.com, which is hard coded...
The state of the internet connect can be detected, but I would need my
own code to announce it, etc.
The state change happens but once when disconnected, and once again when
reconnected.
There is code within the module to announce, but it is commented out...

He says that MH is written this way. That if you want to do something
with most modules, you need some custom code to do so... Not very user
friendly!!

I would like to see this module work differently, but I don't want mine
to differ from everybody else. So I want you guys to agree, and we'll
all settle for the group's idea of how it oughta be...

I propose three changes:

1) Make a Config parameter: Ping_address

We can set it to google.com, as it is currently, by default.

Some might like to ping their router instead... Making this a config
param is a no brainer...

2) Make a Config parameter: Announce

This is a yes/no or perhaps a 1/0...

So the people who currently use the module as-is can set it to NO, and
see no changes and continue to use it as it was...

However I believe the default should be YES

3) Make Config parameter: Announce_frequency

How often do you want to be reminded the internet is still down. For me
once is not enough!!

I would want to be reminded every 15 minutes...

So the default could be 0, and we can eliminate the second parameter I
described above.

Sean is currently looking to add 10 lines of code to my Jack.pl to do
what I want...

He could just as easily enhance the main module for everybody's benefit...

So can we get some discussion on the matter?

Thanks!

Jack
:)


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Re: Proposed enhancements to module: "internet_connect_check.pl"

by Brad Yarotsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When I am trouble shooting an internet problem I start at the furthest point
and work closer.

1. Ping google.com (reply - working, no reply - no google.com probably no
internet)
2. Ping ISP DNS server (reply - google.com name not being resolved, no reply -
no internet or problem with workstation)
3. Ping gateway (reply - no internet, no reply - internet probably fine,
problem with router or local workstation)
4. Ping local IP (reply - probably router is down, no reply - problem with
local machine, internet, router, DNS are probably fine)

Just a thought to find out what is really going on, maybe bad cable or crappy
router, not always internet problem... Not sure if Misterhouse can determine
gateway and DNS addresses, probably can.

Thanks
Brad



> Group opinion sought...
>
> There is a common code module called internet_connect_check.pl...
>
> The description reads: "Uses ping to monitor if your internet connection
> is up or down. Useful for those with cable or dsl modems that often go
> down for hours at a time."
>
> There are NO Config params...
>
> Well I turned this module on for my MH installation a long time ago. As
> I read the shopping list of available modules, this one was a
> no-brainer... I want THAT!
>
> Yet it has never worked for me, so I assumed it might be broken.
>
> It was my expectations that were incorrect, however. I thought that MH
> would tell me when the internet went down. Speak a message telling me
> there was a problem...
>
> So I asked Sean (my coder buddy, and fellow MH user) to look into it and
> he told me what he found.
>
> This module will ping Google.com, which is hard coded...
> The state of the internet connect can be detected, but I would need my
> own code to announce it, etc.
> The state change happens but once when disconnected, and once again when
> reconnected.
> There is code within the module to announce, but it is commented out...
>
> He says that MH is written this way. That if you want to do something
> with most modules, you need some custom code to do so... Not very user
> friendly!!
>
> I would like to see this module work differently, but I don't want mine
> to differ from everybody else. So I want you guys to agree, and we'll
> all settle for the group's idea of how it oughta be...
>
> I propose three changes:
>
> 1) Make a Config parameter: Ping_address
>
> We can set it to google.com, as it is currently, by default.
>
> Some might like to ping their router instead... Making this a config
> param is a no brainer...
>
> 2) Make a Config parameter: Announce
>
> This is a yes/no or perhaps a 1/0...
>
> So the people who currently use the module as-is can set it to NO, and
> see no changes and continue to use it as it was...
>
> However I believe the default should be YES
>
> 3) Make Config parameter: Announce_frequency
>
> How often do you want to be reminded the internet is still down. For me
> once is not enough!!
>
> I would want to be reminded every 15 minutes...
>
> So the default could be 0, and we can eliminate the second parameter I
> described above.
>
> Sean is currently looking to add 10 lines of code to my Jack.pl to do
> what I want...
>
> He could just as easily enhance the main module for everybody's benefit...
>
> So can we get some discussion on the matter?
>
> Thanks!
>
> Jack
> :)
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ________________________________________________________
> To unsubscribe from this list, go to:
> http://sourceforge.net/mail/?group_id=1365
>
>



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Re: Proposed enhancements to module: "internet_connect_check.pl"

by Thom Paine :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I like the idea of this, and it would be something that I would like
to use. Although what I am seeing more is that pings are dropped from
certain addresses.

I like the announce every 15 minutes as well, because my home internet
I rely on for my voip as well as my consulting business. If it is down
for 15 minutes, that is a big deal to me.

This could be modified a little more to monitor remote servers, but I
would think a fork would be better. No sense getting this one filled
up with too many features that not everyone would use.

On Tue, Aug 25, 2009 at 5:40 PM, Jack Edin<jack@...> wrote:

> Group opinion sought...
>
> There is a common code module called internet_connect_check.pl...
>
> The description reads: "Uses ping to monitor if your internet connection
> is up or down. Useful for those with cable or dsl modems that often go
> down for hours at a time."
>
> There are NO Config params...
>
> Well I turned this module on for my MH installation a long time ago. As
> I read the shopping list of available modules, this one was a
> no-brainer... I want THAT!
>
> Yet it has never worked for me, so I assumed it might be broken.
>
> It was my expectations that were incorrect, however. I thought that MH
> would tell me when the internet went down. Speak a message telling me
> there was a problem...
>
> So I asked Sean (my coder buddy, and fellow MH user) to look into it and
> he told me what he found.
>
> This module will ping Google.com, which is hard coded...
> The state of the internet connect can be detected, but I would need my
> own code to announce it, etc.
> The state change happens but once when disconnected, and once again when
> reconnected.
> There is code within the module to announce, but it is commented out...
>
> He says that MH is written this way. That if you want to do something
> with most modules, you need some custom code to do so... Not very user
> friendly!!
>
> I would like to see this module work differently, but I don't want mine
> to differ from everybody else. So I want you guys to agree, and we'll
> all settle for the group's idea of how it oughta be...
>
> I propose three changes:
>
> 1) Make a Config parameter: Ping_address
>
> We can set it to google.com, as it is currently, by default.
>
> Some might like to ping their router instead... Making this a config
> param is a no brainer...
>
> 2) Make a Config parameter: Announce
>
> This is a yes/no or perhaps a 1/0...
>
> So the people who currently use the module as-is can set it to NO, and
> see no changes and continue to use it as it was...
>
> However I believe the default should be YES
>
> 3) Make Config parameter: Announce_frequency
>
> How often do you want to be reminded the internet is still down. For me
> once is not enough!!
>
> I would want to be reminded every 15 minutes...
>
> So the default could be 0, and we can eliminate the second parameter I
> described above.
>
> Sean is currently looking to add 10 lines of code to my Jack.pl to do
> what I want...
>
> He could just as easily enhance the main module for everybody's benefit...
>
> So can we get some discussion on the matter?
>
> Thanks!
>
> Jack
> :)
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ________________________________________________________
> To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365
>
>



--
-=/>Thom

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Re: Proposed enhancements to module: "internet_connect_check.pl"

by Michael Stovenour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tend to believe that a script like this should detect some type of event
and set status indications; the current script behavior you describe below.
Then there should be other scripts or just a simple trigger that act on the
state change.  That way an individual is free to choose how he detects
events and how he responds to events.  There might be 3 different "internet
check" scripts that approach the problem differently.  Then there might be
multiple scripts that trigger on that event and take different actions e.g.
speak the status, flash a lamp, etc.  IMO, one reason MH has so many poorly
integrated scripts is that each individual creates their own monolithic
solution that is only interesting to them and difficult to adapt to the
needs of others.
I think you are on the right track adding the code to a separate script.  If
the current internet_connect_check.pl were enhanced to expose a "state
change" variable then you could speak the connection status with a simple
trigger.  If you believe that speaking the result is a common use for the
script, a reasonable proposition, then I suggest creating an
internet_connect_check_speak.pl script with your enhancements and having
that checked into the code/common repository.  Then other users simply need
to enable both scripts.
I struggled with the same architecture issue when I created my custom
version of the internet_earthquakes.pl script (which has been working very
well BTW).  This script also did both the detection and actions in the same
script.  I separated the functions because the detection portion (polling a
file on the internet) took too long and made MH pause.  Still the script
assumes a user wants the earthquakes spoken.  Worse it does not expose state
variables that other scripts can check.  I see this same pattern repeated in
many cases and I believe it limits the usefulness of the script.
I'd be happy to help out if you and your friend have any questions.  If you
add config vars you can document them with comments in the script.  I
started a page on the wiki that describes how the code documentation works:
http://misterhouse.wikispaces.com/BP-Documentation

Michael

-----Original Message-----
From: Jack Edin [mailto:jack@...]
Sent: Tuesday, August 25, 2009 4:41 PM
To: The main list for the MisterHouse home automation program
Subject: [mh] Proposed enhancements to module: "internet_connect_check.pl"

Group opinion sought...

There is a common code module called internet_connect_check.pl...

The description reads: "Uses ping to monitor if your internet connection
is up or down. Useful for those with cable or dsl modems that often go
down for hours at a time."

There are NO Config params...

Well I turned this module on for my MH installation a long time ago. As
I read the shopping list of available modules, this one was a
no-brainer... I want THAT!

Yet it has never worked for me, so I assumed it might be broken.

It was my expectations that were incorrect, however. I thought that MH
would tell me when the internet went down. Speak a message telling me
there was a problem...

So I asked Sean (my coder buddy, and fellow MH user) to look into it and
he told me what he found.

This module will ping Google.com, which is hard coded...
The state of the internet connect can be detected, but I would need my
own code to announce it, etc.
The state change happens but once when disconnected, and once again when
reconnected.
There is code within the module to announce, but it is commented out...

He says that MH is written this way. That if you want to do something
with most modules, you need some custom code to do so... Not very user
friendly!!

I would like to see this module work differently, but I don't want mine
to differ from everybody else. So I want you guys to agree, and we'll
all settle for the group's idea of how it oughta be...

I propose three changes:

1) Make a Config parameter: Ping_address

We can set it to google.com, as it is currently, by default.

Some might like to ping their router instead... Making this a config
param is a no brainer...

2) Make a Config parameter: Announce

This is a yes/no or perhaps a 1/0...

So the people who currently use the module as-is can set it to NO, and
see no changes and continue to use it as it was...

However I believe the default should be YES

3) Make Config parameter: Announce_frequency

How often do you want to be reminded the internet is still down. For me
once is not enough!!

I would want to be reminded every 15 minutes...

So the default could be 0, and we can eliminate the second parameter I
described above.

Sean is currently looking to add 10 lines of code to my Jack.pl to do
what I want...

He could just as easily enhance the main module for everybody's benefit...

So can we get some discussion on the matter?

Thanks!

Jack
:)


----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to:
http://sourceforge.net/mail/?group_id=1365


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365