Announcement

Collapse
No announcement yet.

best approach for a polling plug-in

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

    best approach for a polling plug-in

    I am looking for the best approach to run an inifinite loop within a plug-in to periodically check the status of a network device.

    the sample .net plug-in with the SDK uses a timer which i have gotten to work for checking my status.

    i tried just initating an infinite loop (with a waitsecs) in the InitIO function, but this just hung the plug-in and HS.

    any other approaches worth investigating
    Mark

    HS3 Pro 4.2.19.5
    Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
    Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
    Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

    #2
    You just have to launch a new thread from InitIO(), and do your loop inside the thread. You can use the Thread.Sleep() method to wait between polls.
    --
    stipus

    Comment


      #3
      What's wrong with the timer?
      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

      Comment


        #4
        just looking for alternatives

        Originally posted by Rupp
        What's wrong with the timer?
        probably nothing.

        but as you know, there is always more than one what to do something with these computers. just wanted to see my options.

        programmically, a thread might be a little cleaner as I can keep all my monitoring code together in the thread routines, whereas with the timer, the declarations have to in one place and the monitoring coded in the timer_elasped routine. just a guess at this point however.

        thanks for the feedback
        Mark

        HS3 Pro 4.2.19.5
        Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
        Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
        Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

        Comment


          #5
          Why reinvent the wheel, DooNetwork already does this. When you say poll a network device, I assume you are talking about computer equipment.
          Thanks,

          T.
          _________________________________
          Staying on the cutting edge is EXPENSIVE

          Comment


            #6
            i am thinking about building a plug-in that uses a different technology to monitor more than just online/offline status
            Mark

            HS3 Pro 4.2.19.5
            Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
            Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
            Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

            Comment


              #7
              preventing HS from polling a plugin device

              If I set the deviceclass .misc property with the MISC_STATUS_ONLY bit then the device is not polled; this is what i want.The downside is HS removes the stnd on/off buttons of the device.

              I don't really want to add custom on/off back to the device.

              how can i have on/off btns and prevent hs from polling the device?
              Mark

              HS3 Pro 4.2.19.5
              Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
              Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
              Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

              Comment

              Working...
              X