Announcement

Collapse
No announcement yet.

Polling All Devices

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

  • Polling All Devices

    I have been looking all morning here on the Forum but couldn't find what I needed.

    Is there a way to poll all devices on startup? if so will battery devices be polled?

    The reason for this is when HS3 is down for any reason and a device changes state and when HS3 restarts the status icon for that device is wrong. Once the device is used then it's back in sync with HS3. Example: hall light is off then HS3 goes down. Someone turns on the hall light using the switch. HS3 restarts but shows the light is still off. Once someone uses the light switch again then it's in sync.

    Thanks
    Jim

  • #2
    I use a script that will go through all devices and initiate a poll if it is a Z-Wave device.
    Code:
    sub Main(ByVal Parm As Object)
    
        Try
            'run through the enumerator, remove the location two strings
            Dim PollResult As New HomeSeerAPI.IPlugInAPI.PollResultInfo 
            Dim dv As Scheduler.Classes.DeviceClass
            Dim EN As Scheduler.Classes.clsDeviceEnumeration
            Dim dvRef
            EN = hs.GetDeviceEnumerator
    
            Do
                dv = EN.GetNext
                If dv Is Nothing Then Continue Do
                   System.Threading.Thread.Sleep(50)
                   If dv.Interface(Nothing).ToLower = "z-wave" Then
                   dvRef = hs.GetDeviceRefByName(dv.Name(Nothing))             
                   PollResult = hs.PluginFunction("Z-Wave", "", "PollDevice", {dvRef})  
                   hs.writelog("Polling", "Device: " & dv.Name(Nothing) & " (" & dv.Ref(nothing) & ")") 
                End If
    
            Loop Until EN.Finished
    
        Catch ex As Exception : hs.writelog("Device Clear", "Exception: " & ex.message)
        End Try
    
    End Sub
    It will create a log entry for each device it polls. I run it delayed for a couple of minutes after startup so the system has a chance to settle a bit before polling. I don't know if it will queue battery devices for polling, but it should the next time they wake up.

    Randy Prade
    Aurora, CO
    Prades.net

    PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

    Comment


    • #3
      I have never done a script before, where do I put this code? Can I put the above script in an event then call the event on startup?

      Thanks
      Jim
      Last edited by jbfoster; September 3rd, 2018, 03:37 PM.

      Comment


      • #4
        First you highlight and copy the text from the above code

        Click image for larger version

Name:	Capture5.PNG
Views:	66
Size:	34.6 KB
ID:	1245358

        Paste it into Notepad

        Click image for larger version

Name:	Capture.PNG
Views:	65
Size:	31.6 KB
ID:	1245353

        Click on File>Save As...

        Click image for larger version

Name:	Capture1.PNG
Views:	66
Size:	61.4 KB
ID:	1245354

        Make sure and Safe as type: All Files so you can save it with a .vb extension - this is required for scripts. Give it a name, here I chose pollZwave.vb. The script needs to be in HomeSeer HS3/scripts. Either save it there or save it locally and copy it there.

        Then create an Event to run it. Here I made one that is Manually triggered. Then the Action is Run a Script or Script Command. Then click on "Edit" and select the script you just saved.


        Click image for larger version

Name:	Capture2.PNG
Views:	69
Size:	86.5 KB
ID:	1245355

        Click "Submit"

        Click image for larger version

Name:	Capture3.PNG
Views:	74
Size:	61.9 KB
ID:	1245356

        Then collapse the Action and you have an Event.

        Click image for larger version

