Skip to content

Amazon Alexa

mguinness edited this page Sep 7, 2020 · 2 revisions

Alexa Skill

IntelliCenter Gateway has the capability to respond to predetermined requests from Amazon Alexa skills. After a custom Alexa skill has been created, an endpoint is set to the gateway application running behind a SSL reverse proxy. Instructions below will walk you through the process.

Developer Account

To start you will need to login to the Amazon account that you use for your Alexa devices as this custom skill will only be available to devices that share the account.

To create a skill you will need to create an Amazon Developer account where you will have to enter some personal details including name, phone and address. This is required for listing applications on the Amazon store and the developer/company name is shown on the application listing (and hard to change later).

You are also asked if you expect to monetize applications and how to receive payments which is not necessary for this skill so it can be skipped. The web page Amazon Developer Account Setup gives more information on the signup process.

Alexa Skills Kit

Once signed up, you can go into the Alexa Skills Kit (ASK) console to create a custom skill. Once there you can click on the "Create Skill" button which takes you to the following screen. Here you can enter the skill name as "IntelliCenter Gateway", choose the Custom model option and for the host option you need to choose "Provision your own".

Create Skill

Clicking on "Create Skill" in the upper right of the page will take you to the template page where you will choose the "Hello World Skill".

Once the skill is created, you can proceed to the build section of the console as shown below. Click on "Invocation" on the left hand side and then enter in lower case "intellicenter gateway" in the empty field. This is the skill invocation that will be used after calling Alexa.

Build Menu

Now click on the "Interaction Model" menu and then the JSON Editor sub menu. Here you can paste in the following JSON configuration that will save you from typing these settings in manually. Here you will see the intents (commands) that are defined, which are for temperature, salt level and pH value.

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "intellicenter gateway",
            "intents": [
                {
                    "name": "AMAZON.CancelIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.StopIntent",
                    "samples": []
                },
                {
                    "name": "Temp",
                    "slots": [],
                    "samples": [
                        "what the water temperature is"
                    ]
                },
                {
                    "name": "AMAZON.NavigateHomeIntent",
                    "samples": []
                },
                {
                    "name": "Salt",
                    "slots": [],
                    "samples": [
                        "what the salt level is"
                    ]
                },
                {
                    "name": "Chem",
                    "slots": [],
                    "samples": [
                        "what the ph value is"
                    ]
                }
            ],
            "types": []
        }
    }
}

Once the above is pasted into the text area, you will need to click on "Save Model" and then afterwards click on "Build Model". This will take a while to complete, but you can continue with the following step while it's building.

The final step is to click on the "Endpoint" menu. Here you will need to select the HTTPS option and enter https://www.[domain].duckdns.org/alexa under the default region. You will need to substitute [domain] with the subdomain that you registerd previously with Duck DNS, or alternatively you can use your own custom domain which is not covered here. In the following dropdown you will need to choose the "My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority" option. Click "Save Endpoints" button at the top of the page.

That's it, now you're ready to test! For this to work the Gateway application must already be running at the address you entered previously. You can now click on the "Test" navigation menu at the top of the page. In the box labelled "Type or click and hold the mic" you can enter the phrase "Ask IntelliCenter Gateway what the water temperature is" and hit enter. Alexa should respond back with the current temperature.

The final stage is to click on the "Distribution" navigation menu. Here you can enter information that will appear on the skill listing page. Below are the three example phrases (or utterances) that you can enter.

  1. Alexa, ask IntelliCenter Gateway what the water temperature is
  2. Alexa, ask IntelliCenter Gateway what the salt level is
  3. Alexa, ask IntelliCenter Gateway what the ph value is

Adding Skill to Device

On your mobile device, open the Alexa app. On the bottom menu select "More" icon and then select "Skills & Games". Next you need to swipe left to select the "Your skills" section and then swipe left on the lower section to find "Dev". Selecting that box should then show the skill that you have just created. Choose the "IntelliCenter Gateway" skill and then click on "Enable Skill" to make it available to the registered devices.

You should now be able to speak to you device and invoke the skill by name using one of the utterances listed above. By default only the first one is currently active in the Gateway application. By using the following configuration section in the appsettings.json file you can specify the following settings.

"Alexa": {
  "ApplicationId": "amzn1.ask.skill.[GUID]",
  "Intents": {
    "Temp": "SSW11",
    "Salt": "CHR01",
    "Chem": "CHM01"
  },
  "Augment": true
}

The ApplicationId is the unique identifier for your Alexa skill and is an optional method to verify requests are valid. Replace [GUID] with the skill id which can be obtained by looking at the url of the skill in the Alexa Developer Console (starting w/ amzn1.ask.skill).

The Intents section maps an IntelliCenter object parameter name with the corresponding skill intent. These intents are predefined in the Gateway application and correspond with the intent names configured in the Alexa interaction model above. Both the Salt and Chem intent mappings are optional and only needed if you have the corresponding IntelliChlor and IntelliChem equipment.

The Augment setting is an optional flag used for the skill response. If set to true it appends text to the response based on the range of the requested value. For example if the water temperature is below 78°F it will be designated as cold.

Conclusion

Hopefully we've shown you how you to build your own Alexa skill to get some limited information from your IntelliCenter system. The created skill is only meant for a single Amazon account and not intended to be published (as it's tied to your personal Gateway application). Also it's not designed to replace the official Pentair app, but demonstrates how you can create a customizable skill to interface with the IntelliCenter should the need arise.

Clone this wiki locally