Announcement

Collapse
No announcement yet.

VR Syntax Guide Discussion

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

    VR Syntax Guide Discussion

    Originally posted by spud View Post
    Here is a guide for the syntax of the voice recognition feature of the kinect plugin

    Optional words or phrases:
    words or phrases enclosed in brackets, i.e [ and ], are optional. For example the phrase diagram "Turn [the] light on" indicates that both "Turn light on" and "Turn the light on" will be recognized.

    Multiple choices:
    Multiple choices of required words or phrases are shown enclosed in < and > symbols. For example the phrase diagram "Turn the light <on|off>" indicates that both "Turn the light on" and "Turn the light off" will be recognized.

    In case of multiple choices you often need to know which choice has been spoken to trigger an action accordingly. That's why when a phrase diagram that includes one or more multiple choices, is recognized, the plugin set some global variables (kinectvar0, kinectvar1, ...., kinectvar9) to what has been actually spoken. To retrieve the value of these variables from a script use
    Code:
    hs.GetVar("kinectvar0")
    ...
    hs.GetVar("kinectvar9")
    you can set multiple choices within an optional phrase or word, but you can't have an optional word or phrase as a choice:
    dim the lights to <thirty [percent]|fifty [percent]|seventy [percent]> //WRONG
    dim the lights to <thirty|fifty|seventy> [percent] //OK
    turn the lights on [in <one|two|three> minutes] //OK

    you can't have nested multiple choices
    <turn <on|off> the lights | <shut|open> the lights> //WRONG
    <turn on| turn off| shut | open> the lights //OK
    Spud can you give an example of how to set this up in an event. for instance if I want to dim the 50%,30% ect do I need mulitple events to do this or canI do it with in one event

    Cheers ken
    HSPRO,HS3PRO, BLsecurity, , MCSxap, HSTouch Android, UltraGCIR, CM15a, USBUIRT, BLUSBUIRT, WIFIRGB, BLAB8SS, BLcontrol, BLGData, BLLAN,BLOccupied, BLRadar, BLVolume, iTunesDAAP, UltraGCIR3, Airplayspeak, BLalarm, BLbackup, BLLED, BLrandom, BLReminders, BLRF, BL Speech, Hyperion, IFTTT, KINECT, XBMC, MCSprinkers PRO, PHLocation, ULtrapioneer, Ultralog, ultraweatherbug, Z,troller, GC-100, GC WIFICC, GC-WIFI SERIAL, Nitrogen logic depth camera controllers,

    #2
    Originally posted by kenrad View Post
    Spud can you give an example of how to set this up in an event. for instance if I want to dim the 50%,30% ect do I need mulitple events to do this or canI do it with in one event

    Cheers ken
    you can do this using one event but you need a script.
    here is the event:
    Click image for larger version