Name:	Capture4.PNG
Views:	66
Size:	22.7 KB
ID:	1245357

        This Event can be run manually or from another Event. If you want to launch it with a delay of 2 minutes, add this line in your startup script at the bottom just before "End Sub"

        hs.DelayTrigger (120, "Poll all Z-Wave")

        This line will run the Event 2 minutes after HS is started.
        Randy Prade
        Aurora, CO
        Prades.net

        PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

        Comment


        • #5
          Ok I think it is working. Now I need a way to start the event from startup. I have seen this but not sure where to put in the startup.vb.

          hs.TriggerEvent ("Startup")

          Comment


          • #6
            Originally posted by jbfoster View Post
            Ok I think it is working. Now I need a way to start the event from startup. I have seen this but not sure where to put in the startup.vb.

            hs.TriggerEvent ("Startup")
            I wrote in the above post
            Originally posted by rprade
            This Event can be run manually or from another Event. If you want to launch it with a delay of 2 minutes, add this line in your startup script at the bottom just before "End Sub"

            hs.DelayTrigger (120, "Poll all Z-Wave")

            This line will run the Event 2 minutes after HS is started.
            hs.TriggerEvent will run it immediately and it is likely the Z-Wave controller will not be fully initialized at startup.

            Randy Prade
            Aurora, CO
            Prades.net

            PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

            Comment


            • #7
              Just noticed something. Not sure when it started but my GE hall light switch has an issue. If I use the switch to turn on the hall light the light does come on but the status icon in HS and imperihome does not change. If I turn on the light using my echo both imperihome and HS icon updates. If use HS or Imperihome the icon updates. Any idea why the icon does not update when using the switch?

              Comment


              • #8
                Originally posted by rprade View Post
                I wrote in the above post

                hs.TriggerEvent will run it immediately and it is likely the Z-Wave controller will not be fully initialized at startup.
                If I do it this way, won't I have to start the event manually? I want the event to start automatically when Homeseer starts.

                Jim

                Comment


                • #9
                  Nevermind... I am a dumbnass. I read your post and now see it.

                  Comment


                  • #10
                    Originally posted by jbfoster View Post
                    Just noticed something. Not sure when it started but my GE hall light switch has an issue. If I use the switch to turn on the hall light the light does come on but the status icon in HS and imperihome does not change. If I turn on the light using my echo both imperihome and HS icon updates. If use HS or Imperihome the icon updates. Any idea why the icon does not update when using the switch?
                    I just checked all my devices but battery devices are doing this. Could the script have done something? If so how do I fix it?

                    Thanks
                    Jim

                    Comment


                    • #11
                      Originally posted by jbfoster View Post
                      Just noticed something. Not sure when it started but my GE hall light switch has an issue. If I use the switch to turn on the hall light the light does come on but the status icon in HS and imperihome does not change. If I turn on the light using my echo both imperihome and HS icon updates. If use HS or Imperihome the icon updates. Any idea why the icon does not update when using the switch?
                      It is likely a switch that does not support instant status like a Linear, GE, Jasco, etc. A GE or Jasco will support "pseudo instant status" but only if it has a direct path to the controller. Z-Wave plus switches and dimmers (like HomeSeer) support instant status. What kind of switch is it?

                      Randy Prade
                      Aurora, CO
                      Prades.net

                      PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

                      Comment


                      • #12
                        Originally posted by jbfoster View Post

                        I just checked all my devices but battery devices are doing this. Could the script have done something? If so how do I fix it?

                        Thanks
                        Jim
                        It is possible that the queue is full after all the polling, especially if you have a lot of devices and/or a slower controller. Polling creates a lot of traffic. Give it about 15 minutes and see if they are working again.

                        Randy Prade
                        Aurora, CO
                        Prades.net

                        PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

                        Comment


                        • #13
                          Originally posted by rprade View Post
                          It is possible that the queue is full after all the polling, especially if you have a lot of devices and/or a slower controller. Polling creates a lot of traffic. Give it about 15 minutes and see if they are working again.
                          Waited 30 minutes. still the same thing. I deleted the event and restarted the PC. Still the same thing.

                          Comment


                          • #14
                            Originally posted by jbfoster View Post

                            Waited 30 minutes. still the same thing. I deleted the event and restarted the PC. Still the same thing.
                            I don't know what is happening. The polling through the script is the same as polling through the Device Manager, from an Event or by scheduled polling. None of those would have anything to do with devices reporting. Is there a chance polling is disabled in the Z-Wave configuration?

                            Click image for larger version  Name:	Capture.PNG Views:	1 Size:	28.2 KB ID:	1245403

                            I have run that script dozens of times over the last several months without a problem.
                            Randy Prade
                            Aurora, CO
                            Prades.net

                            PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

                            Comment


                            • #15
                              Originally posted by rprade View Post
                              I don't know what is happening. The polling through the script is the same as polling through the Device Manager, from an Event or by scheduled polling. None of those would have anything to do with devices reporting. Is there a chance polling is disabled in the Z-Wave configuration?

                              Click image for larger version Name:	Capture.PNG Views:	1 Size:	28.2 KB ID:	1245403

                              I have run that script dozens of times over the last several months without a problem.
                              Yes there is a check mark in Enable Polling

                              Comment

                              Working...
                              X