-
- parsing discovery request from Amazon(AWS Lambda)
- and building response with or without Endpoints(Smart Home devices) as described here
-
- parsing and building Alexa headers
-
- payloads for responses
-
- constructs response with event, header and given payload
-
- asynchronous response for AlexaChangeReport(proactively reported states) and asynchronous Alexa Response after deferred reponse. This kind of responses should be sent to Alexa Event Gateway
-
- AlexaDiscoveryRequest parses discovery request forwarded from aws_lambda.js. And constructs response with event, header and given payload
-
- Endpoint represents a connected device associated with the customer’s device cloud account. (Smart Device)
-
- AlexaContext class represents Context object for example for Alexa StateReport response.
-
- parses Control request and sets correlation token, directive and scope for future use.
-
- AlexaError helper class constructs 'type' -> 'message' chain for given error type in constructor
-
Example code for AWS Lambda function to forward requests and responses from AWS to your server and back
-
copy or upload this file to your AWS Lambda function.
-
Don't forget to change REMOTE_CLOUD_HOSTNAME and REMOTE_CLOUD_BASE_PATH to the right paths
var https = require('https'); var REMOTE_CLOUD_BASE_PATH = "/smarthome_skill/"; var REMOTE_CLOUD_HOSTNAME = "yourdomain.com";
This is an example of using Amazon Alexa Smart Home Skill PHP API.
It simply parses AlexaDiscoveryRequest generates one Endpoint device and sends response back.
This is an example of using Amazon Alexa Smart Home Skill PHP API.
It simply parses Alexa.PowerControl request and responds with OK to TurnOn and TurnOff requests.
This example could respond with errors: just change $not_found or $user_check_faild to true
This is an example of using Amazon Alexa Smart Home Skill PHP API.
It simply parses Alexa.ReportState request and responds back to AWS Lambda function.
To change the state of device you could change $device_state_is_on and $device_is_online values
- AWS Lambda code for forwarding request and responses
- Discovery example code - respond to Discover request with example devices
- turnON, turnOFF example code for PowerSwitch Interface
- ReportState example code for PowerSwitch Interface