Announcement

Collapse
No announcement yet.

Advice wanted: optimize script made to run nearly every second?

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

    Advice wanted: optimize script made to run nearly every second?

    I wrote a script to use virtual devices that represent multiple similar devices. I call these Composite Devices (script here).

    It runs nearly every second since its triggered by changes in most devices (motion, lighting, etc), thus needing to update a virtual devices each.

    Real device associations to virtual devices are dynamic, so it scans the entire HS3 database each time.

    Hoping someone can provide advice on how to optimize. I'm wondering if its putting stress/load on HS3 that could be lessened with some small tweaks?

    thx

    #2
    I've never been able to get consistently fast response from similar virtual presence logic. I think you need to reconsider your design and what you are trying to accomplish. For example, if light control is frustrating then consider a direct link from a motion sensor to lights and then allow logic based on presence to catch up.

    Another thing I've done, with little benefit, is to delay non-time critical triggers to allow the lighting trigger to fire first.

    Comment


      #3
      Originally posted by dmiller View Post
      I've never been able to get consistently fast response from similar virtual presence logic. I think you need to reconsider your design and what you are trying to accomplish. For example, if light control is frustrating then consider a direct link from a motion sensor to lights and then allow logic based on presence to catch up.

      Another thing I've done, with little benefit, is to delay non-time critical triggers to allow the lighting trigger to fire first.
      I'm not seeing issues/problems with response time. I thought better coders than I might have some tips to reduce load on HS3 since it runs so often. If that speeds up other things (which it might, not sure) then cool.

      As for a different method... I dont know of any other way to do what I'm doing with Composite Devices. EasyTrigger has Groups - which ALMOST does what I need. But, ET does not have a way to query the Group to get the current the current values and it doesnt create a virtual device for those groups. This makes it not work for some types of Events and for dashboards (status display). If it did these 2 things, I'd not need my script.

      Comment


        #4
        I don't see code in your link. Where is compositedevices.vb?

        Comment


          #5
          Originally posted by dmiller View Post
          I don't see code in your link. Where is compositedevices.vb?
          Link in first post

          Comment


            #6
            Originally posted by Ltek View Post

            Link in first post
            Click image for larger version

Name:	Screen Shot 2021-07-04 at 8.58.28 PM.png
Views:	92
Size:	178.2 KB
ID:	1482504

            Comment

            Working...
            X