Announcement

Collapse
No announcement yet.

Arduino Script Testing. (Enigmatheatre)

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

    Originally posted by enigmatheatre View Post
    This is something I have on my list of things to do.
    I want to make it possible to send the data for all boards to one port so you can use one wireless gateway for all boards.

    Greig.
    Greig, Have you thought about this any more? I am looking to make up some wireless points around the house. Right now I am locked into version 2 and I dont expect to upgrade to version 3 anytime soon. I was planning to use ESP-01's for the coms on this. Thanks

    Dave

    Comment


      Originally posted by gdyrdave View Post
      Greig, Have you thought about this any more? I am looking to make up some wireless points around the house. Right now I am locked into version 2 and I dont expect to upgrade to version 3 anytime soon. I was planning to use ESP-01's for the coms on this. Thanks

      Dave
      I can say I have thought about it but just not had the time to put it in place.
      When you say you are locked in to version 2 are you talking about HS as I now only support my HS3 plugin and not my HS2 script.

      Greig.

      Sent from my HTC One using Tapatalk
      Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
      X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
      Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
      Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
      Scripts =
      Various

      Comment


        Originally posted by enigmatheatre View Post
        I can say I have thought about it but just not had the time to put it in place.
        When you say you are locked in to version 2 are you talking about HS as I now only support my HS3 plugin and not my HS2 script.

        Greig.

        Sent from my HTC One using Tapatalk
        Would you be willing to release the source for the HS2 script for those of us that use that version and use HS2 ? So we can make changes to it. Just asking.
        Dave

        Comment


          Hope I'm not too off topic here...

          I'm attempting to control a PWM output device with &hs.SetDeviceValueByRef.

          When I execute the command:
          &hs.SetDeviceValueByRef(37, 80, True)

          The slider in the device status screen changes to 80%, but the actual PWM output doesn't change. Of course, if I slide it with the mouse, it does change the output.

          Is there a better way to achieve this?

          Comment


            Originally posted by dhalsall View Post
            Hope I'm not too off topic here...

            I'm attempting to control a PWM output device with &hs.SetDeviceValueByRef.

            When I execute the command:
            &hs.SetDeviceValueByRef(37, 80, True)

            The slider in the device status screen changes to 80%, but the actual PWM output doesn't change. Of course, if I slide it with the mouse, it does change the output.

            Is there a better way to achieve this?
            You need to use CAPI to control it.

            I use this function and pass the param of the value you need.

            PHP Code:
            Function CallCAPI(ByVal intDevRef As IntegerByVal strDevCmd As String) As CAPIControlResponse
                hs
            .writelog("CallCAPI""Device Reference: " intDevRef " strDevCmd: " strDevCmd)
                
            CallCAPI CAPIControlResponse.Indeterminate
                
            For Each objCAPIControl As CAPIControl In hs.CAPIGetControl(intDevRef)
                    If 
            LCase(objCAPIControl.Label) = LCase(strDevCmdThen
                        CallCAPI 
            hs.CAPIControlHandler(objCAPIControl)
                        Exit For
                    
            End If
                
            Next
            End 
            Function 
            Greig.
            Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
            X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
            Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
            Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
            Scripts =
            Various

            Comment


              Thanks Greig,

              I have to admit, my coding abilities are Kindergarten level at best.

              My head is about to explode trying to understand your code

              I was hoping to achieve the functionality in a single line of code. Reading other posts, I was thinking something like this might work (but of course it doesn't - and I'm just not smart enough yet to know why):

              &hs.CAPIControlHandler(&hs.CAPIGetSingleControl(37, false, "ON", false, true))

              I keep referencing the HomeSeer Scriping guide, but the lack of syntax / examples make my brain pain worse.

              Ultimately, this is a linux box and I'm not sure if it's an issue of C# vs vb.s that adding to my challenge. I did try the same line with &shs. .... ; but just different errors - lol.

              anyway, I don't expect you to waste your time teaching me - but if you have a cheat for doing this in one line, that would be wonderful!

              Comment


                Originally posted by dhalsall View Post
                Thanks Greig,

                I have to admit, my coding abilities are Kindergarten level at best.

                My head is about to explode trying to understand your code

                I was hoping to achieve the functionality in a single line of code. Reading other posts, I was thinking something like this might work (but of course it doesn't - and I'm just not smart enough yet to know why):

                &hs.CAPIControlHandler(&hs.CAPIGetSingleControl(37, false, "ON", false, true))

                I keep referencing the HomeSeer Scriping guide, but the lack of syntax / examples make my brain pain worse.

                Ultimately, this is a linux box and I'm not sure if it's an issue of C# vs vb.s that adding to my challenge. I did try the same line with &shs. .... ; but just different errors - lol.

                anyway, I don't expect you to waste your time teaching me - but if you have a cheat for doing this in one line, that would be wonderful!

                Ok if you are just looking to control a device but with CAPI add the following to a text file and call it CallCAPI.vb and add it to your scripts folder.

                PHP Code:
                Sub Main(ByVal params As String)

                        
                Dim SplitParam() As String Split(params",")
                        
                CallCAPI(SplitParam(0), SplitParam(1))

                    
                End Sub

                    
                Function CallCAPI(ByVal intDevRef As IntegerByVal strDevCmd As String) As CAPIControlResponse
                        hs
                .WriteLog("CallCAPI""Device Reference: " intDevRef " strDevCmd: " strDevCmd)
                        
                CallCAPI CAPIControlResponse.Indeterminate
                        
                For Each objCAPIControl As CAPIControl In hs.CAPIGetControl(intDevRef)
                            If 
                LCase(objCAPIControl.Label) = LCase(strDevCmdThen
                                CallCAPI 
                hs.CAPIControlHandler(objCAPIControl)
                                Exit For
                            
                End If
                        
                Next
                    End 
                Function 
                Now on the event call the script with the paramiters of the device reference and the text value you require.
                So for example the params would be 1234,Dim 40% to set the device 1234 to CAPI value Dim 40%

                Try and see how you get on.
                Ps this is untested code but if there are problems give me a shout.

                Greig.
                Last edited by enigmatheatre; July 3, 2016, 01:10 PM.
                Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                Scripts =
                Various

                Comment


                  OK I tested it and had forgotten you can not pass multiple params from and event so it is fixed in the last post.

                  See picture for setup.
                  Attached Files
                  Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                  X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                  Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                  Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                  Scripts =
                  Various

                  Comment


                    OK I just thought that I guess you are not using events for this as you would just use the device in the event.

                    in your script you are using just add the function at the bottom of your script after all your code.

                    PHP Code:
                        Function CallCAPI(ByVal intDevRef As IntegerByVal strDevCmd As String) As CAPIControlResponse
                            hs
                    .WriteLog("CallCAPI""Device Reference: " intDevRef " strDevCmd: " strDevCmd)
                            
                    CallCAPI CAPIControlResponse.Indeterminate
                            
                    For Each objCAPIControl As CAPIControl In hs.CAPIGetControl(intDevRef)
                                If 
                    LCase(objCAPIControl.Label) = LCase(strDevCmdThen
                                    CallCAPI 
                    hs.CAPIControlHandler(objCAPIControl)
                                    Exit For
                                
                    End If
                            
                    Next
                        End 
                    Function 
                    Then in your script call the function using the line CallCAPI(1234, "Dim 40%")

                    Greig.
                    Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                    X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                    Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                    Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                    Scripts =
                    Various

                    Comment


                      Hi Greig,

                      Thanks for all the effort! I was out this afternoon, but just got in and had a few minutes to try.

                      I was intending on running it in an event, so I did create your example (cut and paste) - just changing the Device ID (37) and Dim value (70%).

                      When the event runs, I get this in the log, however, no change to the actual output, nor any change in the Device Management view:

                      Jul-03 5:26:04 PM CallCAPI Device Reference: 37 strDevCmd: Dim 70%
                      Jul-03 5:26:04 PM Event Running script in background: /home/pi/HomeSeer/scripts/CallCAPI.vb
                      Jul-03 5:26:04 PM Event Event Trigger "Environmental Monitoring one-wire thermo test"
                      I realize you literally have given me the answer - but I guess I'm more stupid than I had thought - lol.

                      Comment


                        Originally posted by dhalsall View Post
                        Hi Greig,

                        Thanks for all the effort! I was out this afternoon, but just got in and had a few minutes to try.

                        I was intending on running it in an event, so I did create your example (cut and paste) - just changing the Device ID (37) and Dim value (70%).

                        When the event runs, I get this in the log, however, no change to the actual output, nor any change in the Device Management view:



                        I realize you literally have given me the answer - but I guess I'm more stupid than I had thought - lol.
                        Ok that is strange

                        Can you show me a screen shot of the device advanced tab.

                        If you are using events then why not just set the device using control a device?

                        Greig.
                        Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                        X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                        Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                        Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                        Scripts =
                        Various

                        Comment


                          Hi Greig,

                          Had to run to make dinner for the fam... See screen cap below.

                          Regarding event aspect... probably better done as a complete script, but ultimately I'm looking to execute an event if a temperature is between X and Y, and if so, then use some simple arithmetic to take the temperature reading and create a percentage to output on this PWM line (which will spin up a fan to some range from slow to full).

                          I realize I'll have to get better at my scripting abilities to get to that final destination. This effort was my attempt at hoping to understand how to control via script - and then I'd work backward to add in the other logic.
                          Attached Files

                          Comment


                            Originally posted by dhalsall View Post
                            Hi Greig,

                            Had to run to make dinner for the fam... See screen cap below.

                            Regarding event aspect... probably better done as a complete script, but ultimately I'm looking to execute an event if a temperature is between X and Y, and if so, then use some simple arithmetic to take the temperature reading and create a percentage to output on this PWM line (which will spin up a fan to some range from slow to full).

                            I realize I'll have to get better at my scripting abilities to get to that final destination. This effort was my attempt at hoping to understand how to control via script - and then I'd work backward to add in the other logic.
                            Ok the event looks good.

                            Can you show me a screen shot of the device advanced tab of device 37.

                            Greig.
                            Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                            X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                            Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                            Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                            Scripts =
                            Various

                            Comment


                              certainly...
                              Attached Files

                              Comment


                                Originally posted by dhalsall View Post
                                certainly...
                                That also looks OK. Can you show me the graphics tab to.
                                This is strange.

                                Greig.

                                Sent from my SM-G925F using Tapatalk
                                Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                                X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                                Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                                Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                                Scripts =
                                Various

                                Comment

                                Working...
                                X