Jump to content

Looking for a clean bit of Insteon polling code


mango

Recommended Posts

I'm sure this would be quite easy, but wondering if anyone could flex their programmatica skills at this one:

 

I have a septic pump on a GFCI (long story - no ground) so I want to plug an Insteon device into it (dimmer, switch etc.), that will be able to be polled by the ISY every 30 minutes or so. If there is no response after say 5 polls, I am notified.

Would the best way to do this be an integer variable and If so how would you go about it?

 

Link to comment
Share on other sites

Don't use any type of Insteon Dimmer devices but an On/Off type.

Dimmers are not made for motor loads like a pump. On/Off types should control the pump motor. As long as the pumps load is below the modules ratings. You may also have to consider the pumps momentary starting current.

Link to comment
Share on other sites

14 minutes ago, Brian H said:

Don't use any type of Insteon Dimmer devices but an On/Off type.

Dimmers are not made for motor loads like a pump. On/Off types should control the pump motor. As long as the pumps load is below the modules ratings. You may also have to consider the pumps momentary starting current.

HI Brian,

The insteon device will have no load - it will be plugged into the GFCI and only used as a polling device. The septic pump is wired through the GFCI to another receptacle. 120V 15Amp.

Link to comment
Share on other sites

4 minutes ago, Goose66 said:

Are you trying to detect that the septic pump is running, or that the GFCI has not tripped?

And, is there another outlet on a different circuit near it?

Hey Goose,

I'm wanting to detect if the GFCI trips, which I would be able to do if the ISY device (no load) disappears.

Link to comment
Share on other sites

I should add, I chose to fit a GFCI to the line when I discovered the ground was faulty. I'm reading about 80 ohms. All cabling terminations checked / cleaned. It's an old style thick insulated 10 gauge copper cable with a very thin ground something like 18 gauge(?) which I can only assume has broken somewhere along the length.

Now the pump is on a GFCI I am worried it will occasionally trip and I will be unaware, so I thought I could rig something up with a plug in Insteon device just to monitor its state. No load will be going through the Insteon device and the GFCI and Insteon device will be installed indoors in the basement.

Edited by mango
typo
Link to comment
Share on other sites

My concern would be an Insteon device plugged into a GFCI with a faulty ground may give unreliable responses, even if the GFCI is not tripped.

I suggest a 120V relay module with the contact closure wired to an Insteon Low Voltage / Contact Closure Interface device plugged into a different circuit. So the 120V relay would be close to the GFCI outlet, but the relay output would need a low-voltage cable run for some distance to reach the Insteon Low Voltage device plugged into a different outlet. The status of the Insteon Low Voltage device plugged into a good circuit should be more reliable.

Edited by Goose66
  • Like 1
Link to comment
Share on other sites

@goose66 Interesting. Even using a dual RF Insteon device? The ground is 'technically there' but the resistance is higher than I would like. It's in the event of a major short to ground fault I would not be so sure grounding to the main panel would work properly, so it would possibly energize the pump and water in the tank until something hopefully trips (GFCI or if not installed 15Amp breaker).

Edited by mango
Link to comment
Share on other sites

Well, the other thing is I don't know how to check the "polling" response of an Insteon device in a program. I know you can Query a device in a program, but the status of the device will only change if the device returns a new status value. If the status value returned from the query is the same or no reply is received, then I don't know how you could differentiate between a same status or no reply in a program.

With the setup I suggested, you would get an Insteon broadcast and status value change when the GFCI tripped, and you could hang a program off that. You could also periodically query the low voltage device to get the current status just to be sure.

Edited by Goose66
  • Like 1
Link to comment
Share on other sites

Thinking about this a bit more, the GFCI does have a good ground as it is installed in a location directly from the main panel (basement), so it would only be the cable going underground outdoors, outdoor receptacle and pump that would not be grounded correctly/efficiently.

 

As far as 'polling', yes I agree I meant call for its status, I think in programming I can differentiate between it responding or not.

Edited by mango
Link to comment
Share on other sites

There does appear to be a "Responding is True" condition. Never used it - didn't even know it was there.

Anyway, you probably need two programs: One that polls the device and one that checks the "Responding" status. The polling program could perform a Query action of the device every minute, and the status check program could have "If <device> Responding is False, Wait 5 minutes, then send a notification." If the Responding returns to True within the 5 minute wait, then the program will be preempted and no notification will be sent.

