未完成!!!
搭建Alexa 语音服务,这里用Raspberry、Ubuntu都是可以的,Centos没试过。
Raspberry、Ubuntu
注册亚马逊服务
有亚马逊账户就登陆,没有就注册:获取免费亚马逊开发者账户
然后设置各种东西,公司、地址、手机、邮箱等等。
登陆成功后会跳转到:https://developer.amazon.com/home.html
创建设备
安装安全配置文件
打开web浏览器,并访问以下网址 https://developer.amazon.com/lwa/sp/overview.html
这里也能看到Client ID和Client Secret。
配置环境
sudo apt-get update
sudo apt-get -y install git gcc cmake build-essential libsqlite3-dev libcurl4-openssl-dev libfaad-dev libsoup2.4-dev libgcrypt20-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-good libasound2-dev doxygen openssl
pip install commentjson
# 安装VNC(树莓派自带了,不用安装)
sudo apt-get install tightvncserver vlc-nox vlc-data
# 树莓派设置开机启动(Ubuntu不用设置,用systemctl)
mkdir -p /home/pi/.config/autostart
vim /home/pi/.config/autostart/tightvnc.desktop
# 输入以下文本:
[Desktop Entry]
Type=Application
Name=TightVNC
Exec=vncserver :1
StartupNotify=false
# 树莓派设置环境变量
vim .profile
export LD_LIBRARY_PATH=/usr/lib/vlc
export VLC_PLUGIN_PATH=/usr/lib/vlc/plugins
# 安装Nodejs
apt-get install -y nodejs nodejs-legacy npm
node -v
npm -v
# 安装jdk,maven(树莓派不用安装java)
apt-get install -y java
或
apt-get install -y openjdk-8-jre-headless openjdk-8-jdk-headless
apt-get install -y maven
java -version
javac -version
mvn -version
配置Alexa服务
# 项目地址:https://github.com/alexa/alexa-avs-sample-app
cd /root/
wget https://github.com/amzn/alexa-avs-raspberry-pi/archive/master.zip
unzip master.zip
cd /root/alexa-avs-sample-app-master/samples/javaclient
vim ssl.cnf
# 修改为
commonName = CN # CN=
countryName = CN # C=(这一项一定要2个字节)
stateOrProvinceName = ST # ST=
localityName = L # L=
organizationName = O # O=
organizationalUnitName = OU # OU=
chmod +x generate.sh
./generate.sh
1.提示输入product ID, 就是你在亚马逊设置的Product ID;比如:842632422
2.提示输入 serial number(dsn), 自己设置一个编号(标识用的),比如123456
3.提示输入password, 你自己设置密码,例如: leolan (也可以留空)
vim config.json
# 修改以下几项
"productId":"你的Product ID:842632422",
"dsn":"你设置的 serial number(dsn):123456",
"provisioningMethod":"companionService", #这里填companionService
"wakeWordAgentEnabled":false,
"locale":"en-US",
"companionApp":{
"localPort":8443,
"sslKeyStore":"/root/alexa-avs-sample-app-master/samples/javaclient/certs/server/jetty.pkcs12",
"sslKeyStorePassphrase":"生成证书时设置的密码:leolan",
"lwaUrl":"https://api.amazon.com"
},
"companionService":{
"serviceUrl":"https://localhost:3000",
"sslClientKeyStore":"/root/alexa-avs-sample-app-master/samples/javaclient/certs/client/client.pkcs12",
"sslClientKeyStorePassphrase":"生成证书时设置的密码:leolan",
"sslCaCert":"/root/alexa-avs-sample-app-master/samples/javaclient/certs/ca/ca.crt"
vim pom.xml
# 在<build>上面</dependencies>内加入以下部分。
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.1.0</version>
<scope>compile</scope>
</dependency>
cd /root/alexa-avs-sample-app-master/samples/companionService/
vim config.js
# 修改以下几项
clientId: '你的Client ID',
clientSecret: '你的Client Secret',
sslKey: '/root/alexa-avs-sample-app-master/samples/javaclient/certs/server/node.key',
sslCert: '/root/alexa-avs-sample-app-master/samples/javaclient/certs/server/node.crt',
sslCaCert: '/root/alexa-avs-sample-app-master/samples/javaclient/certs/ca/ca.crt',
products: {
"你的Product ID": ["你设置的 serial number(dsn)"],
# 连接VNC;通过界面操作;会有弹窗!!!
# 新开窗口
cd /root/alexa-avs-sample-app-master/samples/companionService/
npm install
npm start
# 新开窗口
cd /root/alexa-avs-sample-app-master/samples/javaclient
mvn validate
mvn install
mvn exec:exec
参考:
https://aws.amazon.com/cn/blogs/china/raspberry-alexa/
https://blog.csdn.net/z2066411585/article/details/78573368
https://github.com/alexa/avs-device-sdk/wiki/Raspberry-Pi-Quick-Start-Guide
https://github.com/alexa/avs-device-sdk/wiki#release-notes
https://blog.csdn.net/gitchat/article/details/78869367
评论区