Jump to content

Motion triggered scene and timers (double off being sent ?)


jim_

Recommended Posts

I tried looking through the forum, but could not locate anyone posting this scenario / problem ...   

I have a number of motion or switch activated scenes running for years and while they work perfectly 99% of the time, you hit the scenario where the timer has JUST expired and a new trigger occurs (less than a second) ... lights go off, then on, then off

Example: basement stairs, motion triggers human, lights go on, human descends stairs, but does a turnaround trip ... the timer expires (light off sent) but within milliseconds of the off, human is detected, light goes back on for less than 1 second and then go off again ... stairs are dark

I use a variable to reset the timer if there is a lot of traffic in the stairwell, this seems to work well. I've looked through Log to see if double Off is sent, but only see 1. 

Its like the perfect software race condition where the command "off" is sending and motion is triggering "on" to restart the script

Anyone guide me on what I'm looking for ?

 

CODE

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

Basement Stairs Trigger

If
        'Basement Stairs Mo' is switched On
 
Then
        Set 'Basement Stair 3way' On
        $sBasement_Stairwell_Light_Timer  = 60

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

Stair Light Timer Decrement

If
        $sBasement_Stairwell_Light_Timer > 0
 
Then
        Wait  1 second
        $sBasement_Stairwell_Light_Timer -= 1
        Run Program 'Stair Light Timer Decrement' (If)
 
Else
        Set 'Basement Stairs 3 Way' Fast Off

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

Basement Stairs Light Stop

If
        'Basement Stair 3way' Status is Off
 
Then
        $sBasement_Stairwell_Light_Timer  = 0
        Set 'Basement Stairs 3 Way' Off
        Stop program 'Stair Light Timer Decrement'
------------------------------------------------------ 
 

Edited by jim_
Link to comment

Have you set your MS to send 'ON' only or does it send 'OFF' also. This could be creating a race condition.

BTW: You may be creating a problem with the line
Run Program 'Stair Light Timer Decrement' (If)
It shouldn't necessary. The timer changing will re-run the decrement program automatically. (providing ii is a STATE variable.)

Link to comment
3 hours ago, jim_ said:

Thanks larryllix for the reply 

I removed the "Run Program" line and you are correct, the decrement works  :-)

With respect to "MS to send 'ON' only", is this the option ?  (2844-222)

image.png.7bd62fa81afcc289ed6deca124d4071b.png

Yes. If you have created a scene between your MS and the device then it will send an Off as well as your program. Usually it doesn't hurt anything but in your case there may be some signal racing going on.

Edited by larryllix
Link to comment

Here is how I did this for my mudroom in an older installation.
I created a scene to directly, and instantly, turn ON (only) the lights from the MS.
The light switches (or Alexa vocal) can manually override the automatic off and yet still turn them off after a long period automatically. (people get used to automatic and don't use the switches).

Note: the timer here is retriggerable so constant motion in the mudroom wil extend the timer.

---------------------------------------------------------------
MudRm Lights.auto - [ID 0067][Parent 0017]

If
        'MudRoom / MudRm.MS' is switched On
    And 'MudRoom / MudRm.MS' is not switched Off

Then
        Wait  5 minutes
        Set 'MudRoom / MudRm Potlights' Off

Else
        Set 'MudRoom / MudRm Potlights' Off


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

MudRm Lights.manual - [ID 00D4][Parent 0017]

 // * * Enabled to Run at Startup, If will run False, resetting everything

If
        'MudRoom / MudRm Potlights' is switched On
    And 'MudRoom / MudRm Potlights' is not switched Off

Then
        Set 'MudRoom / MudRm Potlights' On
        Disable Program 'MudRm Lights.auto'
        Wait  2 hours <--- human forgets = turn them off
        Run Program 'MudRm Lights.manual' (Else Path)

Else
        Set 'MudRoom / MudRm Potlights' Off
        Enable Program 'MudRm Lights.auto'

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371k
×
×
  • Create New...