Announcement

Collapse
No announcement yet.

Control device with value of 256 steps

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

    Control device with value of 256 steps

    I've created a 'Test Device' for this example with the following settings:



    I'm using the following code:

    Code:
     Sub Main(params As Object)
     dim i as integer = 0
     for i = 1 to 255
      hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRefByName("TestDevice"),false,i,false,true))
      next
     End Sub
    I'd expected the 'TestDevice' would get a value of 0,1,2,3... to 255 but something strange happened; the value wasn't be increased by 1, but by 4.



    Am I doing something wrong, or is this a problem in HS3?

    Thanks in advance.

    Jaco

    #2
    Hi Jaco,

    Maybe try the following. The value should be sent as a string.

    Cheers
    Al

    Code:
    Sub Main(params As Object)
     dim i as integer = 0
     dim targetDev as Double = hs.GetDeviceRefByName("TestDevice")
     for i = 1 to 255
       hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev,false,CStr(i),false,true))
     next
    End Sub
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    Comment


      #3
      How do you know what values this is getting set to? Visually? It may be so fast that it looks like increments of 4.
      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

      Comment


        #4
        First of all thanx for your replies.

        @Sparkman; unfortunately your code doesn't make any difference.

        @Rupp; When I add a delay of 1 second in the code (hs.waitsecs(1)) the value is still increased by 4.

        After this I'd add a 'writelog' to the code:

        Code:
         Sub Main(params As Object)
         dim i as integer = 0
         for i = 1 to 255
          hs.waitsecs(1)
          hs.WriteLog ("LoopCount", i)
          hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRefByName("TestDevice"),false,i,false,true))
          next
        End Sub
        The problem seems to get more strange for me, please see the logfile:
        https://dl.dropboxusercontent.com/u/...58/Web/LOG.txt

        In the beginning the value jumps op-and-down. Further on the value does not increased every loop but only 1 time in 4 loops. This explains why the value is increased by 4, but I can't explain what's the problem.

        Comment


          #5
          Try changing the last "true" to a "false" to fix the problem with it jumping up and down. Also try putting a longer delay in.

          Cheers
          Al
          HS 4.2.8.0: 2134 Devices 1252 Events
          Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

          Comment


            #6
            This script works for me:

            Code:
             Sub Main(params As Object)
             dim i as integer = 0
             dim targetDev as Double = hs.GetDeviceRefByName("TestDevice")
             for i = 1 to 255
              hs.waitsecs(5)
              hs.WriteLog ("LoopCount", i)
              hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev,false,CStr(i),false,false))
             next
            End Sub
            Last edited by sparkman; December 15, 2014, 02:17 PM.
            HS 4.2.8.0: 2134 Devices 1252 Events
            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

            Comment


              #7
              This works as well (see log file attached):

              Code:
              Sub Main(params As Object)
               dim i as integer = 0
               dim targetDev as Double = hs.GetDeviceRefByName("TestDevice")
               for i = 1 to 255
                hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev,false,CStr(i),false,false))
               next
              End Sub
              Cheers
              Al
              Attached Files
              HS 4.2.8.0: 2134 Devices 1252 Events
              Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

              Comment


                #8
                Sparkman, thanx again for your reply.

                You're right for the up-and-down jumping of the value, this is solved. But the update of the value in 1 of 4 loops is still there in my case.

                https://dl.dropboxusercontent.com/u/...8/Web/LOG2.txt

                Is the value updated every loop on your system? (I can not open your attachment)

                Comment


                  #9
                  Originally posted by Jaco View Post
                  Is the value updated every loop on your system?
                  Hi Jaco, yes it is. Out of curiosity, what version of HS3 are you using? Here's a snippet from my log file:

                  Code:
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 14 (14) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 13 (13) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 12 (12) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 11 (11) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 10 (10) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 9 (9) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 8 (8) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 7 (7) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 6 (6) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 5 (5) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 4 (4) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 3 (3) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 2 (2) by/from: CAPI Control Handler
                  Dec-15 12:41:23 PM	 	Device Control	Device: House Status House Status TestDevice to 1 (1) by/from: CAPI Control Handler
                  Dec-15 12:41:21 PM	 	Event	Running script in background: C:/Program Files/HomeSeer HS3/scripts/capitest.vb
                  Cheers
                  Al
                  HS 4.2.8.0: 2134 Devices 1252 Events
                  Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                  Comment


                    #10
                    Hi Al,

                    I'm running "HS3 Pro Edition 3.0.0.96 (Windows)".

                    Can I ask what version you're running?

                    Jaco

                    Comment


                      #11
                      Hi Jaco,

                      I'm running .148. I would shutdown HS, make a backup and then upgrade to .149 (which is now the latest beta that's out) and see if that resolves it.

                      Cheers
                      Al
                      HS 4.2.8.0: 2134 Devices 1252 Events
                      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                      Comment


                        #12
                        Hee Al,

                        That did the trick...... I'd look to the latest version on the website, currently this is 3.0.0.96. I didn't look at the beta releases.

                        I'm very happy the problem is solved, thank you so much for your help and the time you spend to help me solving the problem.

                        Jaco

                        Comment


                          #13
                          Hallo Jaco,

                          You're welcome. Glad to hear that fixed it.

                          Cheers
                          Al
                          HS 4.2.8.0: 2134 Devices 1252 Events
                          Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                          Comment

                          Working...
                          X