LoginSignup
6
5

More than 5 years have passed since last update.

Alexa + IoT (esp8266) Custom (1)

Posted at

IMGP6414.JPG

amazon Alexa関係となります

amazon Alexa と、esp8266連携で
custom Skill を追加し、
今回も、echo系の代用品は、echosim.io(モバイル版chrome) を使用しています

デモは、
設置場所のIoT センサー値を、Alexa に読み上げ実行してもらうように
カスタマイズしています。

会話の例:
呼ひかけ: [ask Sensor to check ]
Alexa : [ok, temperature is 17 degree, and humidity is 44 % , now time is 10 hour 48 minute. ]

*)
日本時刻も含む内容も応答内容に含まれていますが、おまけです。


Youtube


構成

ss-custom-1.png

alexa は拡張方法として、
Skill Kit が利用可能で、この場合 問合せ系の機能で
custom Skill を使っています。

custom Skillから、Lambda function 呼出までは、事例でよくありそうでしたが、
今回は IoT連携部分は、Lambdaから Rest-APIで、ec2などのweb serverから
センサー値を取得し、alexa に渡してもらいます。
センサー値は事前に esp8266から、web serverのストレージ側に定期更新させておき、
最新データを、alexa に出力可能な構成としています。

*) esp8266の周辺センサはdht11 で、温度/湿度が計測可能でクラウド連携も可能

code

公式ヘルプや、先人様の記事を参考にしています。
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skill-as-a-lambda-function

*) 環境面は、下記にログインして作業が必要です。
alexa Skill Kti : developer amazon ( developer.amazon.com )
Lambda : AWS ( aws.amazon.com ) のマネジメントコンソール

(1) 参考のサンプル, node.js版
https://github.com/amzn/alexa-skills-kit-js

helloWorld:
samples/helloWorld/ --カンタンな[hello world] 応答するサンプル、
設定手順や、コードが参考になりました。

[custom Skill 設定 ]:
name : helloWorld
InvocationName : hello world
*) alexa の呼出に関係するキー単語

Interaction model/ intent Schema:
https://github.com/amzn/alexa-skills-kit-js/blob/master/samples/helloWorld/speechAssets/IntentSchema.json

Interaction model/ sample Utterances:
https://github.com/amzn/alexa-skills-kit-js/blob/master/samples/helloWorld/speechAssets/SampleUtterances.txt
*) custom Skill を呼出す、単語パターンみたいなもの?

configuration:
endPoint: Lambda functionを呼び出す指定が必要。

[ Lambda function ]
src/
下のコードを zip圧縮して、デプロイしておきます

テストは、echo系デバイス/ /echosim.io で使用可能です。

tell, Hello world to say hello
ask, Hello world to say hello
と、alexa に話しかけると。[hello world]と返答してくれます。

*) IoT連携部分の実装は、次回で説明したいと思います。
http://qiita.com/knakaqi/items/fa201a0053fe9dd2d016


関連のまとめ: Alexa + IoT のリンク集となります。

6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5