Jump to content

Newbie question - Having a switch override a motion sensor


netdogz

Recommended Posts

Posted

I am getting started with home automation and have installed the ISY994i as well as a few Insteon motion sensors (2420m) and dual band switches (2477s). What I am hoping to do is find a simple program that will allow me to turn the light on manually with the switch and stay on until the switch is turned off. I want to also have the motion sensors turn them on for 10 minutes when the switch is off. If during that time I turn the switch on, the lights should stay on until I turn it off. Essentially I'm hoping to have the motion sensor be the main control with the option of overriding it with the switch. I have searched the forums for this answer (which I assume would be a common one) and have also tried creating a program myself to no avail. I am hoping that one of the experts here already has a program I can borrow to accomplish this. Any help provided would be great.

 

Thanks, Rick

Posted

“What I am hoping to do is find a simple program that will allow me to turn the light on manually with the switch and stay on until the switch is turned off.â€

 

Nothing special needed for this part. No Program required. Either the switch controls the load directly or if an n-way configuration, a single ISY Scene with all the switches which participate in the specific n-way are Controllers in the ISY Scene.

 

“I want to also have the motion sensors turn them on for 10 minutes when the switch is off. If during that time I turn the switch on, the lights should stay on until I turn it off.â€

 

The Motion Sensor(s) do not directly control the switch(s). A Program detects the motion On message and does something (or not) based on the state of the switch.

 

If the switch is Off when motion is sensed the Program turns the switch On. If the switch is already On nothing happens. If the Program turns the switch On, it Waits 10 minutes and turns the switch Off. If the switch is turned on manually before the Wait 10 minutes completes the Wait is cancelled by the Status change of the switch and the Set ‘switchx’ Off is not executed. The switch has to be turned Off manually.

 
If
  Control Motion Sensor – Sensor is switched On
  And Status ‘switchx’ is Off
Then
  Set ‘switchx’ On
  Wait 10 minutes
  Set ‘switchx’ Off 
Else

Posted

Thanks for the help on this one but I tried that coding as my first program and what happens is that once the sensor it tripped it turns on the light and it stays on indefinitely. It seems that when it loops back to look at the status of the switch it see's it as on and leaves the light on forever. The program seems like it should work but I just tried it again from scratch and had the same results. I have listed the version I am using below to illustrate and have shortened the on/off time to make testing easier.

 

Am I missing something?

 

Thanks again for the help.

 

Rick

 

If

Control 'M4 - Front Porch - Sensor' is switched On

And Status 'Front Porch Switch' is Off

 

Then

Set 'Front Porch Switch' On

Wait 5 seconds

Set 'Front Porch Switch' Off

 

Else

- No Actions - (To add one, press 'Action')

Posted

Sorry, my bad. As soon as the Program turns the switch On and executes the Wait the If is reevaluated because the Status of the switch has changed, executing the Else so the Set switch Off is not executed.

 

Needs to be broken into two Programs to prevent the change in switch Status from cancelling the Set switch Off. I'll post something else tomorrow or someone else with a working example can post tonight.

Posted

You might try a program which monitors the switch:

 

Program: Front Porch Switch

If
Control 'Front Porch Switch' is switched On
And  Control 'Front Porch Switch' is not switched Off

Then

Else
- No Actions - (To add one, press 'Action')

Then change the second If to read:

 

If
Control 'M4 - Front Porch - Sensor' is switched On
And Program 'Front Porch Switch' is False

Then
Set 'Front Porch Switch' On
Wait 5 seconds
Set 'Front Porch Switch' Off

Else
- No Actions - (To add one, press 'Action')

Posted

Ok, the suggestion of using two programs fixed the problem of it not turning off but doesn't provide for the switch overriding the sensor. Here's what happens now:

 

- If the switch is off and the sensor is triggered, the light will turn on for 5 seconds and off again. (Good)

 

- If the switch is turned on the light stays on indefinitely. (Good)

 

- If the light is turned on with the switch and the sensor is then triggered, the light turns off after 5 seconds. (Bad)

 

Below is the modified code I'm using.

 

Any help is appreciated.

 

Rick

 

 

Program 1 (Front Porch Switch)

 

If

Control 'Front Porch Switch' is switched On

And Control 'Front Porch Switch' is not switched Off

 

Then

- No Actions - (To add one, press 'Action')

 

Else

- No Actions - (To add one, press 'Action')

 

Program 2 (Front Porch Sensor)

 

If

Control 'M4 - Front Porch - Sensor' is switched On

And Program 'Front Porch Switch' is False

 

Then

Set 'Front Porch Switch' On

Wait 5 seconds

Set 'Front Porch Switch' Off

 

Else

- No Actions - (To add one, press 'Action')

Posted

