barrygordon Posted November 20, 2014 Posted November 20, 2014 I have a program that I use to turn off all the lights in my home. It has no If section, no else section, just a then section. The then section consists of a bunch of scenes, one for each room. This program is normally run when I leave the house or I go to "Bed" I normally run the program using Homeseer which has an excellent plugin for communicating with the ISY. A while ago this stopped working and I just started to look at it. I can force the program to run from a command in Homeseer which effectively runs its Then section using a rest interface addressing the program ID with a "runThen" as the command. When I do this I can see in the admi9n console that the program has run, but no lights turn off. I started playing around and noticed that in the program summary the line item for the inside lights program had the correct time of last action, the activity was idle and the status was false. I then ran the program from the console using the programs summary page. All the lights went out as they should and the status went from false to true and stayed that way. The Homeseer program now reliably turns off the lights by executing this program in the same manner as it did before. Ergo I have no real problem any longer, BUT I am curious. Is there a bug in the Homeseer program that the UDI program is not properly addressed? There are no errors or non error indications in the UDI logs. Does the program have to be in the "True" state for it to be able to be executed through REST? I would like to know the answer for future reference. TIA, Barry
LeeG Posted November 20, 2014 Posted November 20, 2014 It sounds like the REST command is running the If clause rather than the Then clause. A False Status will run the Else when the If empty.
LeeG Posted November 20, 2014 Posted November 20, 2014 (edited) Can insure Status is True by adding statement to If that will always be True. If $Sxxx is $Sxxx Then EDIT: ran some tests and confirmed the runThen does run the Then even if the current Status is False when the command is issued http://192.168.2.2/REST/programs/0026/runThen/ More convinced the REST command being issued has a problem of some sort causing the If clause to execute Edited November 21, 2014 by LeeG
larryllix Posted November 21, 2014 Posted November 21, 2014 Can insure Status is True by adding statement to If that will always be True. If $Sxxx is $Sxxx Then EDIT: ran some tests and confirmed the runThen does run the Then even if the current Status is False when the command is issued http://192.168.2.2/REST/programs/0026/runThen/ More convinced the REST command being issued has a problem of some sort causing the If clause to execute LeeG Myself and many others report that "then" code will execute when the "If" is called with no condition lines inside it. Are you saying the program can be left, or become, false without any "If" section code and stay that way to cause "Else" to execute each time the "if" section was called?
LeeG Posted November 21, 2014 Posted November 21, 2014 Yes. This statement "http://192.168.2.2/REST/programs/0026/" running this Program If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Send X10 'A1/On (3)' Else Send X10 'B1/On (3)' <programs> <program id="0026" parentId="0001" status="false" folder="false" enabled="false" runAtStartup="false" running="idle"> <name>Beep</name> <lastRunTime>2014/11/20 10:17:22 PM</lastRunTime> <lastFinishTime>2014/11/20 10:17:22 PM</lastFinishTime> </program> </programs> Adding runThen to "http://192.168.2.2/REST/programs/0026/runThen/" <RestResponse succeeded="true"> <status>200</status> </RestResponse> The event log, first with a False Status when first REST statement without runThen followed by the same Program with False Status with runThen Thu 11/20/2014 10:17:20 PM : [ Time] 22:17:22 2(0) Thu 11/20/2014 10:17:20 PM : [X10-RSP ] 02 63 E6 00 06 Thu 11/20/2014 10:17:20 PM : [ X10] B1 Thu 11/20/2014 10:17:20 PM : [ X10] B1/On (3) Thu 11/20/2014 10:17:21 PM : [X10-RSP ] 02 63 E2 80 06 Thu 11/20/2014 10:17:22 PM : [X10-RX ] 02 52 E6 00 Thu 11/20/2014 10:17:22 PM : [ X10] B1 Thu 11/20/2014 10:22:36 PM : [ Time] 22:22:38 2(0) Thu 11/20/2014 10:22:36 PM : [X10-RSP ] 02 63 66 00 06 Thu 11/20/2014 10:22:36 PM : [ X10] A1 Thu 11/20/2014 10:22:36 PM : [ X10] A1/On (3) Thu 11/20/2014 10:22:37 PM : [X10-RSP ] 02 63 62 80 06 Thu 11/20/2014 10:22:37 PM : [X10-RX ] 02 52 66 00 Thu 11/20/2014 10:22:37 PM : [ X10] A1
barrygordon Posted November 21, 2014 Author Posted November 21, 2014 Thanks for all the replies. What I have gathered from the replies is: A proper Rest command with a runThen command should always run the then clause independent of the status. Similarly for a runElse I suspect the plugin may be issuing an incorrect REST command and will discuss that with the plugin developer who supports his plugin in the same manner as the staff at UDI supports the ISY. The suggestion for an always true if clause is a good safety factor and I will do that as there is no else clause in the program (The If clause is currently empty) Once again, thanks for the help.
barrygordon Posted November 22, 2014 Author Posted November 22, 2014 To close out the thread: I was using the Homeseer plugin in an unintended manner. The plugin was sending to the program address a command to increment value by 0 which makes no sense for the program in ISY. It does make sense for other non ISY devices. It seems the ISY when given a program command it does not recognize will run the program based on its current state. If the state is true, it runs the Then section and if false the Else section. Once again thanks for the assistance.
larryllix Posted November 22, 2014 Posted November 22, 2014 If you have all Insteon devices you could create an ISY scene with all devices in it. HS could probably activate that scene directly.
barrygordon Posted November 23, 2014 Author Posted November 23, 2014 (edited) I resolved the issue completely by changing the command used in HS from HS.execX10OnByName("My Programs All Inside Lights off", "runThen") to HS.execX10OnByName("My Programs All Inside Lights off", "on") to run the Then section and HS.execX10OnByName("My Programs All Inside Lights off", "off") to run the Else section. The All Inside Lights Off program references a bunch of scenes, one for each room, to turn off the lights in that room. Works like a charm Edited November 23, 2014 by barrygordon
larryllix Posted November 23, 2014 Posted November 23, 2014 The All Inside Lights Off program references a bunch of scenes, one for each room, to turn off the lights in that room. Works like a charm Always good to hear!
Recommended Posts