Announcement

Collapse
No announcement yet.

runThen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    runThen

    I was having a problem in running an ISY program with a runThen command. The ISY indicated that the program ran. I noticed that the status of the program in the summary page of the ISY was false. The program has no If section, no Else section, only a Then section.

    I forced the program to run by running it from the ISY. It ran fine. The status was then True. I tried running it from Homeseer again via the script I used (the script contains The following: hs.ExecX10ByName("My Programs Inside Lights Off", "runThen"). The script now ran the program as expected turning off all the lights.

    I was under the impression that runThen would always run the Then section of the script independent of its status (true or false). Could you please look into it as I cannot see exactly what the plugin is sending to the ISY for the above command. I am running plugin version 1.4.0.17 Gold.

    PS as a safety measure I added an if clause that is always true.

    #2
    Hi Barry,

    I'm very confused by this. I tried to duplicate your conditions. I created a new program that only has one command to turn on a light in the then section. No if condition and no else statements.

    I forced the program to run by running it from the ISY. It ran fine. The status was then True. I tried running it from Homeseer again via the script I used (the script contains The following: hs.ExecX10ByName("My Programs Inside Lights Off", "runThen"). The script now ran the program as expected turning off all the lights.
    Two things here confuse me.

    First, hs.ExecX10ByName() is for sending X10 commands to X10 devices. The ISY program is not an X10 device and does not accept any X10 commands. So this call should do nothing. When I tried it, HomeSeer never makes any requests to the plug-in.

    Second, given above, I really don't understand how running the script would have turned off all the lights as expected. Unless the script does something more?

    I was under the impression that runThen would always run the Then section of the script independent of its status (true or false).
    Yes, I also believe this is true and that's how it behaved in my testing. You can also test this by using the runthen button on device status page.

    To run programs via a script you need to call into a plug-in specific API function. Here's the script I used to test this:

    Code:
    Sub Main(parm as object)
    Dim isy_pi As Object = Nothing
    
    isy_pi = hs.Plugin("ISY Insteon")
    isy_pi.RunProgram("testProgram", "runThen")
    
    End Sub
    --
    Bob Paauwe
    ISYInsteon Plug-in
    http://www.bobsplace.com/ISYInsteon/

    Comment


      #3
      Interesting. The ISY program has in its 'Then' section the turning off of a bunch of scenes. Each scene handles one room in my house, turning off all the lights in that room.

      With your plugin every ISY device has an X10 address in homeseer. This also goes for programs and scenes. The script I posted absolutely works as long as the status of the program is true, or now with an IF clause that is always true I suspect it will work no matter what the status is.

      If I look at the device status page in Homeseer I see all of the ISY programs listed. There is current status of the Program in the ISY as well as three control buttons to execute the program (If, Then, Else). In fact all of the scenes in the ISY are also listed with an X10 address for each scene and a set of buttons for on, off, dim, brt, toggle

      I have attached a screen snapshot showing this for the programs.

      I guess you wrote a better plugin then you thought you did. I have been using the X10 command option in homeseer to make the ISY do all of the things I need relating to scenes, programs and devices. I thought that was the way I was supposed to.

      Comment


        #4
        file upload

        I just realized the file is too large do send as a bmp file. I zipped it up and have added it to this post as a zip archive.
        Attached Files

        Comment


          #5
          Originally posted by Barry Gordon View Post
          Interesting. The ISY program has in its 'Then' section the turning off of a bunch of scenes. Each scene handles one room in my house, turning off all the lights in that room.

          With your plugin every ISY device has an X10 address in homeseer. This also goes for programs and scenes. The script I posted absolutely works as long as the status of the program is true, or now with an IF clause that is always true I suspect it will work no matter what the status is.
          Yeah, I know that HS2 uses X10 type identifiers for every device. But it's just that, an identifier. For dimmer/relay/scene devices, the plug-in does respond to a subset of the X10 commands like on/off/value_set. But there isn't an X10 command called "runThen".

          After playing around a bit more, it looks like HomeSeer is sending an X10 value increment by '0' command for any string that it doesn't recognize. Thus the plug-in is getting a value set command with whatever the current value of the program is.

          So that explains why the program has to be in a true state first before this works. If the program is currently false, your command will end up simply running the else section.

          So this is really all just a happy coincidence and only works because some undefined behavior lines up right. There are no guarantees that this will continue to function this way.

          Now if you called Exec10ByName("device", "on") it would do the right thing and run the 'then' part of the program. If you call it with "off" it will run the 'else' part of the program. It won't matter what state the program is currently in.

          I guess you wrote a better plugin then you thought you did. I have been using the X10 command option in homeseer to make the ISY do all of the things I need relating to scenes, programs and devices. I thought that was the way I was supposed to.
          I expect the X10 commands to work, at least a subset of them. What I didn't expect to work was non-X10 commands. In my testing of this I replaced your "runThen" X10 command with "Junk" and it behaves the same way. It's what HomeSeer does with non-X10 commands that's interesting and unexpected in this case.
          --
          Bob Paauwe
          ISYInsteon Plug-in
          http://www.bobsplace.com/ISYInsteon/

          Comment


            #6
            I really Appreciate the support you supply to your plugin. Having written several plugins over my association with Homeseer (about 12+ years) I know what that entails. You answer all querries and do what ever research is necessary to obtain resolution. That is to be lauded.

            I will change my commands to use on or off, and that will be fine. If it ever stops working that way I will revert to the method you documented. I do not plan to upgrade HS, as I see no need for me to go to HS3. So unless a future version of the plugin changes things I should be fine.

            To close out the issue, if I use the x1o command with a command of "if" which will cause it to do the value increment by 0 as you state, will it then run the if section of the program? Just curious.

            Thanks again.

            Comment

            Working...
            X