Jump to content

Need Help Writing A Query Program


upstatemike

Recommended Posts

Posted

I need some help writing a query program to keep the device status of my system up to date. What I want to do is write a program that does a query on all devices in my system, similiar to the 3AM event, except I want it to pause for a few seconds after each query to allow for regular traffic from programs and cotrollers. I also want it to start over as soon as it finishes so every device is rechecked every few minutes. Any thoughts on the best way to approach this?

Posted

Hello Upstate,

 

I use the following to periodically poll my outdoor lights during the day. To do what you have described, you could query individual devices (with delays between) or scenes (again with delays between).

 

Setting the "Last Run Time" will determine how often the program executes. Note that the "Last Run Time" is when the program STARTS execution. If you have a long query sequence (minutes) you'll need to be careful not to set the iteration time too short - I'm not sure what would occur (multiple instances or program re-starts and misses statements at the end).

 

If
       From    Sunrise +  1 minute
       To      Sunset  - 10 minutes (same day)
   And Time is Last Run Time for 'Outside Daytime Poll' + 30 minutes

Then
       Set Scene 'SC Outside Sunset' Query

Else
  - No Actions - (To add one, press 'Action')

Posted

Sorry UpState,

 

Just saw that you wanted you program to re-start immediately. I think that will require two programs. You'll also want to play with the wait times - this can put a pretty heavy load on your system.

 

Query Timer

If
       From    Sunrise
       To      Sunset  (same day)
   And Program 'Query Program' is False

Then
       Run Program 'Query Program' (Then Path)

Else
  - No Actions - (To add one, press 'Action')

 

 

Query Program

If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

Then
       Set Scene 'SC Outside Off' Query
       Wait  5 seconds
       Set Scene 'SC BSMT Game' Query
       Wait  5 seconds
       Run Program 'Query Program' (Else Path)

Else
  - No Actions - (To add one, press 'Action')

Posted

Thanks for the examples. It takes about 15 minutes for the "all devices" query to run at 3AM so I will have to make some guesses about the timing for doing each scene separately with a pause in between.

 

I don't really care about the system load. I would be happy to completely give up ISY's ability to control stuff in trade for truly accurate status.

Posted

I hear you Upstate! I can't get my devices to provide an accurate status to the ISY in real-time either. If I flip the switch on a ToggleLinc, the ISY doesn't pick up on it til the next query. Wreaks havoc on my IF statements and makes it completely impossible to use something like a ToggleLinc as a trigger for a program. They tell me it's supposed to report its status back to the ISY immediately, but I can't get it to do that. They tell me it's a defective PLM, but I'm not sure. I may swap it at some point and see.

 

Best of luck to you!

Posted

Hello wpmjones,

 

All controller type devices, if linked properly to ISY, SHOULD report their status when you turn them on/off.

 

Did you always have this problem or is it something new? Do you have this problem with ALL your controller devices or only the ToggleLinc? Have you tried Restore on that device?

 

With kind regards,

Michel

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

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