『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
楼主: 27hh

[进阶教程] Xiaomi MIoT - 小米米家设备全自动通用接入插件,无需配置文件

  [复制链接]

9

主题

360

帖子

1190

积分

金牌会员

Rank: 6Rank: 6

积分
1190
金钱
830
HASS币
0
发表于 2021-1-24 21:22:19 | 显示全部楼层
试试只用摄像头的开关功能也不行

switch:
  - platform: xiaomi_miot_raw       #此部分为固定
    name: 摄像头               #自定义设备名称
    host: 192.168.0.162             #设备 IP
    token: 3434596b4******* #设备 token
    mapping:
      switch_status:                #开关类实体必须有这一项,用于读取和控制开关状态
        siid: 2
        piid: 1
    params:                         #params对应上面的mapping,用于指定该项的详细信息
      switch_status:                #对应上面的switch_status,即开/关时分别应该是什么状态
        power_on: True
        power_off: False

提示:
Logger: custom_components.xiaomi_miot_raw
Source: custom_components/xiaomi_miot_raw/__init__.py:140
Integration: xiaomi_miot_raw (documentation, issues)
First occurred: 下午9:14:50 (1 occurrences)
Last logged: 下午9:14:50

Got exception while fetching 摄像头 's state: No response from the device

Logger: homeassistant.components.switch
Source: custom_components/xiaomi_miot_raw/__init__.py:174
Integration: 开关 (documentation, issues)
First occurred: 下午9:14:50 (1 occurrences)
Last logged: 下午9:14:50

xiaomi_miot_raw: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
    await task
  File "/config/custom_components/xiaomi_miot_raw/__init__.py", line 174, in async_update
    state = self._state_attrs['switch_status']
KeyError: 'switch_status'
回复

使用道具 举报

0

主题

17

帖子

58

积分

注册会员

Rank: 2

积分
58
金钱
41
HASS币
0
发表于 2021-1-24 21:17:15 | 显示全部楼层
学习到了,太有帮助了
回复

使用道具 举报

9

主题

360

帖子

1190

积分

金牌会员

Rank: 6Rank: 6

积分
1190
金钱
830
HASS币
0
发表于 2021-1-24 21:13:22 | 显示全部楼层
本帖最后由 tiger81 于 2021-1-24 21:49 编辑

Model: chuangmi.camera.ipc013
不支持我的米家小白青春版摄像头,这个摄像头一直无解。希望楼主能支持,谢谢!
{
        "type": "urn:miot-spec-v2:device:camera:0000A01C:chuangmi-ipc013:1",
        "description": "Camera",
        "services": [{
                "iid": 1,
                "type": "urn:miot-spec-v2:service:device-information:00007801:chuangmi-ipc013:1",
                "description": "Device Information",
                "properties": [{
                        "iid": 1,
                        "type": "urn:miot-spec-v2:property:manufacturer:00000001:chuangmi-ipc013:1",
                        "description": "Device Manufacturer",
                        "format": "string",
                        "access": ["read"]
                }, {
                        "iid": 2,
                        "type": "urn:miot-spec-v2:property:model:00000002:chuangmi-ipc013:1",
                        "description": "Device Model",
                        "format": "string",
                        "access": ["read"]
                }, {
                        "iid": 3,
                        "type": "urn:miot-spec-v2:property:serial-number:00000003:chuangmi-ipc013:1",
                        "description": "Device Serial Number",
                        "format": "string",
                        "access": ["read"]
                }, {
                        "iid": 4,
                        "type": "urn:miot-spec-v2:property:firmware-revision:00000005:chuangmi-ipc013:1",
                        "description": "Current Firmware Version",
                        "format": "string",
                        "access": ["read"]
                }]
        }, {
                "iid": 2,
                "type": "urn:miot-spec-v2:service:camera-control:0000782F:chuangmi-ipc013:1",
                "description": "Camera Control",
                "properties": [{
                        "iid": 1,
                        "type": "urn:miot-spec-v2:propertyn:00000006:chuangmi-ipc013:1",
                        "description": "Switch Status",
                        "format": "bool",
                        "access": ["read", "write", "notify"]
                }, {
                        "iid": 2,
                        "type": "urn:miot-spec-v2:property:image-rollover:00000058:chuangmi-ipc013:1",
                        "description": "Image Rollover",
                        "format": "uint16",
                        "access": ["read", "write"],
                        "unit": "arcdegrees",
                        "value-range": [0, 180, 180]
                }, {
                        "iid": 3,
                        "type": "urn:miot-spec-v2:property:night-shot:00000057:chuangmi-ipc013:1",
                        "description": "Night Shot",
                        "format": "uint8",
                        "access": ["read", "write"],
                        "value-list": [{
                                "value": 0,
                                "description": "Auto"
                        }, {
                                "value": 1,
                                "description": "Off"
                        }, {
                                "value": 2,
                                "description": "On"
                        }]
                }]
        }, {
                "iid": 3,
                "type": "urn:miot-spec-v2:service:p2p-stream:00007881:chuangmi-ipc013:1",
                "description": "2P Stream",
                "actions": [{
                        "iid": 1,
                        "type": "urn:miot-spec-v2:action:start-p2p-stream:00002839:chuangmi-ipc013:1",
                        "description": "Start P2P Stream",
                        "in": [],
                        "out": []
                }, {
                        "iid": 2,
                        "type": "urn:miot-spec-v2:action:stop-stream:00002822:chuangmi-ipc013:1",
                        "description": "Stop Camera Stream",
                        "in": [],
                        "out": []
                }]
        }]
}


