Announcement

Collapse
No announcement yet.

Jon00 Homeseer/Echo Skill Helper for Homeseer 3 & Homeseer 4

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

    Just open up checkcmd.vb or checkcmd2.vb (whichever you are using) and add 'Exit sub' under the Sub Main line.

    If you want to control this via a virtual device change the 'Exit Sub' to:

    If hs.DeviceValueEx(1234) <> 100 Then Exit Sub

    (where 1234 is the device reference of your virtual device). This assumes 100 is on and anything else is off.
    Jon

    Comment


      Trigger Strategy Help Needed.

      Hi,
      I have a large home which (simplified) has 7 bedrooms, each with an echo.
      Each room has a "fan", "main lights", "bedside lights" and a TV.
      The devices are named coherently. i.e. Bedroom 1 Fan, Bedroom 1 Bedside Lights, Bedroom 1 Main Lights, Bedroom 1 TV.

      Using the crazy good helper I can successfully filter by Echo Device.
      But I am struggling with how to approach settings up Triggers.
      At the extreme, setting up one OFF trigger for each device in each room and then an ON trigger, and then, potentially a DIM trigger = 3 states * 4 devices * 7 rooms = 84 Triggers!
      At the other extreme, creating one trigger per location would be great (7 triggers) -- but what's the right play to process the trigger!

      Bit stumped.

      Comment


        I cannot see another way of doing this. Something has to turn on/off/dim each device (X7).
        Jon

        Comment


          OK - so here's what I've come up with:

          I have named the DeviceID in the ini file as BEDROOM1, BEDROOM2 for each respective echo.

          I am building a trigger for each device type:
          1. Fan Trigger
          2. Bedside Lights Trigger
          3. Main Lights Trigger
          4. TV Trigger

          - The AlexaText I hunt for in each Trigger, is the device name (Fan, Bedside Lights etc...)
          - The Alexa Response is [scriptfunc]

          I then run a script (as a function): i.e. $alexaRoomDeviceParser.vb and pass it parameters. in the case of the fan trigger, I would pass it:
          Code:
          fan;~;*;#
          This passes in:
          "fan" as fixed string (because I know its a fan as its the Fan Trigger),
          "~" gets replaced by the DeviceID of the echo that created the trigger (i.e. BEDROOM1)
          "*"gets replaced by the Alexa voice text string, such as "turn on the fan".
          "#" is for the cases where i need the number to be passed (dim the lights to 50%, would pass 50).

          So, if I say, "Alexa, tell Homeseer to turn on the fan" in BEDROOM1, this causes the parameters fan;BEDROOM1,turn on the fan,-99,999,999 to be passed to the script.

          In the script, I:
          1. Combine the friendly DeviceID with the devicename to get "BEDROOM 1 fan".
          2. Get the devref of this device with hs.GetDeviceRefByName("BEDROOM 1 fan")
          3. I then parse the voice text string ("turn on the fan") to look for " on" or " off" [note the space] and then use CAPIControl to act accordingly.
          4. Finally I create an Alexa response string, "OK, I am turning on the fan" and return this in the function.
          I also created a customskill per the UK instructions so that I could use my own invocation name. "Alexa, tell Fred to turn on the Fan".

          So far, it's working!

          s.




          Comment


            Ok, I didn't suggest scripting as that puts some people off!

            Did you create the UK skill recently? Others have had trouble since Amazon changed the dev setup.
            Jon

            Comment


              I'm also curious on how the custom skill was created.
              HS3PRO 3.0.0.500 as a Fire Daemon service, Windows 2016 Server Std Intel Core i5 PC HTPC Slim SFF 4GB, 120GB SSD drive, WLG800, RFXCom, TI103,NetCam, UltraNetcam3, BLBackup, CurrentCost 3P Rain8Net, MCsSprinker, HSTouch, Ademco Security plugin/AD2USB, JowiHue, various Oregon Scientific temp/humidity sensors, Z-Net, Zsmoke, Aeron Labs micro switches, Amazon Echo Dots, WS+, WD+ ... on and on.

              Comment


                Created the custom skill yesterday (I'm in the US, just don't want to say "homeseer").
                Here's the json:

                Code:
                {
                    "interactionModel": {
                        "languageModel": {
                            "invocationName": "fred",
                            "intents": [
                                {
                                    "name": "ParseText",
                                    "slots": [
                                        {
                                            "name": "TextToParse",
                                            "type": "HOMESEER_PHRASE"
                                        }
                                    ],
                                    "samples": [
                                        "{TextToParse}"
                                    ]
                                },
                                {
                                    "name": "AMAZON.NavigateHomeIntent",
                                    "samples": []
                                }
                            ],
                            "types": [
                                {
                                    "name": "HOMESEER_PHRASE",
                                    "values": [
                                        {
                                            "name": {
                                                "value": "turn on"
                                            }
                                        },
                                        {
                                            "name": {
                                                "value": "turn off the bedroom light"
                                            }
                                        },
                                        {
                                            "name": {
                                                "value": "run the bedtime event"
                                            }
                                        }
                                    ]
                                }
                            ]
                        }
                    }
                }
                Here's the endpoint:


                Click image for larger version