Change the programs to issue fastON's and fastOFF's. The fastON with the inline linc turns off the sense until you send the fastOFF as I recall. This way the switch will disable the sense feature and be the master until turned off...

Posted

Hmm. If the light is turned on with the switch the first program should turn true and stay true until the switch is turned off. When that program is true the second program will not turn true when the motion sensor is tripped, it should only evaluate false.

 

Is the motion sensor directly linked to the switch?

Posted

Try this. I have a working example somewhere but I can't find it and it is way past my bed time. When the switch is turned On manually it prevents (Disable) the motion program from triggering at all or terminates the Program (Disable) if it is already in the Wait.

 

If

Control 'Front Porch Switch' is switched On

And Control 'Front Porch Switch' is not switched Off

 

Then

Disable Program 'Program 2'

 

Else

Enable Program 'Program 2'

Posted

Lee,

 

I'll give that a try before I hit the sack as well. If you get a chance tomorrow to cut & paste an example, I'd appreciate it. I'm determined to get this sorted out since I need it for a few circuits in the hose. I really appreciate all the help....have a great night/

 

Rick

 

Bsobel,

 

No problem at all and thanks for the suggestion. I'm sure we'll sort it out eventually. I thought it would be easier since it seems like a very common situation. At least you guys didn't give me a "forget it" from the start, so there's still hope :)

Posted

I've tried all the suggestions thus far and still have the following results:

 

- If the switch is off and the sensor is triggered, the light will turn on for 5 seconds and off again. (Good)

 

- If the switch is turned on the light stays on indefinitely. (Good)

 

- If the light is turned on with the switch and the sensor is then triggered, the light turns off after 5 seconds. (Bad)

 

- If the sensor has triggered the light and the switch is turned on, the light still turns off in 5 seconds (Bad)

 

Below is the current code I'm using.

 

Any further help would be great. I'm turning in for the evening but will check again in the morning.

 

Rick

 

 

Program 1 (Front Porch Switch)

 

If

Control 'Front Porch Switch' is switched On

And Status 'Front Porch Switch' is not Off

 

Then

Disable Program 'Front Porch Sensor'

 

Else

Enable Program 'Front Porch Sensor'

 

 

 

 

 

Program 2 (Front Porch Sensor)

 

If

Control 'M4 - Front Porch Sensor' is switched On

 

Then

Set 'Front Porch Switch' On

Wait 3 seconds

Set 'Front Porch Switch' Off

 

Else

- No Actions - (To add one, press 'Action')

Posted

The second line in the If should be Control, rather than Status

 

If

Control 'Front Porch Switch' is switched On

And Status 'Front Porch Switch' is not Off

 

Then

Disable Program 'Front Porch Sensor'

 

Else

Enable Program 'Front Porch Sensor'

 

If

Control 'Front Porch Switch' is switched On

And Control 'Front Porch Switch' is not switched Off

 

Then

Disable Program 'Front Porch Sensor'

 

Else

Enable Program 'Front Porch Sensor'

 

The current ‘And Status’ in the second line prevents the Program from disabling the other Program when the switch is turned On manually. Likely the variation suggested by TJF1960 used And Status rather than And Control as that variation should have worked also.

 

Did not see the answer to TJF1960 question about the Motion Sensor being linked to the swtich. It should not be.

Posted

I had a chance to make the changes today and am still getting the same results. I have also verified that neither the switch or the sensor are linked to anything and even deleted them and added them fresh back onto the ISY. It seems that no matter what the state of the switch that the sensor control program runs and shuts off the light. I'm sorry to be so persistent but this situation seems like a very common one that a lot of people would encounter. I have the same need upstairs in the master bathroom when a sensor near the bed turns on a nightlight in the bathroom that I'd like to local switch to override to keep it on longer once you've made your way to the room.

 

I have listed the code I'm currently using in case I mistyped anything. I would love to get this sorted out as it will be a program I intend on using in at least 4 other rooms in the house. Any help you folks can provide would be amazing.

 

Just to be clear, this is the current behavior:

 

- If the switch is off and the sensor is triggered, the light will turn on for 5 seconds and off again. (Good)

 

- If the switch is turned on the light stays on indefinitely. (Good)

 

- If the light is turned on with the switch and the sensor is then triggered, the light turns off after 5 seconds. (Bad)

 

- If the sensor has triggered the light and the switch is turned on, the light still turns off in 5 seconds (Bad)

 

The two programs I have controlling the circuit are below:

 

Front Porch Switch

 

If

Control 'Front Porch Switch' is switched On

And Control 'Front Porch Switch' is not switched Off

 

Then

Enable Program 'Front Porch Sensor'

 

Else

Disable Program 'Front Porch Sensor'

 

 

Front Porch Sensor

 

If

Control 'M4 - Front Porch Sensor' is switched On

And Program 'Front Porch Switch' is False

 

Then

