Jump to content


Photo
- - - - -

trouble triggering a task based on an output being on/off


  • Please log in to reply
2 replies to this topic

#1 rexwilson

rexwilson

    Cocooner

  • Registered
  • PipPip
  • 61 posts

Posted 06 October 2019 - 10:00 AM

I want to be able to use one of my keypad function-keys to toggle a relay and various other things on and off.
Press it once and the stuff goes one, press it again later and the stuff goes off. Seemed pretty straight-forward.

I set up a task, and assigned that task to a function-key on the keypad.

Then I set up an output to keep track of the state.

Then I set up two rules...

 1.  Whenever task is activated

       And output is off

            then turn the stuff on, then "announce A"
             then turn output on

 

 2.  Whenever task is activated

        And output is on

             then turn the stuff off, "Announce B"
             then turn output off

 

When I press the button on the keypad, both rules fire, one after the other.

I hear the speaker say "A" then "B".

I suspect that the system is so fast that when rule 2 rolls around, it is still in a state of thinking that the task was just activated, and since at the end of rule 1 I turned on the output, this means that as soon as rule 2 fires up, it sees the output is on so proceeds to do its thing and turn everything off. This defeats the whole purpose of me having the two rules conditioned on the state of the output. I suppose I could rig up an elaborate delay counter in still another output to prevent rule 2 from firing right away, but that seems like an unfortunate bit of complexity to have to add.

Any other ideas???

 



#2 RAL

RAL

    Cocoonut

  • Registered
  • PipPipPipPip
  • 2029 posts
  • Location:Rhinebeck, NY
  • Experience:average
  • Hardware:Elk M1
  • Tech:X10-PLC
  • Phone:POTS

Posted 06 October 2019 - 11:47 AM

You could try another way of writing these rules as follows:
 
Whenever F1 key Activates
  Then toggle Output nnn
 
Whenever Output nnn is Turned On
  Then turn stuff on
  Then Announce A
 
Whenever Output nnn is Turned Off
  Then turn stuff off
  Then announce B

Edited by RAL, 06 October 2019 - 11:47 AM.


#3 rexwilson

rexwilson

    Cocooner

  • Registered
  • PipPip
  • 61 posts

Posted 06 October 2019 - 01:16 PM

RAL, that's a fantastic idea. Thank you very much.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users