Coder Social home page Coder Social logo

alexa-labs / alexa-smart-home-wifi-simple-setup-sample Goto Github PK

View Code? Open in Web Editor NEW
10.0 5.0 4.0 1.27 MB

This repository provides a step by step guide on creating your first Wi-Fi Simple Setup enabled device

License: Other

CMake 12.29% C 17.89% Python 69.82%
ffs wss alexa alexa-skill-setup wi-fi alexalive

alexa-smart-home-wifi-simple-setup-sample's Introduction

Introduction

This repository provides a step by step guide to creating your first device compatible with Wifi Simple Setup from Amazon. Wifi Simple Setup (WSS) is a part of the Frustration Free Setup program from Amazon which focuses on simplifying the smart home setup experience for customers. For more on the program, please visit https://developer.amazon.com/frustration-free-setup

WSS Sample Device Setup with ZTS

The following are the tasks to run the demo:

  1. Request a New Device Identifier and Attestation Keys

  2. C SDK Prerequisites

  3. Download and Run WSS C SDK

  4. Build WSS SDK with AWS IoT for embedded Linux.

  5. Partner Cloud Prerequisites

  6. Implement SDAE Event

  7. Implement CDAE Directive

Next>>

Security

See CONTRIBUTING for more information.

License

This library is licensed under the Amazon Software License.

alexa-smart-home-wifi-simple-setup-sample's People

Contributors

amazon-auto avatar ramezab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

alexa-smart-home-wifi-simple-setup-sample's Issues

Request for BearerToken returns a 400

Hi @ramezab!
So I have been trying to run the WSS sample, but I am facing an issue with getting the bearer token.
Here's a minimum working example to obtain a bearer token that the SDAE request must have:

import http.client
import json

clientId='amzn1.application-oa2-client.xxxx..'
clientSecret='secrethashgoeshere'

lwa_uri = 'api.amazon.com'
connection = http.client.HTTPSConnection(lwa_uri)
lwa_headers = {
    'Content-Type': "application/json;charset=UTF-8",
    'Cache-Control': "no-cache"
}
lwa_payload = {
    "grant_type": "client_credentials",
    "client_id": clientId,
    "client_secret":clientSecret,
    "scope": "alexa::device_association_report:write"
}
connection.request('POST', '/auth/o2/token', json.dumps(lwa_payload), lwa_headers)
response = connection.getresponse()

lwa_result = json.loads(response.read())
print('[LOG] HTTP Status code: ' + str(response.getcode()))
print('[LOG] LWA returned: ' + json.dumps(lwa_result))

I have tried running this with the Id-Secret pair obtained from my Alexa Smart Home Skill config page, but I get a:

[LOG] HTTP Status code: 400
[LOG] LWA returned: {"error_description": "The request has an invalid parameter : scope", "error": "invalid_scope"}

I also tried creating a LwA Security Profile from this page and got another Id-Secret pair from there, that had the same format, but even that gives me the same result.

Any idea what might be going wrong?

the device keys can't pass verification during the PROVISIONING stage

after Request a New Device Identifier and Attestation Keys step, we replace the keys we get from Amazon, during the Execute Wi-Fi provisionee state START_PROVISIONING stage, device post the nonce:

POST /api/v1/startProvisioningSession HTTP/1.1
Content-Length: 43
Host: dp-sps-na.amazon.com
Content-type: application/json

{"nonce":"iUryyB6ecF5BPC6FTJfOUuhIxhhP32m"}

then server response body is :

{"canProceed":false,"waitTime":"PT30S"}

which cause the WSS C SDK can't continue to next step anymore, Can anyone help to fix this problem?
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.