Let us know how it works.

Edited by Goose66
  • Like 1
Link to comment
Share on other sites

Just tested this with a plug-in module, and it works.

New Program - [ID 0006][Parent 0001]

If
        'Holiday / Indoor Holiday 1' Responding is False
 
Then
        Wait  5 minutes 
        Send Notification to 'Default'
 
Else
   - No Actions - (To add one, press 'Action')

 

  • Thanks 1
Link to comment
Share on other sites

this is what I've been using for years.

Quote

CheckCircuitFaults - [ID 003A][Parent 0037][Not Enabled]

If
        Time is  6:00:00AM
     Or Time is  8:00:00AM
     Or Time is 10:00:00AM
     Or Time is 12:00:00PM
     Or Time is  2:00:00PM
     Or Time is  4:00:00PM
     Or Time is  6:00:00PM
     Or Time is  8:00:00PM
     Or Time is 10:00:00PM
     Or Time is 12:00:00AM
     Or Time is  2:00:00AM
     Or Time is  4:00:00AM
 
Then
        Set 'Garage / Z1 Lawn N' Query
        Run Program 'GarageRefrigerator' (If)
        Run Program 'EZRain_Circuit' (If)
 
Else
   - No Actions - (To add one, press 'Action')
 

Quote

GarageRefrigerator - [ID 0039][Parent 0037][Not Enabled]

If
        'Outside Front / OF-Courtyard' Responding is not True
 
Then
        Send Notification to 'PD Mobile Text' content 'Garage Fridge Circuit Tripped'
 
Else
   - No Actions - (To add one, press 'Action')
 
Garage refrigerator is on the Ground fault breaker circuit for front courtyard. 
The fault reset is on the outlet at the back of the garage, shop side.
 

Quote

EZRain_Circuit - [ID 0038][Parent 0037][Not Enabled]

If
        'Garage / Z1 Lawn N' Responding is not True
 
Then
        Send Notification to 'PD Mobile Text' content 'EZRain Circuit Tripped'
 
Else
   - No Actions - (To add one, press 'Action')
 

 

  • Thanks 1
Link to comment
Share on other sites

@Goose66thanks for your help on this! 😬

@vbPhil Very nice thank you. Along the lines of what I'm after. Clean and efficient. Do you get any false positives? Very very occasionally I will get a blip in communications, the odd device will not have responded correctly. I was intending to add some redundancy in the form of multiple no respond queries = notify.

Edited by mango
Link to comment
Share on other sites

21 minutes ago, mango said:

@Goose66thanks for your help on this! 😬

@vbPhil Very nice thank you. Along the lines of what I'm after. Clean and efficient. Do you get any false positives? Very very occasionally I will get a blip in communications, the odd device will not have responded correctly. I was intending to add some redundancy in the form of multiple no respond queries = notify.

I rarely get a false positive from the EZRain device. If a zone is currently watering it will sometimes fail the responding check.

Here's another program I run just once in the morning. Sometimes it's handy to get a notification when things are good not always just if they're bad.

Quote

CheckCircuitsGood - [ID 003B][Parent 0037][Not Enabled]

If
        Time is  7:00:00AM
    And 'Outside Front / OF-Courtyard' Responding is True
    And 'Garage / Z1 Lawn N' Responding is True
 
Then
        Send Notification to 'PD Mobile Text' content 'Ground Fault Good'
 
Else
        Set 'Garage / Z1 Lawn N' Query
        Run Program 'GarageRefrigerator' (If)
        Run Program 'EZRain_Circuit' (If)
 

 

  • Like 1
Link to comment
Share on other sites

What I don’t understand about your programs is that there is no delay between the query and the running of the programs that check the Responding status. But it takes some time after a query for the ISY to mark the device as not responding. Does the program wait on the results of the query before moving to the “Run” commands?

The beauty of the programs I suggested is that the polling (query) and the checking the responding status are uncoupled. As long as the program querying runs more frequently than the wait before the notification, it should work beautifully. It also gives time for multiple queries to take place with no response before sending the notification, thus accounting for occasional Insteon communication glitches (which may be frequent here).

Edited by Goose66
Link to comment
Share on other sites

