3 Star 36 Fork 17

麦粒橙 / link-smart-speaker-demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

link-smart-speaker-demo

介绍

该项目是基于SpringBoot实现的,小度音箱DuerOS、天猫精灵AliGenie 智能家居 技能对接demo,模拟OAuth2、设备云功能。

注意:
该项目,只是对接了DuerOS及AliGenie的智能家居技能。

项目模块说明

模块名 模块描述
lssd-ai-aligenie AI天猫精灵模块
lssd-ai-dueros AI小度音箱模块
lssd-common 公共模块
lssd-device-mock 设备Mock数据模块
lssd-oauth 认证模块
lssd-starter 启动模块项目启动入口

使用说明

注意:
项目使用了Lombok,建议在IDE中安装Lombok插件。

1. 修改application.yml配置文件中,OAuth2的Client信息

## OAuth2 配置
oauth2:
  # TODO DuerOS 授权配置
  clients[0]:
    client-id: DuerOSClientId
    client-secret: DuerOSClientSecret
    redirect-uri: https://xiaodu.baidu.com/saiya/auth/....
  # TODO AliGenie 授权配置
  clients[1]:
    client-id: AliGenieClientId
    client-secret: AliGenieClientSecret
    redirect-uri: https://open.bot.tmall.com/oauth/callback

OAuth2相关地址信息:

设备云/网关地址信息:

该地址在lssd-ai-dueros模块的DuerosController类中配置

该地址在lssd-ai-aligenie模块的AliGenieController类中配置

DuerOS平台上填写方法如下图:

在这里插入图片描述

AliGenie平台上填写方法如下图:

在这里插入图片描述

2. 替换https.jks证书

由于DuerOS及AliGenie平台要求,必须使用https证书。

如果是非jks格式的证书,可以使用OpenSSL工具合成,也可在线合成JKS。

在线合成参考地址:
https://www.myssl.cn/tools/merge-jks-cert.html
https://csr.chinassl.net/convert-ssl.html

3. 修改application.yml配置文件中,https证书信息**

# 服务配置
server:
  port: 10030
  # TODO SSL证书配置
  ssl:
    key-store: classpath:https.jks    # 配置SSL证书地址
    key-store-password: keyPassword     # jks证书密钥
    key-store-type: JKS             # 类型
    key-alias: keyAlias           # 证书alias

4. 修改application.yml配置文件中,AI模块信息

#AI模块配置
ai:
  dueros:
    notify-bot-id: xxxxxxxxx-xxxxxx-xxxxxxx-xxxx-xxxxxx
    # 智能家居协议,技能ID
    # 用于有设备列表更新时,通知小度

5. 项目运行

这是一个SpringBoot项目,可以参照网上的打包部署方法。

IDE中运行

运行lssd-starter模块的link.smart.speaker.demo.LinkSmartSpeakerDemoApplication类启动项目。

Maven打包运行

# Maven打包
cd ./link-smart-speaker-demo
mvn install

# 打包完,jar包在`/lssd-starter/target/`目录中。
cd ./lssd-starter/target/
java -jar lssd-starter-0.0.1.jar

6. 其他

  • 部署配置完成后,点击小度配置中的授权,使用admin&admin登录进行授权。
  • 端口号在代码中(Application类)https跳转http的时候也写了,如果需要修改也一并修改。
  • 代码中,方便DEMO,写了简单的OAuth功能,不需要可以删除。
  • 该项目中,使用了抽油烟机和净水器品类为示例。
MIT License Copyright (c) 2020 麦粒橙 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

小度音箱DuerOS、天猫精灵AliGenie 智能家居 技能对接demo,模拟OAuth2、设备云功能 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/mylitboy/link-smart-speaker-demo.git
git@gitee.com:mylitboy/link-smart-speaker-demo.git
mylitboy
link-smart-speaker-demo
link-smart-speaker-demo
master

搜索帮助