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

 找回密码
 立即注册
楼主: anlong

[插件集成] 小米MIoT设备自动识别接入HA插件 2024-04-30新版发布

  [复制链接]

9

主题

360

帖子

1192

积分

金牌会员

Rank: 6Rank: 6

积分
1192
金钱
832
HASS币
0
发表于 2021-1-24 21:39:21 | 显示全部楼层
本帖最后由 tiger81 于 2021-1-24 21:40 编辑

INFO:miio.cliebug mode active
Running command raw_command
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.miioprotocol:Got a response: Container:
    data = Container:
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container:
        data = b'!1\x00 \x00\x00\x00\x00\x04\x8d\xf2\x04`\rw\xe9' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('048df204')
            ts = 2021-01-24 13:36:41
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
DEBUG:miio.miioprotocoliscovered 048df204 with ts: 2021-01-24 13:36:41, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.0.162:54321 >>: {'id': 1, 'method': 'get_properties', 'params': [{'did': 'result', 'siid': 2, 'piid': 1}]}
DEBUG:miio.miioprotocol:Retrying with incremented id, retries left: 3
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.miioprotocol:Got a response: Container:
    data = Container:
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container:
        data = b'!1\x00 \x00\x00\x00\x00\x04\x8d\xf2\x04`\rw\xee' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('048df204')
            ts = 2021-01-24 13:36:46
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
DEBUG:miio.miioprotocoliscovered 048df204 with ts: 2021-01-24 13:36:46, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.0.162:54321 >>: {'id': 102, 'method': 'get_properties', 'params': [{'did': 'result', 'siid': 2, 'piid': 1}]}
DEBUG:miio.miioprotocol:Retrying with incremented id, retries left: 2
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.miioprotocol:Got a response: Container:
    data = Container:
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container:
        data = b'!1\x00 \x00\x00\x00\x00\x04\x8d\xf2\x04`\rw\xf3' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('048df204')
            ts = 2021-01-24 13:36:51
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
DEBUG:miio.miioprotocoliscovered 048df204 with ts: 2021-01-24 13:36:51, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.0.162:54321 >>: {'id': 203, 'method': 'get_properties', 'params': [{'did': 'result', 'siid': 2, 'piid': 1}]}
DEBUG:miio.miioprotocol:Retrying with incremented id, retries left: 1
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.miioprotocol:Got a response: Container:
    data = Container:
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container:
        data = b'!1\x00 \x00\x00\x00\x00\x04\x8d\xf2\x04`\rw\xf8' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('048df204')
            ts = 2021-01-24 13:36:56
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
DEBUG:miio.miioprotocoliscovered 048df204 with ts: 2021-01-24 13:36:56, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.0.162:54321 >>: {'id': 304, 'method': 'get_properties', 'params': [{'did': 'result', 'siid': 2, 'piid': 1}]}
ERROR:miio.miioprotocol:Got error when receiving: timed out
DEBUG:miio.click_common:Exception: No response from the device
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 192, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 192, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 192, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 192, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/miio/click_common.py", line 280, in wrap
    kwargs["result"] = func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/miio/click_common.py", line 245, in command_callback
    return miio_command.call(miio_device, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/miio/click_common.py", line 193, in call
    return method(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/miio/device.py", line 162, in raw_command
    return self.send(command, parameters)
  File "/usr/local/lib/python3.8/site-packages/miio/device.py", line 143, in send
    return self._protocol.send(
  File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 232, in send
    return self.send(
  File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 232, in send
    return self.send(
  File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 232, in send
    return self.send(
  File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 240, in send
    raise DeviceException("No response from the device") from ex
miio.exceptions.DeviceException: No response from the device
Error: No response from the device


{
        "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": []
                }]
        }]
}

Model: chuangmi.camera.ipc013
不支持我的米家小白青春版摄像头,这个摄像头一直无解。希望楼主能支持,谢谢!
回复

使用道具 举报

7

主题

275

帖子

2460

积分

论坛技术达人

积分
2460
金钱
2165
HASS币
90
 楼主| 发表于 2021-1-24 21:09:12 | 显示全部楼层
cxq19880310 发表于 2021-1-23 13:18
https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:curtain:0000A00C:syniot-syc ...
miiocli -d device --ip 192.168.lan.ip --token xxxxxx raw_command get_properties "[{'did': 'result', 'siid': 2, 'piid': 2}]"


miiocli测试了吗
小米MIoT插件:miot-spec.com
回复

使用道具 举报

0

主题

56

帖子

2518

积分

金牌会员

Rank: 6Rank: 6

积分
2518
金钱
2462
HASS币
0
发表于 2021-1-24 19:09:14 | 显示全部楼层
cxq19880310 发表于 2021-1-23 10:05
MODEL: syniot.curtain.syc1  这个类型的米家卷帘电机不支持,找不到实体,麻烦看一下,别的都找到实体了 ...

我也是这个型号的窗帘电机,一直没有办法接入,想换成绿米的算了
回复

使用道具 举报

9

主题

360

帖子

1192

积分

金牌会员

Rank: 6Rank: 6

积分
1192
金钱
832
HASS币
0
发表于 2021-1-24 18:00:57 | 显示全部楼层
mark一下,膜拜!!!
回复

使用道具 举报

7

主题

275

帖子

2460

积分

论坛技术达人

积分
2460
金钱
2165
HASS币
90
 楼主| 发表于 2021-1-24 15:47:35 来自手机 | 显示全部楼层
shanonline 发表于 2021-1-24 13:55
大佬,现在实体已经有了,但是实体显示不可用,报错信息{'code': -9999, 'message': 'user ack timeout'} ...

我有个晾衣机也是这样。可能是python-miio对其不兼容
回复

使用道具 举报

6

主题

78

帖子

766

积分

高级会员

Rank: 4

积分
766
金钱
688
HASS币
0
发表于 2021-1-24 13:55:32 | 显示全部楼层
本帖最后由 shanonline 于 2021-1-24 14:50 编辑
anlong 发表于 2021-1-24 13:41
最新提交已修复

大佬,现在实体已经有了,但是实体显示不可用,报错信息{'code': -9999, 'message': 'user ack timeout'},是不是还是适配的问题

补充:尝试了论坛另一位大佬的miot_raw插件,配置siid和piid以后报错相同,在小米的miot调试助手里所有设备均可正常获取,是不是因为需要从小米云端读取信息?

回复

使用道具 举报

7

主题

275

帖子

2460

积分

论坛技术达人

积分
2460
金钱
2165
HASS币
90
 楼主| 发表于 2021-1-24 13:41:49 | 显示全部楼层
shanonline 发表于 2021-1-24 01:43
添加小米电饭锅后无实体,日志如下:
Traceback (most recent call last):
  File "/usr/src/homeassistant ...

最新提交已修复
小米MIoT插件:miot-spec.com
回复

使用道具 举报

7

主题

275

帖子

2460

积分

论坛技术达人

积分
2460
金钱
2165
HASS币
90
 楼主| 发表于 2021-1-24 12:37:23 来自手机 | 显示全部楼层
telanx 发表于 2021-1-24 12:06
对了,大佬,请问一下。
yeelight很多设备都是属于MIOT的范畴,比如凉霸,烁影风扇灯,那如果用您这个自动 ...

是的,miio_yeelink后续只做旧版miio协议的适配。
回复

使用道具 举报

15

主题

636

帖子

2205

积分

金牌会员

Rank: 6Rank: 6

积分
2205
金钱
1569
HASS币
0
发表于 2021-1-24 12:06:55 | 显示全部楼层
对了,大佬,请问一下。
yeelight很多设备都是属于MIOT的范畴,比如凉霸,烁影风扇灯,那如果用您这个自动的插件就可以控制的话,那就可以不用您之前的yeelight插件了吧?
感谢大佬。
回复

使用道具 举报

6

主题

78

帖子

766

积分

高级会员

Rank: 4

积分
766
金钱
688
HASS币
0
发表于 2021-1-24 01:43:43 | 显示全部楼层
添加小米电饭锅后无实体,日志如下:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 199, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/xiaomi_miot/sensor.py", line 38, in async_setup_entry
    await async_setup_platform(hass, config, async_add_entities)
  File "/config/custom_components/xiaomi_miot/sensor.py", line 65, in async_setup_platform
    entities.append(MiotSensorEntity(cfg, srv))
  File "/config/custom_components/xiaomi_miot/sensor.py", line 85, in __init__
    mapping.update(miot_service.mapping())
AttributeError: 'NoneType' object has no attribute 'update'

型号chunmi.cooker.eh402
token和ip地址均确认正确
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2025-2-23 14:13 , Processed in 0.238553 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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