Name:	endpoint.PNG
Views:	218
Size:	159.3 KB
ID:	1290909

                Here's the account linking:


                Click image for larger version

Name:	acct link.PNG
Views:	206
Size:	342.5 KB
ID:	1290910
                and finally, the permissions (probably not required):


                Click image for larger version

Name:	perms.PNG
Views:	200
Size:	25.3 KB
ID:	1290911
                Hope it helps.

                Comment


                  One thing I am having trouble with is a Trigger (non scripting) not being fired when it should. I must be missing a basic setting.
                  When I say "Turn off the balcony lights" or "Turn the balcony lights off", from the Kitchen Alexa (or using the simulate window) this trigger doesn't fire.
                  I am probably missing something basic. Any ideas?


                  Click image for larger version

Name:	Trigger.JPG
Views:	214
Size:	85.3 KB
ID:	1290914

                  Comment


                    Assuming logging is still enabled, have you checked the HS Log to see what the script is seeing?
                    Jon

                    Comment


                      Originally posted by jon00 View Post
                      Assuming logging is still enabled, have you checked the HS Log to see what the script is seeing?
                      Yep, see below. Actually the mystery deepens.
                      I have two triggers (#1 and #2). One turns the balcony lights on (#1). One turns them off (#2).
                      If I remove the ignoreText, "Turn the balcony lights off" wrongly triggers "Turn them on" #1...and thus never gets to #2. I can't see why that could be.
                      If I insert the ignoreText as in the example above, neither trigger gets fired.
                      Stumped.


                      Code:
                       
                      Mar-08 11:51:43 AM Jon00_Alexa Successful trigger under [Trigger1]
                      Mar-08 11:51:43 AM Jon00_Alexa Response sent to Alexa: 'Turning On Bedroom Three and Four Balcony Lights'
                      Mar-08 11:51:43 AM Jon00_Alexa Script processing time: 514 ms
                      Mar-08 11:51:42 AM Jon00_Alexa CAPI - Device 118 is turned last
                      Mar-08 11:51:42 AM Jon00_Alexa CAPI - Device 2721 is turned last
                      Mar-08 11:51:42 AM Jon00_Alexa Echo device in use: Kitchen
                      Mar-08 11:51:42 AM Jon00_Alexa Parsed Date & Time (hour/min Extraction):
                      Mar-08 11:51:42 AM Jon00_Alexa Alexa Number String:
                      Mar-08 11:51:42 AM Jon00_Alexa Integer Parsed (from string): -99999999
                      Mar-08 11:51:42 AM Jon00_Alexa Alexa Number Integer: -99999999
                      Mar-08 11:51:42 AM Jon00_Alexa Integer Parsed (from number): -99999999
                      Mar-08 11:51:42 AM Jon00_Alexa Alexa command heard: 'turn off the balcony lights'
                      Mar-08 11:51:42 AM Jon00_Alexa Alexa Device ID: 'amzn1.ask.device.AGJ4QQJZ2WRDNTQIF3MPDPVIUBQNSWDMUWJFFWZNBZTGK6FEYVWJF4VVQBSGNKAPSS23L7RCQLOSQ5KYTL6GVI7QFK4TDAHFFFX5FW4QFVKYCRMTLS4ONSN5NUOZ4WD6RVA6AMHOGMIVWP7WBWQNJFCAZEZEJ3P5WLGIIRX4ZF7DE74LNC6BY'
                      Mar-08 11:51:42 AM Jon00_Alexa Alexa Device Name: 'Kitchen'
                      Mar-08 11:51:42 AM Jon00_Alexa Alexa Source: 'Amazon'


                      Comment


                        Balcony contains the word 'on' . Move your Off trigger above your On trigger (i.e.Trigger2 becomes Trigger1) and remove your ignore text entries.
                        Jon

                        Comment


                          I wonder if it's because Balcony contains the letters "on"....and if so, how do I work around that?

                          s.

                          Comment



                            Thx. Great minds et alia...

                            Comment


                              Well I tried again today with a new invocation word and it works. Being international woman's day, my invocation word is "her". As in Alexa, ask her for the outside temperature... Alexa, tell her to set the thermostat.... lol
                              HS3PRO 3.0.0.500 as a Fire Daemon service, Windows 2016 Server Std Intel Core i5 PC HTPC Slim SFF 4GB, 120GB SSD drive, WLG800, RFXCom, TI103,NetCam, UltraNetcam3, BLBackup, CurrentCost 3P Rain8Net, MCsSprinker, HSTouch, Ademco Security plugin/AD2USB, JowiHue, various Oregon Scientific temp/humidity sensors, Z-Net, Zsmoke, Aeron Labs micro switches, Amazon Echo Dots, WS+, WD+ ... on and on.

                              Comment


                                Jon, has something changed with respect to parameter passing to a script with the latest release? I have a script used to change the tv channel which had always worked under v1.0 of the helper. However, after upgrading the helper, while it hears the channel change and reports it to the log, it actually doesn't do anything. Another script I have for setting the thermostat also doesn't work.

                                Mar-09 6:23:00 PM Jon00_Alexa Script processing time: 514 ms
                                Mar-09 6:23:00 PM Jon00_Alexa Response sent to Alexa: 'Channel changed to 1201'
                                Mar-09 6:23:00 PM Jon00_Alexa Successful trigger under [Trigger9]
                                Mar-09 6:22:59 PM Jon00_Alexa Integer Parsed (from number): 1201
                                Mar-09 6:22:59 PM Jon00_Alexa Alexa Number Integer: 1201
                                Mar-09 6:22:59 PM Jon00_Alexa Integer Parsed (from string): -99999999
                                Mar-09 6:22:59 PM Jon00_Alexa Alexa Number String:
                                Mar-09 6:22:59 PM Jon00_Alexa Parsed Date & Time (hour/min Extraction):
                                Mar-09 6:22:59 PM Jon00_Alexa Echo device in use: FamilyRoom Echo
                                Mar-09 6:22:59 PM Jon00_Alexa Alexa Source: 'Amazon'
                                Mar-09 6:22:59 PM Jon00_Alexa Alexa Device Name: 'FamilyRoom Echo'
                                Mar-09 6:22:59 PM Jon00_Alexa Alexa Device ID: 'amzn1.ask.device.AEYDAMTR23GAWLM3YHAEGKGHKYRVAX3RVVJ33PFLJR SQ5TTWUTTSJ4VJVDKO34VYRATI4SKOKAMXFFWZMOWPC2Y5JHN5GCL5VCEQKZ 72OORL3KUV2PG7TPQ5O6GA42QCTEOJXILVOX43DH2OC4TAZURCYURQ'
                                Mar-09 6:22:59 PM Jon00_Alexa Alexa command heard: 'change channel to 1201'



                                The script: ChgTV_Chan.vb

                                Sub Main(ByVal Parm As String)

                                Dim Digit As String = ""

                                For Each c As Char In Parm
                                Digit = "DIGIT " & c
                                hs.CAPIControlHandler(hs.CAPIGetSingleControl(731,True,Digit ,False,False))
                                hs.waitsecs(0.2)
                                Next

                                End Sub

                                Alexa.ini:

                                [Trigger9]
                                AlexaText=channel change
                                AlexaResponse=Channel changed to [alexanumstring]
                                Name=Channel change
                                ResponseTimeOut=10
                                Mode=1
                                Device=-||FamilyRoom Echo
                                RunScript=ChgTV_Chan.vb

                                One other point: Version 1 of the helper announced "channel changed to one - two - oh - one" Which was nice. The latest version announces "channel changed to one thousand two hundred and one". Is there an easy remedy to have this announce it like v1.0 did?

                                Thanks,

                                Robert
                                HS3PRO 3.0.0.500 as a Fire Daemon service, Windows 2016 Server Std Intel Core i5 PC HTPC Slim SFF 4GB, 120GB SSD drive, WLG800, RFXCom, TI103,NetCam, UltraNetcam3, BLBackup, CurrentCost 3P Rain8Net, MCsSprinker, HSTouch, Ademco Security plugin/AD2USB, JowiHue, various Oregon Scientific temp/humidity sensors, Z-Net, Zsmoke, Aeron Labs micro switches, Amazon Echo Dots, WS+, WD+ ... on and on.

                                Comment

                                Working...
                                X