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

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

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

  [复制链接]

0

主题

23

帖子

523

积分

高级会员

Rank: 4

积分
523
金钱
500
HASS币
0
发表于 2021-1-25 11:58:28 | 显示全部楼层
小米空调C1可以加入实体,显示不用
xiaomi.aircondition.ma2


Logger: custom_components.xiaomi_miot
Source: custom_components/xiaomi_miot/__init__.py:343
Integration: Xiaomi Miot (documentation, issues)
First occurred: 上午11:23:46 (101 occurrences)
Last logged: 上午11:56:56

Got exception while fetching the state for None: {'code': -9999, 'message': 'user ack timeout'}
Got exception while fetching the state for sensor.xiaomi_miot_environment: {'code': -9999, 'message': 'user ack timeout'}
Got exception while fetching the state for climate.xiaomi_miot_air_conditioner: {'code': -9999, 'message': 'user ack timeout'}
回复

使用道具 举报

1

主题

71

帖子

342

积分

中级会员

Rank: 3Rank: 3

积分
342
金钱
271
HASS币
0
发表于 2021-1-25 11:02:35 | 显示全部楼层
本帖最后由 blobman 于 2021-1-25 11:23 编辑

实体注册成功了,但是现实不可用


Logger: custom_components.xiaomi_miot
Source: custom_components/xiaomi_miot/__init__.py:343
Integration: Xiaomi Miot (documentation, issues)
First occurred: 上午9:51:04 (71 occurrences)
Last logged: 上午10:26:05

Got exception while fetching the state for None: Unable to recover failed command
Got exception while fetching the state for switch.ke_ting_tai_deng_chuangmi_plug_m3_switch: Unable to recover failed command


提了个issue:https://github.com/al-one/hass-xiaomi-miot/issues/6
回复

使用道具 举报

6

主题

267

帖子

2377

积分

论坛技术达人

积分
2377
金钱
2090
HASS币
90
 楼主| 发表于 2021-1-25 01:12:51 来自手机 | 显示全部楼层
tiger81 发表于 2021-1-24 21:39
INFO:miio.cliebug mode active
Running command raw_command
DEBUG:miio.protocol:Unable to decrypt, r ...

不是有spec_type就一定支持miot-spec。或者也有可能python-miio不知道你的miot设备
回复

使用道具 举报

9

主题

360

帖子

1190

积分

金牌会员

Rank: 6Rank: 6

积分
1190
金钱
830
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
不支持我的米家小白青春版摄像头,这个摄像头一直无解。希望楼主能支持,谢谢!
回复

使用道具 举报

6

主题

267

帖子

2377

积分

论坛技术达人

积分
2377
金钱
2090
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

帖子

2168

积分

金牌会员

Rank: 6Rank: 6

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

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

使用道具 举报

9

主题

360

帖子

1190

积分

金牌会员

Rank: 6Rank: 6

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

使用道具 举报

6

主题

267

帖子

2377

积分

论坛技术达人

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

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

使用道具 举报

6

主题

77

帖子

764

积分

高级会员

Rank: 4

积分
764
金钱
687
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调试助手里所有设备均可正常获取,是不是因为需要从小米云端读取信息?

回复

使用道具 举报

6

主题

267

帖子

2377

积分

论坛技术达人

积分
2377
金钱
2090
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
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-12 02:03 , Processed in 0.054646 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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