Jump to content

Variable & Program help


Recommended Posts

I have a kitchen light (2466DW) and a sink light (2474DWH).  I want to switch the kitchen light on if I press The sink light on three times.  I made a variable $KLCount and the following programs:

Upcount (Works)

If 

Control 'SinkLight' is switched On

Then

$KLCount += 1

---------------------------------------------------------------------------------------------

CountReset (Works)

if

Control 'SinkLight' is switched off

or Control 'KitchenLight' is switched off

Then

$KLCount = 0

-------------------------------------------------------------------------------------------------

KLOn (Not Working)

If

$KLCount >= 3

Then

Set 'KitchenLight' on

Wait 2 seconds

$KLCount =0

------------------------------------------------------------------------------------------------------

So as I've indicated it seems everything is working except when it come to turning the kitchen light on (The counter will go over three and the light will not come on and counter will not reset unless I turn one of the switches off.

Any ideas as to why this won't work??  Thanks for any help you can provide

 

Link to comment
55 minutes ago, smacbride said:

Put the logic to turn on the light in your first program, something like this:

IF

   Control 'SinkLight' is switched on

and $KLCount >= 3

Then

  Set 'KitchenLight' on

  wait 2 seconds

  $klCount =0

else

 KLCount +=1

 

Yep That worked...will try messing with state variables at another time

Thanks again

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...