回复

使用道具 举报

21

主题

271

帖子

3361

积分

论坛元老

Rank: 8Rank: 8

积分
3361
金钱
3085
HASS币
30
发表于 2021-1-24 21:13:09 | 显示全部楼层
本帖最后由 MX10085 于 2021-1-24 21:17 编辑

实体出来了,获取不了数据呢?楼主帮看看那里写错了?

QQ截图20210124210848.png

QQ截图20210124211019.png

QQ截图20210124210927.png

QQ截图20210124211507.png

回复

使用道具 举报

9

主题

360

帖子

1190

积分

金牌会员

Rank: 6Rank: 6

积分
1190
金钱
830
HASS币
0
发表于 2021-1-24 21:11:31 | 显示全部楼层
ModuleNotFoundError: No module named 'custom_components.xiaomi_miot_raw.camera'

请输入设备model:chuangmi.camera.ipc013
已发现以下设备
--------------------------------------
序号                model                   urn
1        chuangmi.camera.ipc013d        urn:miot-spec-v2:device:camera:0000A01C:chuangmi-ipc013d:1
2        chuangmi.camera.ipc013        urn:miot-spec-v2:device:camera:0000A01C:chuangmi-ipc013:1
请确认哪个是你的设备,输入序号:2
设备描述:Camera
设备属性:

siid 1: Device Information

   piid 1: Device Manufacturer 可读取
      数据类型:string
   piid 2: Device Model 可读取
      数据类型:string
   piid 3: Device Serial Number 可读取
      数据类型:string
   piid 4: Current Firmware Version 可读取
      数据类型:string

siid 2: Camera Control

   piid 1: Switch Status 可读取 可控制
      数据类型:bool
   piid 2: Image Rollover 可读取 可控制
      数据类型:uint16
      取值范围:[0, 180, 180]
   piid 3: Night Shot 可读取 可控制
      数据类型:uint8
      取值范围:
         0: Auto
         1: Off
         2: On

siid 3: P2P Stream

Traceback (most recent call last):
  File "autoconfig.py", line 58, in <module>
    deviceinfo(r)
  File "autoconfig.py", line 12, in deviceinfo
    for p in s['properties']:
KeyError: 'properties'
回复

使用道具 举报

21

主题

271

帖子

3361

积分

论坛元老

Rank: 8Rank: 8

积分
3361
金钱
3085
HASS币
30
发表于 2021-1-24 20:01:28 | 显示全部楼层
27hh 发表于 2021-1-24 19:45
空调伴侣已经有现成的插件了,净水器不知道你需要什么功能,可以通过传感器和开关接入;扫地机后期会支持 ...

原有空调伴侣插件在用,还想统一用moit接入控制呢。

我的扫地机 ,
NAME:  viomi Alpha 1A
MODEL:  viomi.vacuum.v17
回复

使用道具 举报

32

主题

986

帖子

4233

积分

论坛元老

Rank: 8Rank: 8

积分
4233
金钱
3207
HASS币
110

教程狂人论坛风云人物

 楼主| 发表于 2021-1-24 19:47:23 | 显示全部楼层
xeyesen 发表于 2021-1-24 14:35
gosund cp1能接入了?

gosund cp1从这个插件发布之起就支持
回复

使用道具 举报

32

主题

986

帖子

4233

积分

论坛元老

Rank: 8Rank: 8

积分
4233
金钱
3207
HASS币
110

教程狂人论坛风云人物

 楼主| 发表于 2021-1-24 19:46:55 | 显示全部楼层
dscao 发表于 2021-1-24 14:28
刚刚试了,问题是新版本数据内容进行了加密,date部分拿不到,ios没办法安装老版本的米家。其它的几个参 ...

ios可以安装旧版app的,同样是抓包,教程一搜就有了,我在用的版本是5.1.1,这个版本支持新设备而且没有加密
回复

使用道具 举报

32

主题

986

帖子

4233

积分

论坛元老

Rank: 8Rank: 8

积分
4233
金钱
3207
HASS币
110

教程狂人论坛风云人物

 楼主| 发表于 2021-1-24 19:45:27 | 显示全部楼层
MX10085 发表于 2021-1-24 15:04
空调伴侣,净水器,扫地机这些怎么配置?

空调伴侣已经有现成的插件了,净水器不知道你需要什么功能,可以通过传感器和开关接入;扫地机后期会支持,告诉我你的扫地机型号
回复

使用道具 举报

0

主题

11

帖子

172

积分

注册会员

Rank: 2

积分
172
金钱
161
HASS币
0
发表于 2021-1-24 16:15:56 | 显示全部楼层
小米洗衣机可以接入吗
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-25 13:53 , Processed in 0.079844 second(s), 33 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表