Jump to content

HansSolo

Members
  • Posts

    8
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

HansSolo's Achievements

Newbie

Newbie (1/6)

0

Reputation

  1. Hi everyone, I've just came up with a solution to my problem. There are other ways to do it but i've just wanted to share my solution. I've tested the solution with alternating changes in the trigger signal and it works great. System that monitors an electronic circuit and sends a notification when it changes state.The problems is that sometimes changes are too rapid and too many in a short term but usually the system changes state few times a day. The rapids changes are probably due to switches bouncing or undesirable states. Program that checks the reception of an On/OFF X10 command and send a Notification of the new status after sending the notification, a debounce window prevents further notification but the current status is still updated After the debounce timer the current status, if changed will trigger another Notification with its debounce period Programs 1 &2 keep the current status in a state variable $s_HQ_Cur_Status State variable $s_HQ_Debounce_TmrON is a flag that when 1 prevents the THEN clause of program#3 to run. It is set to 1 by program#3 indicating that a notification was sent and reset to 0 when timer $s_HQ_Timer reaches 0 Program#3 compares current signal status $s_HQ_Cur_Status with its previous status $i_HQ_Prev_status. This previous status is updated only when a notification sequence is executed. Adjust Wait period (Program#4) and $s_HQ_Timer (Program#3) to get the desired debounce period (here the debounce period is 15sec.) ------------------------------------------------------ Program#1: Detect_sig HQ_OFF is received If X10 'K2/Off (11)' is Received Then $s_HQ_Cur_Status = 0 $s_HQ_Cur_Status Init To 0 Else - No Actions - (To add one, press 'Action') Every time an X10 command OFF is received update Current status s_HQ_Cur_status is State variable in order to trigger program "Test if HQ status changed ------------------------------------------------------ Program#2: Detect_sig HQ_ON is received If X10 'K2/On (3)' is Received Then $s_HQ_Cur_Status = 1 $s_HQ_Cur_Status Init To 1 Else - No Actions - (To add one, press 'Action') Every time an X10 command ON is received update Current status ------------------------------------------------------ Program#3: Test if HQ status changed If $s_HQ_Debounce_TmrON is 0 And $i_HQ_Prev_status is not $s_HQ_Cur_Status Then Run Program 'xmit HQ status' (If) Disable Program 'HQ_Timer_pgm' $s_HQ_Timer = 15 $i_HQ_Prev_status = $s_HQ_Cur_Status Enable Program 'HQ_Timer_pgm' $s_HQ_Debounce_TmrON = 1 Else - No Actions - (To add one, press 'Action') Test if HQ status changed while debouncetimer OFF Only when debounce timer is OFF AND HQ status as changed from its previous status A notification is sent And Debounce timer is started and the timer value initialized ------------------------------------------------------ Program#4: HQ_Timer_pgm If $s_HQ_Timer is not 0 Then Wait 1 second $s_HQ_Timer -= 1 Else $s_HQ_Debounce_TmrON = 0 ------------------------------------------------------ Program#5: xmit HQ status If $i_HQ_Prev_status is 1 Then Run Program 'Mac_X10_HOT' (Then Path) Send Notification to 'SMS xyz' content 'system Hot' Else Run Program 'Mac_X10_HOT' (Else Path) Send Notification to ' SMS xyz' content 'system Cold' Always disabled, Run by tst Every comments/suggestions would be appreciated thanks
  2. Thanks LeeG I had completely forgot about what triggers a program compared to what the test portion is. I'll modify the program to remove the ELSE clause and have a separate program for the On or OFF conditions For my second question, it would be nice if UD implement some sort of a Global "print out" of all the programs. I don't always have access to my ISY and I'm the kind of person that likes to have a hard copy to work on. Copy to clipboard of all the programs is very long. Thanks
  3. Hi, I have a system that I monitor thru an X10 module(PSC01) that sends an X10 On or Off command depending on the system' s status. For every X10 command received I send a notification to my phone. But because debouncing problems I get too many messages in 1 minute. I should have notification, lets say 1 in the morning and another one in the evening. So I tried this: Variable s_HQ_ON_OFF that changes every time an X10 command is received ( state variable). I want to be able to catch all X20 commands in case the system goes from ON to OFF then back ON during the " debouncing period" . ( if debounce is 5 minutes, signal goes from ON to Off>> generates a notification but gets back ON during the 5 minutes period, I want a second notification only after the 5 min. period) Variable i_Debounce (integer) used to prevents program#3 of triggering while WAIT x minutes is in effect Program#1:_______________________________ If X10 'K2/Off (11)' is Received Then $s_HQ_ON_OFF = 0 $s_HQ_ON_OFF Init To 0 Else - No Actions - (To add one, press 'Action') Program#2:_______________________________ If X10 'K2/On (3)' is Received Then $s_HQ_ON_OFF = 1 $s_HQ_ON_OFF Init To 1 Else - No Actions - (To add one, press 'Action') Program#3:_______________________________ If $s_HQ_ON_OFF is 1 And $i_Debounce is 0 Then $i_Debounce = 1 >> prevents the program to execute from here Run Program 'Mac_X10_Hot (Else Path) >>> (send another X10 signal) Send Notification to 'Jacques SMS Bell' content 'Mess1' Wait 5 minute $i_Debounce = 0 << ...to here Else $i_Debounce = 1 Run Program 'Mac_X10_Cold ' (Then Path) >>> send another X10 signal Send Notification to 'Jacques SMS Bell' content 'Mess2' Wait 5 minute $i_Debounce = 0 Problem: If X10 K2/ON is received followed by a few second later by an X10 K2/OFF the program #3 sends 2 notifications back to back without the 5 minutes delay. I thought that by setting i_Debounce=1 after detecting that (s_HQ_ON_OFF changes AND i_debounce=0) it would prevent the program to run again. What am I missing? I also tried to disabled Program#3 within itself in order for the wait to complete but I get the same results Program#3 modified: If $s_HQ_ON_OFF is 1 Then Disable Program 'tst var_HQ_ON_OFF' Run Program 'Mac_X10_Eau Chaude' (Else Path) Send Notification to 'Jacques SMS Bell' content 'Bi_Energie Cold' Wait 1 minute Enable Program 'tst var_HQ_ON_OFF' Else Disable Program 'tst var_HQ_ON_OFF' Run Program 'Mac_X10_Hot (Else Path) >>> send another X10 signal Send Notification to 'Jacques SMS Bell' content 'Mess1' Wait 5 minute Enable Program 'tst var_HQ_ON_OFF' I don' t understand why I get the else condition 1 second later and the wait period have no effect Can somebody help me understand? Question on another subject: is there a way to have a printout of all the programs ( with folder) without having to copy them individually on the clipboard? Thanks
×
×
  • Create New...