2024年11月22日星期五 下午10:36:11

DuerOS将小度音箱设备接入HomeAssistant 进行控制-小度设备(网页控制)

2 年 前
#70 引用
智能音箱如何接入Home Assistant

智能音箱设备是怎样接入Home Assistant的?

智能音箱都有智能音箱厂家的技能开发平台。

小度支持多个智能家居接入,应是国内最多最全的..

比如:小米旗下的aqrar也支持。这个就是补充了小米的很多产品

通过这种方式,我们可以控制接入小度的所有设备,好用的不得了,不管是海尔、创维、涂鸦、易微联、控客、博联,美的丑的Image统统都逃不掉被我们控制的命运(当然前提是能接入到小度

way 1:

目前基本都是通过智能音箱厂家的技能开发平台,自己创建智能家居技能(当然自定义技能也可以,但要自己设计语义,调用还得呼唤技能名称,用起来不太方便)来完成接入。技能需要实现的两个功能为:

https://post.smzdm.com/p/ar07plpg/

https://mp.weixin.qq.com/s/0D4X6oL60vv7oiJvJiorkg  





流程:
1.设备添加到小度音箱
2.通过接口获取小度音箱下的设备
3.分析小度控制设备的协议并调用控制设备

OAuth服务


    授权音箱云平台的接入、对音箱云平台的控制指令进行校验。

    网关服务

    对音箱云平台的指令进行解析,通知Home Assistant控制真实设备。

整体工作流程如下:

    
音箱云平台申请Token

    网关服务返回Token

    音箱云平台发送指令至网关服务

    网关服务通知OAuth服务对指令的Token进行认证

    OAuth服务返回认证结果

    网关服务对指令进行解析,通知Home Assistant进行处理

    Home Assistant返回控制结果

    网关服务返回控制结果给音箱云平台





way 1:用智能音箱插件接入

天猫精灵插件 https://bbs.hassbian.com/thread-4758-1-1.html
小度音箱插件 https://bbs.hassbian.com/thread-5417-1-1.html

https://github.com/zhkufish/homeassistant-dueros
0
2 年 前
#3567 引用
Way 2

blog:https://mp.weixin.qq.com/s/0D4X6oL60vv7oiJvJiorkg

百度账号 1个  freew*****

授权 开放这平台 duros.baidu.com

登录    保持登录状态



step 1:获取小度音箱下所有已经接入的设备

通过以下接口可以获取所有设备

https://xiaodu.baidu.com/saiya/smarthome/devicelist?from=h5_control&generalscene=2

output


{"status":0,"msg":"ok","logid":2796821007,"data":{"isenable":true,"appliances":[{"botName":"电信","cuid":"6C193577AE34986C","showPanel":true,"botId":"__built_in_dianxin_platform__","botLogo":"","num":"guv3i_uRviAHTqqqB","applianceId":"1575172434884","applianceTypes":["SOCKET"],"nicknames":"","friendlyDescription":"智能插座","guideline":{"开关":["打开智能插座","关闭智能插座"]},"supportActions


接口二:https://xiaodu.baidu.com/saiya/device/list

这个接口能获取当前用户下所有小度音箱设备(当用户有多个小度音箱时)

output



{
  "status": 0,
  "msg": "STATUS_OK",
  "logid": "1660419992752559",
  "data": {
    "list": [
      {
        "device_id": "xqn6apuczz77pp9g73mlzwuhb03uujfxhst|6c193577ae34986c",
        "name": "",
        "device_version": "1.60.3.2205121403R-1CW-48d52a0-CT",
        "type": "",
        "software_version": "",
        "sys_version": "",
        "mac": "88:33:87:AE:35",
        "sn": "6C1935E386C",
        "cuid": "6C193586C",
        "ip": "",
        "owner_userid": "",
        "userid": "20",
        "capability": "",
        "ctime": 1572692458,
        "mtime": 1660396200,
        "tone": "",
        "appid": "dm26EE728",
        "device_from": "dcs",
        "protocol_version": "dcs/v1",
        "ssid": "",
        "server_host": "group.opera-lc-ts.AUDIO.gzns",
        "client_id": "xQnLZwujFXHst",
        "link_type": "puffer2",
        "third_party_uid": "16604||61467_6C1986C$10.8.11_136||9e634-4778-90e6-3bbeaf206707",
        "online_time": 1660396200,
        "online_status": true,
        "network_infos": "[{\"deviceMac\":\"88:35\",\"ipAddress\":\"192.168.101.10\",\"routerMac\":\"14:3C:AC\",\"ssid\":\"ChinaNet-S5S7XA\"}]",
        "appkey": "FE39",
        "status": 0,
        "device_icon": "https://oss-media.cdn.bcebos.com/oss/20201113/1c__w312_h312_64K.aa87432.png"
      }
    ]
  }
}
0
2 年 前
#3568 引用
step 2:控制接入小度的设备

既然我们知道了接入小度的所有设备,当然我们也可以控制它

如果你只想省心点点点,那你可以直接访问它的网页控制界面

https://xiaodu.baidu.com/saiya/smarthome/index.html#/
0
2 年 前
#17739 引用


{
        "botName": "欧瑞博",
        "cuid": "cuid_not_exist",
        "showPanel": true,
        "botId": "e14bb88d-6486-7be1-1e10-12a25f2a9512",
        "botLogo": "https://skillstore.cdn.bcebos.com/icon/69/42c60721-9e57-8273-847d-962c2ef93742.png",
        "num": "ga2lf_aV-iQOTqqqB",
        "applianceId": "47fa9c2f8b6948a7bfb59d3c6e4238de",
        "applianceTypes": [
          "SOCKET",
          "TV_SET"
        ],
        "nicknames": [],
        "friendlyDescription": "智能插座S30c",
        "guideline": {
          "开关": [
            "打开智能插座S30c",
            "关闭智能插座S30c"
          ]
        },
        "supportActions": [
          "turnOn",
          "turnOff",
          "timingTurnOn",
          "timingTurnOff"
        ],
        "panel": null,
        "canDelete": 0,
        "connectedApplianceType": "电视机",
        "friendlyName": "智能插座S30c",
        "groupName": "客厅",
        "groupId": "4564948584441459",
        "floorId": -1,
        "floorName": "默认楼层",
        "attributes": {
          "connectivity": {
            "detail": {
              "name": "连接",
              "range": {
                "REACHABLE": "在线",
                "UNREACHABLE": "离线"
              }
            },
            "value": "REACHABLE",
            "levelValueOrigin": "",
            "timestampOfSample": 1668381962
          },
          "turnOnState": {
            "detail": {
              "name": "开关",
              "range": {
                "ON": "打开",
                "on": "打开",
                "OFF": "关闭",
                "off": "关闭",
                "FAILED": "失败"
              }
            },
            "value": "OFF",
            "levelValueOrigin": "",
            "timestampOfSample": 1668381451
          }
        },
        "stateSetting": {
          "connectivity": {
            "name": "连接",
            "value": "REACHABLE",
            "valueType": "ENUM",
            "scale": "",
            "valueRangeMap": {
              "REACHABLE": "在线",
              "UNREACHABLE": "离线"
            },
            "time": "2022-11-14 07:26:02"
          },
          "turnOnState": {
            "name": "开关",
            "value": "OFF",
            "valueType": "ENUM",
            "scale": "",
            "valueRangeMap": {
              "ON": "打开",
              "OFF": "关闭"
            },
            "time": "2022-11-14 07:17:31"
          }
        },
        "controlType": 0,
        "icons": {
          "first": "https://dumi-iot-bj-smarthome.cdn.bcebos.com/device_icons/png3.0/SOCKET.png",
          "second": "https://dumi-iot-bj-smarthome.cdn.bcebos.com/device_icons/png3.0/TV_SET.png"
        },
        "status": "电视机已关闭",
        "ctime": "1667926697",
        "gtime": "",
        "isEnableSetGroup": true,
        "isSupportLightAdapt": 0,
        "isSupportWallSwitch": 0,
        "needRequestDetail": false,
        "vid": "",
        "deviceIndex": 5
      },

0
10 个月 前
#26327 引用
useful links
将xiaodu小度设备集成到ha中
https://github.com/apgmer/hass-xiaodu
0