jca001 Posted November 19, 2009 Posted November 19, 2009 I have a couple of question about the Send Notification command. I have several programs that receive X10 codes from Motion Sensors and then turns on a light and then send a notification. The same X10 codes starts another program that waits minutes and turns the light off and sends a notification. 1) Is the time stamp in the email when the event occurred or when the Send Notification was executed? 2) Does the program wait for the Send Notification to complete before doing the next command? 3) What happens if multiple events cause Send Notification to be executed at the same time? I just updated to 2.7.7 from 2.7.6, but the reason for the questions are based on before and after.
Michel Kohanim Posted November 19, 2009 Posted November 19, 2009 Hello, Please see my comments below: 1) Is the time stamp in the email when the event occurred or when the Send Notification was executed? Based on the time the event occurred + a delta for the time it took construct a notification object (in milliseconds) 2) Does the program wait for the Send Notification to complete before doing the next command? No. The notification object is queued up and sent by another thread. 3) What happens if multiple events cause Send Notification to be executed at the same time? I do not think this could happen because events are queued and thus are evaluated sequentially.
jca001 Posted November 19, 2009 Author Posted November 19, 2009 1) Is the time stamp in the email when the event occurred or when the Send Notification was executed? Based on the time the event occurred + a delta for the time it took construct a notification object (in milliseconds) 2) Does the program wait for the Send Notification to complete before doing the next command? No. The notification object is queued up and sent by another thread. 3) What happens if multiple events cause Send Notification to be executed at the same time? I do not think this could happen because events are queued and thus are evaluated sequentially. Question to answers: 1) If the program does a wait for some number of minutes is the time stamp in the email still based on the event time? See other information below. 2) None 3.1) Does this mean the multiple Send Notifications will try to connect to the email server at the same time? 3.2) If the answer to 3.1 is yes, then what happens if the email server only allows one connection at a time from an email client? ******************************************* Below is 2 pair of programs that process X10 Motion Sensor events, the emails from the Send Notification and the ISY log file for them. FPM Motion On: If Folder 'Front Porch Motion' is True And Program 'FPM Motion Status' is True And X10 'C5/On (3)' is Received Then Set Scene 'ApplianceLinc 1' On Wait 5 seconds Send Notification to All Wait 15 seconds Run Program 'FPM Motion Status' (Else Path) Else - No Actions - (To add one, press 'Action') ################################################## FPM Motion Timer: If Folder 'Front Porch Motion' is True And X10 'C5/On (3)' is Received Then Wait 5 minutes Set Scene 'ApplianceLinc 1' Off Wait 2 seconds Send Notification to All Wait 15 seconds Run Program 'FPM Motion Status' (Then Path) Else - No Actions - (To add one, press 'Action') ################################################## Email 1: FPM Motion On X10 C5/On (3) received at 11/19/2009 09:57:55. ---------------------------------------- At: 11/19/2009 09:57:55 Program: FPM Motion On Value: C5/On (3) ################################################## Email 2: FPM Motion Timer X10 C5/On (3) received at 11/19/2009 10:03:00. ---------------------------------------- At: 11/19/2009 10:03:00 Program: FPM Motion Timer Value: C5/On (3) ################################################## ISY Log during above time: X10 C5 Thu 11/19/2009 10:02:33 AM System Log X10 C5 On (3) Thu 11/19/2009 10:02:34 AM System Log Scene:Scenes / ApplianceLinc 1 On 255 Thu 11/19/2009 10:02:34 AM Program Log ApplianceLinc 1 Status 100% Thu 11/19/2009 10:02:34 AM System Log Scene:Scenes / ApplianceLinc 1 Off 0 Thu 11/19/2009 10:07:34 AM Program Log ApplianceLinc 1 Status 0% Thu 11/19/2009 10:07:34 AM System Log #################################################### NOTE: Both programs start at the same time, the first one turns on the light and sends a notification. The second one waits for 5 minutes and then sends a notification. The emails show the elapsed time between them is 5 minutes, which is correct. But the time stamp in the emails are different than the log file by several minutes. ======================================================================== FPT Motion On: If Folder 'Front Porch Test' is True And Program 'FPT Motion Status' is True And X10 'C7/On (3)' is Received Then Set Scene 'LampLinc Test' On Wait 30 seconds Send Notification to All Wait 15 seconds Run Program 'FPT Motion Status' (Else Path) Else - No Actions - (To add one, press 'Action') ################################################### FPT Motion Timer If Folder 'Front Porch Test' is True And X10 'C7/On (3)' is Received Then Wait 2 minutes Set Scene 'LampLinc Test' Off Wait 2 seconds Send Notification to All Wait 15 seconds Run Program 'FPT Motion Status' (Then Path) Else - No Actions - (To add one, press 'Action') #################################################### Email 3: FPT Motion On X10 C7/On (3) received at 11/19/2009 09:47:54. ---------------------------------------- At: 11/19/2009 09:47:54 Program: FPT Motion On Value: C7/On (3) #################################################### Email 4: FPT Motion Timer X10 C7/On (3) received at 11/19/2009 09:47:54. ---------------------------------------- At: 11/19/2009 09:47:54 Program: FPT Motion Timer Value: C7/On (3) ############################################## ISY Log during above time: X10 C7 Thu 11/19/2009 09:49:43 AM System Log X10 C7 On (3) Thu 11/19/2009 09:49:44 AM System Log Scene:Scenes / LampLinc Test On 255 Thu 11/19/2009 09:49:44 AM Program Log LampLinc Test Status 100% Thu 11/19/2009 09:49:44 AM System Log Scene:Scenes / LampLinc Test Off 0 Thu 11/19/2009 09:51:44 AM Program Log LampLinc Test Status 0% Thu 11/19/2009 09:51:44 AM System Log ############################################################################ NOTE: Both programs start at the same time, the first one turns on the light and sends a notification. The 15 second wait before sending the notification is because both Motion Sensors could happen at almost the same time and I thought this may have something to do with why ISY had problems connecting to the email server. This is why I asked the questions in the first post. The second one waits for 2 minutes and then sends a notification. The emails show the time stamps as the same unlike emails 1 and 2. Again the time stamp in the emails are different than the log file by several minutes. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Other Information: Both pairs of programs are in different folders that do not have any conditions, but I have them testing to make sure the folder is true so later I can add a condition to the folder. The status programs for each pair are located in another folder called Status and both are NOT enabled and have no code. Questions: 1) So why do the 2 programs work differently as far as the time stamp in the email? 2) Why is the time stamp of the emails different by several minutes than the time stamp in the Log when the event happened? I thought this may have been corrected in 2.7.7.
Michel Kohanim Posted November 20, 2009 Posted November 20, 2009 Hi again and apologies for a tardy reply. I am so very sorry for the confusion and I take full blame for it. 1. Notification timestamp is the time when the Notification Object is created (not the event). So, if you have a wait, then the timestamp is when Notify All is called 2. Notification task is sequential: it does not send multiple emails at the same time. It sends one at a time 3. The log shows the event time. Event is when the status for a device IS CHANGED or the control for a device is ACTIVATED Hope this clears up your questions. With kind regards, Michel
jca001 Posted November 21, 2009 Author Posted November 21, 2009 Hi again and apologies for a tardy reply. I am so very sorry for the confusion and I take full blame for it. 1. Notification timestamp is the time when the Notification Object is created (not the event). So, if you have a wait, then the timestamp is when Notify All is called 2. Notification task is sequential: it does not send multiple emails at the same time. It sends one at a time 3. The log shows the event time. Event is when the status for a device IS CHANGED or the control for a device is ACTIVATED Hope this clears up your questions. With kind regards, Michel 1) I agree, because that is basically what I have seen other than the fact it is 2 minutes different that the event log that shows an on or off command seconds before the notification command not matter of the wait before the on or off command. 2) So if multiple events happen pretty much at the same time (give or take a second) that start programs that have no waits and has notifications in them, ISY will attempt to connect to the email server, deliver one email, disconnect and attempt to connect to the email server again to deliver the next email for each notification? 3) I agree, but that does not explain my examples as to why the time stamp in the email is 2 plus minutes different than the event log. In one program I wait 5 minutes then turn off a light (the event log shows when that happened) 5 minutes after the event that started the program. I wait only 2 seconds and then send a notification, but the time stamp in the email is 2 minutes different. Why? You really did not answer my last question 1 at the end of my last post.
Michel Kohanim Posted November 22, 2009 Posted November 22, 2009 Hello, I thought I answered your questions in the post prior to your most recent question. Here we go again: 1. Notifications are sent one at a time. Yes, this means that each notification will contact the server to be sent. Nothing is batched. 2. The timestamp in the event log could be quite different than the timestamp for the notification. The reason is quite simple: When events happen, they are logged. This does NOT mean that they are evaluated at the same time by the Programming task. Depending on the number of events to be processed, priority of other tasks to perform, and overall system utilization, there might be some lag. Furthermore, the timestamp for the notification is the timestamp when the notification object was created If you are looking for a precise correlation between the event time and notification timestamp, it would be quite impossible with the current design especially since a program may contain many conditions ( ANDed or ORed). With kind regards, Michel
bfish Posted February 1, 2012 Posted February 1, 2012 Hi there, I am a newB coming to ISY99i from 25 years of X-10 use. So far in my first week I'm thrilled with the capability and reliability! In my learning, one of the first things I wanted to do was send an email alert to myself whenever my alarm system was armed (or disarmed). The alarm system sends X-10 commands when this happens. My log viewer shows that this happened: INSTEON Device Control Value Time User Log Type X10 I All Lights On (5) Tue 2012/01/31 06:42:21 PM System Log X10 I All Lights On (5) Tue 2012/01/31 06:42:21 PM System Log X10 I All Lights On (5) Tue 2012/01/31 06:42:19 PM System Log X10 I All Lights On (5) Tue 2012/01/31 06:42:18 PM System Log But, I only wanted 1 email alert, not the 4 I actually received. Here is my ISY programming which I thougth would avert the redudant emails with the "Wait" but it has not. If X10 'I/All Lights On (5)' is Received Then Send Notification to 'Default' conent 'Alarm turned on' Wait 10 seconds Else - No Actions - (To Add one, press 'Action') Any suggestions as to what I should be doing would be greatly appreciated! Thank you, BFish
oberkc Posted February 1, 2012 Posted February 1, 2012 My gut reaction is to swap the order of the "wait" and "Send" commands.
LeeG Posted February 1, 2012 Posted February 1, 2012 bfish Run Event Viewer with 3-Device communications events selected. The alarm may be sending multiple X10 messages for reliability. Lee
bfish Posted February 1, 2012 Posted February 1, 2012 Lee, I ran the event viewer as you described, and in fact only got 1 alert, despite several signals being sent When I returned home and disarmed the system, I got no alerts, although previously I did. So I gather the event viewer is somehow "trapping" the alerts. Do I have that right? Also, is there anything I can do without the Event Viewer running 7x24 to program around the multiple alerts. Thank you very much for your insights thus far and anything you can add! Bfish
LeeG Posted February 1, 2012 Posted February 1, 2012 The Event Viewer is not changing the flow of messages. From the previous post there were multiple X10 message events ... X10 I All Lights On (5) Tue 2012/01/31 06:42:21 PM System Log X10 I All Lights On (5) Tue 2012/01/31 06:42:21 PM System Log X10 I All Lights On (5) Tue 2012/01/31 06:42:19 PM System Log X10 I All Lights On (5) Tue 2012/01/31 06:42:18 PM System Log Note the differences in the timestamps of the X10 events. The previous suggestion about moving the Wait before the Notify will likely resolve the multiple Notify Actions. The Program is being triggered from each X10 message but would not be sending the Notify immediately because of the Wait. Only the last X10 message will result in the Notify. There is still the open question as to why the alarm panel is sending multiple All Lights On messages. Question for the alarm panel company. I suspect that is normal because of the inherent unreliability of X10. They want to be sure the lights turn On so multiple On requests are sent.
Recommended Posts