Name:	kinectcs.jpg
Views:	1
Size:	27.2 KB
ID:	1173890

    and here is the content of the kinect.cs file (C# script)

    Code:
    public object Main(object[] Parms)
    {
        string var0 = (string)hs.GetVar("kinectvar0");
        int dvRef = hs.GetDeviceRefByName("mylight");
        
        int value = 100;
        if(var0 == "ten")
            value = 10;
        else if(var0 == "fifty")
            value = 50;
        else if(var0 == "seventy")
            value = 70;
            
        HomeSeerAPI.CAPI.CAPIControl control = hs.CAPIGetSingleControlByUse(dvRef, ePairControlUse._Dim);
        control.ControlValue = value;
        hs.CAPIControlHandler(control);
        
        return 0;
    }

    Comment


      #3
      Spud,

      Forgive me if this is a stupid question but I dont do scripting much. In your script I would just need to replace that with my device name (highlighted red) and then adjust the percentages as I want them correct?



      public object Main(object[] Parms)
      {
      string var0 = (string)hs.GetVar("kinectvar0");
      int dvRef = hs.GetDeviceRefByName("mylight");

      int value = 100;
      if(var0 == "ten")
      value = 10;
      else if(var0 == "fifty")
      value = 50;
      else if(var0 == "seventy")
      value = 70;

      HomeSeerAPI.CAPI.CAPIControl control = hs.CAPIGetSingleControlByUse(dvRef, ePairControlUse._Dim);
      control.ControlValue = value;
      hs.CAPIControlHandler(control);

      return 0;
      }d just need to repalce the
      HSPRO,HS3PRO, BLsecurity, , MCSxap, HSTouch Android, UltraGCIR, CM15a, USBUIRT, BLUSBUIRT, WIFIRGB, BLAB8SS, BLcontrol, BLGData, BLLAN,BLOccupied, BLRadar, BLVolume, iTunesDAAP, UltraGCIR3, Airplayspeak, BLalarm, BLbackup, BLLED, BLrandom, BLReminders, BLRF, BL Speech, Hyperion, IFTTT, KINECT, XBMC, MCSprinkers PRO, PHLocation, ULtrapioneer, Ultralog, ultraweatherbug, Z,troller, GC-100, GC WIFICC, GC-WIFI SERIAL, Nitrogen logic depth camera controllers,

      Comment


        #4
        Spud this is the script that I am using and something is not working correctly. when I sat the command it is recognized but the light always is at the same level. can you help me figure out what I am doing wrong.

        public object Main(object[] Parms)
        {
        string var0 = (string)hs.GetVar("kinectvar0");
        int dvRef = hs.GetDeviceRefByName("foyer fan linc - Light");

        int value = 100;
        if(var0 == "ten")
        value = 10;
        else if(var0 == "fifty")
        value = 50;
        else if(var0 == "seventy")
        value = 70;

        HomeSeerAPI.CAPI.CAPIControl control = hs.CAPIGetSingleControlByUse(dvRef, ePairControlUse._Dim);
        control.ControlValue = value;
        hs.CAPIControlHandler(control);

        return 0;
        }

        Cheers Ken
        HSPRO,HS3PRO, BLsecurity, , MCSxap, HSTouch Android, UltraGCIR, CM15a, USBUIRT, BLUSBUIRT, WIFIRGB, BLAB8SS, BLcontrol, BLGData, BLLAN,BLOccupied, BLRadar, BLVolume, iTunesDAAP, UltraGCIR3, Airplayspeak, BLalarm, BLbackup, BLLED, BLrandom, BLReminders, BLRF, BL Speech, Hyperion, IFTTT, KINECT, XBMC, MCSprinkers PRO, PHLocation, ULtrapioneer, Ultralog, ultraweatherbug, Z,troller, GC-100, GC WIFICC, GC-WIFI SERIAL, Nitrogen logic depth camera controllers,

        Comment


          #5
          please post your logs

          what kind of light is it? I tested with a Z-Wave but CAPIGetSingleControlByUse may not work with other plugins, you may have to use some other CAPI calls.

          Comment


            #6
            Spud

            Getting back to this I am using insteon devices. Controlled with marks plug in. Your script works for zwave but not insteon

            Cheers Ken

            Sent from my EVO using Tapatalk
            HSPRO,HS3PRO, BLsecurity, , MCSxap, HSTouch Android, UltraGCIR, CM15a, USBUIRT, BLUSBUIRT, WIFIRGB, BLAB8SS, BLcontrol, BLGData, BLLAN,BLOccupied, BLRadar, BLVolume, iTunesDAAP, UltraGCIR3, Airplayspeak, BLalarm, BLbackup, BLLED, BLrandom, BLReminders, BLRF, BL Speech, Hyperion, IFTTT, KINECT, XBMC, MCSprinkers PRO, PHLocation, ULtrapioneer, Ultralog, ultraweatherbug, Z,troller, GC-100, GC WIFICC, GC-WIFI SERIAL, Nitrogen logic depth camera controllers,

            Comment


              #7
              Ask Mark to implement the CAPI controlByUse stuff

              Comment


                #8
                For some reason this script only turns the lights on to 100%:

                Code:
                public object Main(object[] Parms)
                {
                    string var0 = (string)hs.GetVar("kinectvar0");
                    int dvRef = hs.GetDeviceRefByName("livingroom Light");
                    
                    int value = 100;
                    if(var0 == "five")
                        value = 5;
                    else if(var0 == "ten")
                        value = 10;
                    else if(var0 == "fifteen")
                        value = 15;
                    else if(var0 == "twenty")
                        value = 20;
                    else if(var0 == "twentyfive")
                        value = 25;
                    else if(var0 == "thirty")
                        value = 30;
                    else if(var0 == "thirtyfive")
                        value = 35;
                    else if(var0 == "fourty")
                        value = 40;
                    else if(var0 == "fourtyfive")
                        value = 45;
                    else if(var0 == "fifty")
                        value = 50;
                    else if(var0 == "fiftyfive")
                        value = 55;
                    else if(var0 == "sixty")
                        value = 60;
                    else if(var0 == "sixtyfive")
                        value = 65;
                    else if(var0 == "seventy")
                        value = 70;
                    else if(var0 == "seventyfive")
                        value = 75;
                    else if(var0 == "eighty")
                        value = 80;
                    else if(var0 == "eightyfive")
                        value = 85;
                    else if(var0 == "ninety")
                        value = 80;
                    else if(var0 == "ninetyfive")
                        value = 95;
                    else if(var0 == "one hundred")
                        value = 100;
                        
                    HomeSeerAPI.CAPI.CAPIControl control = hs.CAPIGetSingleControlByUse(dvRef, ePairControlUse._Dim);
                    control.ControlValue = value;
                    hs.CAPIControlHandler(control);
                    
                    return 0;
                }
                Here's the phrase:

                Code:
                dim the lights to <five|ten|fifteen|twenty|twentyfive|thirty|thirtyfive|fourty|fourtyfive|fifty|fiftyfive|sixty|sixtyfive|seventy|seventyfive|eighty|eightyfive|ninety| ninetyfive|one hundred> [percent]
                Any idea what's going wrong here?
                Originally posted by rprade
                There is no rhyme or reason to the anarchy a defective Z-Wave device can cause

                Comment


                  #9
                  check the value of kinectvar0 from Tools > Global Variables, Timers & Counters

                  Comment


                    #10
                    Originally posted by spud View Post
                    check the value of kinectvar0 from Tools > Global Variables, Timers & Counters

                    Ahhhhhh! That was it. It's a remote instance so it needed to be kinectlivingroomvar0 not kinectvar0 in the script. It's all working now. Thanks.
                    Originally posted by rprade
                    There is no rhyme or reason to the anarchy a defective Z-Wave device can cause

                    Comment


                      #11
                      Hi spud,

                      If I create an event with a Kinect voice tigger can the above syntax apply to the phrase ?

                      i.e stop [scrolling]

                      Comment


                        #12
                        Originally posted by S.Morris View Post
                        Hi spud,

                        If I create an event with a Kinect voice tigger can the above syntax apply to the phrase ?

                        i.e stop [scrolling]
                        Yes you can use this syntax in both kinect voice commands attached to event triggers or attached to device controls

                        Comment


                          #13
                          Voice syntax question

                          Spud,

                          I've been reading some of the posts, and I can't figure out if it is possible to do phrase variants. For example, I ran into this last night. I couldn't remember what I had programed, so:

                          I said: "Turn the Office Lights On"
                          I had programmed: "Turn On the Office Lights"

                          Is there a way to program that variant? Maybe:
                          <turn on [the] office [lights] | turn [the] office [lights] on>

                          ... or alternate suggestions?

                          Thanks!

                          hjk
                          ---

                          Comment


                            #14
                            Originally posted by hjk View Post
                            <turn on [the] office [lights] | turn [the] office [lights] on>
                            this won't work as you can't have optional words [] within a choice <>. So in this particular case I would use two triggers instead of using the choice syntax:

                            IF "turn on [the] office [lights]"
                            OR IF "turn [the] office [lights] on"

                            I just realized that you can't do that if you are using device commands, so I may have to add support for optional words within choices.

                            Comment


                              #15
                              Originally posted by spud View Post
                              I just realized that you can't do that if you are using device commands, so I may have to add support for optional words within choices.

                              Yes! Please do!
                              Originally posted by rprade
                              There is no rhyme or reason to the anarchy a defective Z-Wave device can cause

                              Comment

                              Working...
                              X