Important note: this solution was developed and provided as part of a hackathon. This project is currently not being used in a project and is to be understood as a demo.
Amazon Alexa Skill 'SyF' (working title) starts and queries the Sigfox backend via APIv2 for new IoT readings
User: Alexa, open <invocation name>.
User: Alexa, open <invocation name> with details.
User: Alexa, open <invocation name> with Team.
The following conditions are required for this skill:
- Sigfox IoT device (e.g. Pycom devices)
- IoT device reports information to the Sigfox backend (or has already reported)
- sigfox backend is released via API access
- AWS access
- Amazon Developer (Alexa) access
Of course, other devices and a different network/backend than Sigfox can also be used. The code must be adapted accordingly.
###Sigfox Backend
- Transfer of the measured values into the Sigfox backend using a suitable routine.
- Setting up access information for API use. This information is later entered in the Alexa Skill under 'Sigfox_API_USername' and 'Sigfox_API_Password'.
Note: In the present scenario, the data is compressed so that the desired value range can be sent as a single byte. The information in the backend has the format xxyy, where 'xx' is the protocol version (01) used by the sending device and 'yy' corresponds to the actual measured value.
###AWS Lambda
- Create a Amazon AWS Lambda function (at https://console.aws.amazon.com/console/home)
- Create a new function with settings
Author from scratch
,Python 2.7 Runtine
,Create a custome role
with 'lambda_basic_execution - Select 'Alexa Skill Kit' as trigger for the own function
- Copy code from
/aws_lambda/
into the Code9 editor - Define environment variables 'Card_Title_Prefix', 'Skill_Name', 'Skill_Answer_DefaultMode', 'Sigfox_Device_ID', 'Sigfox_API_USername' and 'Sigfox_API_Password' and specify them with their own values
- Check the executability of the code again by
Test
; if necessary, create a test event (Test Event
based on the templateAmazon Alexa Start Session
)
###Alexa skill
- Create Amazon Alexa Skill in the Amazon Developer (https://developer.amazon.com/home.html) under
Alexa Skill Kit
- Select skill with
Custom
model andAlexa-Hosted
method - Specify
Invocation
- Create intents
detail
, 'short' andteam
with desired own uterances (example see /alexa_skill/syf.json) - Endpoint for Amazon Alexa Skill ⇄ Set up Amazon AWS Lambda function and enter ARN of the ASW Lambda handler
- Save skill again and have it regenerated
Depending on the speed of the backend query, the initial start of the skill/lambda function and the query of the backend may take more than 3 seconds. In this case the Lambda function reports a timeout error. If this behavior occurs frequently, the timeout default of 3 seconds may have to be increased. However, it should be remembered that longer startup phases can affect the UX at the user's end. For this reason, the prototype query shown here is limited to one device.
#sigfox #iot #aws #alexa #python #temperature