Set 'Front Porch Switch' On

Wait 5 seconds

Set 'Front Porch Switch' Off

 

Else

- No Actions - (To add one, press 'Action')

Posted

Does manually switching the front porch switch on then off update the status in the admin console of the ISY correctly? Does the first program turn true and false with manually operating the switch? Is the second program being enabled and disabled?

 

Also the first program, I think the enable and disable lines are reversed. They were correct a few posts up but got reversed in the last post.

Posted

I'm man enough to admit when I'm a total idiot (and lazy as well). While you were responding I just figured out how to use the admin console to monitor the enabled/disabled status of the running programs and realized that the sensor program was never disabled no matter what state the switch was in. The reason for this is that instead of getting up from my desk to "manually" turn the switch on and off, I was doing it through the console remotely - never realizing that physically touching the switch was different. Once I trotted over to the switch and pushed it manually, the sensor program enabled and disabled as expected.

 

So thanks to all of you for the amazing help and speedy replies on this one. Things are working perfectly now and I'd thought I'd post the final two programs below for anyone else that stumbles across this post looking for the same answer. This system is very cool and I can't wait to see what other trouble I can get into with it :)

 

Rick

 

Front Porch Switch

 

If

Control 'Front Porch Switch' is switched On

And Control 'Front Porch Switch' is not switched Off

 

Then

Disable Program 'Front Porch Sensor'

 

Else

Enable Program 'Front Porch Sensor'

 

 

Front Porch Sensor

 

If

Control 'M4 - Front Porch Sensor' is switched On

 

Then

Set 'Front Porch Switch' On

Wait 3 seconds

Set 'Front Porch Switch' Off

 

Else

- No Actions - (To add one, press 'Action')

Posted

Great solution!

 

I do have a question though, why do you check that a switch is on as well as that it's not off? Seems redundant to me, but I've seen this a number of times on examples people post on the forum.

 

Am I missing something here?

 

Thanks!

Posted

dimensionzero

 

If Control looks at the commands coming from the device. With If Control the command from the device must match the command specified in the If Control statement for the Program to trigger.

 

If Control 'xxxxxx' is switched On is looking for the On command and if found triggers the Program. The Then clause runs because it 'is switched On' is True

 

If Control 'xxxxxx' is not switched Off is looking for the Off command and if found triggers the Program. The Else clause runs because 'is not switched Off' is False because of the 'not'.

Posted

Lee,

 

One question that has puzzled me for a while.

 

If

Control 'Front Porch Switch' is switched On

And Control 'Front Porch Switch' is not switched Off

 

From your explanation of the above and my understanding of And / Or statements these two can never be true at the same time therefore would always be false triggering the Else. It is obviously not the case or this program would not function.

 

Why is it not written as an 'Or' instead of 'And' condition? In my mind this would result in; 'Control is switched On' would run the 'Then' clause, and 'Control is not switched Off' would run the 'Else' clause.

 

~Mike

Posted

Either And or Or works. This is one of those 'what I think' answers rather than 'what I know'.

 

Because If Control is looking at a specific command flow the condition being checked can only exist for the split second the ISY is analyzing the inbound command from the device. It makes And a useless construct where If Control And If Control are involved as that could never be True. I think based on that the And is actually treated as an Or when If Control is combined with If Control. What I think rather than what I know.

 

It certainly looks more logically correct to code it as

 

If Control 'xxxxx' is switched On

Or Control 'xxxxx' is switched Fast On

 

but tests show either And or Or produce the same result.

Posted

Wow, I have not used that condition yet in a program but knowing that an 'Or' will function as expected (and is functionally the same when written with an 'And') is good to know. Thank you!

~Mike

Posted
From your explanation of the above and my understanding of And / Or statements these two can never be true at the same time therefore would always be false triggering the Else.

 

Normally, I would agree. Perhaps a better way of putting it is that both conditions could never be TRIGGERED at the same time. Your second condition (not off), however, is always true by default at any point that the program is triggered, except that split second point in time upon receipt of an OFF command. So, if an ON command is recieved, BOTH conditions are true, because it DID recieve an ON command, and because it simultaneously DID NOT recieved an OFF.

 

It is starting to sound a lot like a double-negative. My head hurts.

Posted

oberkc

 

An If Control 'xxxxx' is not switched Off by itself does not trigger a Program when a On command is received. Independent of the not, If Control must match the command received, Off in the example, for the Program to be triggered. Easy enough to verify. Code up a test Program that contains an

 

If Control 'xxxxx' is not switched Off

 

as the only thing in the If section. Tap the On paddle. The Program does not trigger, True or False as the command received does not match that specified in the If Control. The only thing that triggers the test Program is an Off command and it always drives the Else because the 'not' results in False.

Guest
This topic is now closed to further replies.

×
×
  • Create New...