question

apogeeskills avatar image
apogeeskills asked ·

How do you implement a specific interface like Alexa.Thermostat?

I see in the documentation for all the interfaces that it simply says "Implement the Alexa.Thermostat interface". However I don't see where to do that. Is that in the manifest? I tried

"interfaces": [

{

"type": "Alexa.Thermostat"

}

]
But I get an enum error.

This is also a preexisting skill that's being hosted as a web service. It was not created as a Smart Home Skill originally. Is it still possible to connect to the Thermostat this way?

smart homethermostat
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

KirkC@Amazon avatar image
KirkC@Amazon answered ·

Hello apogeeskills. Let's start by taking a couple steps back. To begin smart home interfaces, like the "Alexa.ThermostatController" interface, can only be used for smart home skills:
https://developer.amazon.com/en-US/docs/alexa/smarthome/understand-the-smart-home-skill-api.html

Next, the way you use smart home interfaces is to define what functionality is supported by a particular smart home device (or "endpoint" in smart home skill parlance). Each smart home endpoint may be defined by one or more interfaces. For example, one might define a "wall thermostat" by declaring support for four interfaces: ThermostatController, TemperatureSensor, EndpointHealth and Alexa:
https://developer.amazon.com/en-US/docs/alexa/smarthome/get-started-with-device-templates.html#wall-thermostat

Now to your question of what it means to "implement" a particular interface, it means a couple things.

First, it means that when your skill's back-end receives an "Alexa.Discovery" "Discover" directive, it will respond with a "Discover.Response" JSON in which the payload.endpoints[#].capabilities array has declared support for the "Alexa.ThermostatController" interface for the endpoint in question. An example Discover.Response can be found here:
https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-thermostatcontroller.html#discover-response-example


Secondly, by declaring support for the Alexa.ThermostatController in your skill's Discover.Response JSON you're saying that your skill can handle certain directives associated with this specific controller. There are four directives associated with this particular controller:

The links above provide example requests you may receive as well as example responses your skill's back-end may return.

If developing smart home skills generally is a new subject though, I'd recommend first reviewing the "Steps to Build a Smart Home Skill" documentation here to familiarize yourself with the topic:
https://developer.amazon.com/en-US/docs/alexa/smarthome/steps-to-build-a-smart-home-skill.html

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.