The If statement of the status check program should only fire when the the Responding status of the Insteon device (here, "Indoor Holiday 1") changes. AFAIK, the Responding status of an Insteon device will only change resulting from a query - that's the important bit. So you would need two programs.

The first one would be the "polling" program and would be run every day to perform the polling (query) on some interval, e.g., every 10 minutes:

Polling - [ID 0005][Parent 0001]

If
        From     1:00:00AM
        For      24 hours 
 
Then
        Repeat Every  10 minutes 
           Set 'Holiday / Indoor Holiday 1' Query
 
Else
   - No Actions - (To add one, press 'Action')

The next program runs each time the status changes. Each status change causes the program to be executed anew, cancelling any prior running instance of the program, i.e., sitting in the wait:

Status Check - [ID 0006][Parent 0001]

If
        'Holiday / Indoor Holiday 1' Responding is not True
 
Then
        Wait  30 minutes 
        Send Notification to 'Default'
 
Else
   - No Actions - (To add one, press 'Action')
 

So if a query results in the Responding status of the Insteon device changing to False, then the program will run, the If statement will be true, and it will enter the wait (which should be an interval larger than the poling interval and the maximum acceptable time for your GFCI to be tripped). If the Responding status of the Insteon device changes back to True during the wait, the program runs again, cancelling the current wait, and falls into the Else branch, which does nothing. If the Responding status of the Insteon device remains False during the wait through all the subsequent queries, then eventually the Wait interval will end and the notification will be sent.

Edited by Goose66
  • Thanks 1
Link to comment
Share on other sites

How far away is the pump from the house?  Another solution would be to fix the ground wire.  You could add a second ground wire at the pump and shallow bury it back to the house.  If it's near your electric meter you might be able to ground it on the outside of your house, there is often a ground strip for use with phone and cable utilities.  Otherwise you would have to come up with a way to get it back inside.  Just a thought.

Link to comment
Share on other sites

18 hours ago, Goose66 said:

The If statement of the status check program should only fire when the the Responding status of the Insteon device (here, "Indoor Holiday 1") changes. AFAIK, the Responding status of an Insteon device will only change resulting from a query - that's the important bit. So you would need two programs....

Thanks, I had originally assumed there had to be code before the if statement. I shall work on building the programs thanks v much once more!

Link to comment
Share on other sites

14 hours ago, tmorse305 said:

How far away is the pump from the house?  Another solution would be to fix the ground wire.  You could add a second ground wire at the pump and shallow bury it back to the house.  If it's near your electric meter you might be able to ground it on the outside of your house, there is often a ground strip for use with phone and cable utilities.  Otherwise you would have to come up with a way to get it back inside.  Just a thought.

About 45ft underground from closest working ground. I am planning on replacing the cable at some point. This was an interim measure to add a bit more safety (even though never as good as true ground bonding to panel).

Link to comment
Share on other sites

1 hour ago, mango said:

Thanks, I had originally assumed there had to be code before the if statement. I shall work on building the programs thanks v much once more!

This is one of the hardest things for folks new to programming the ISY to understand: Adding a condition to the "If" statement really creates two things: 1) a trigger event that will cause the program to run, and 2) a condition that will be evaluated each time the program runs that will determine whether the "Then" or "Else" branch is executed. So, for example, "If 'Holiday / Indoor Holiday 1' Responding is not True" creates a trigger event for the program of "Responding status of 'Indoor Holiday 1' device changes" and a condition evaluated at the start of the program to decide which branch to execute.

Understanding this element, along with the "re-entrant" nature of the programs  during Waits and Repeats is critical to effectively using the programming model of the ISY, and is the reason why you seldom end up using Else branches and often need two programs, with one enabled and one disabled, for getting programs to operate as expected, as is explained ad nauseum in many postings in this forum (and in the Wiki, I believe).

Edited by Goose66
Link to comment
Share on other sites

I'm not that new 😁 Lol. I have quite a lot of programs but just doing basic-ish things. When you posted just the 'if Responding is false' code I thought had a Eurika moment and thought you were going to tell me the ISY knows when a device goes offline by itself.

  • Like 1
Link to comment
Share on other sites

2 minutes ago, mango said:

I'm not that new 😁 Lol. I have quite a lot of programs but just doing basic-ish things. When you posted just the 'if Responding is false' code I thought had a Eurika moment and thought you were going to tell me the ISY knows when a device goes offline by itself.

Ah, my bad.

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...