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

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

[技术探讨] 多模网关接入HA后,智能开关识别成灯,怎么解决啊!

[复制链接]

6

主题

46

帖子

269

积分

中级会员

Rank: 3Rank: 3

积分
269
金钱
223
HASS币
0
 楼主| 发表于 2020-12-23 10:14:51 | 显示全部楼层
hellkun 发表于 2020-12-23 08:40
大致上就是这样,思路上倒是挺简单的

但是因为改到了他原有代码里bluetooth core里关于状态查询后的分发 ...

可以添加PTX三键开关的支持吗?我看代码了只有一个两键的?
回复

使用道具 举报

0

主题

92

帖子

1611

积分

金牌会员

Rank: 6Rank: 6

积分
1611
金钱
1519
HASS币
0
发表于 2020-12-23 11:05:37 | 显示全部楼层
xf_hfg 发表于 2020-12-23 10:14
可以添加PTX三键开关的支持吗?我看代码了只有一个两键的?

主要是我没有PTX三键的硬件。。
如果你那边方便的话可以截一下debug日志,我可以加进去
回复

使用道具 举报

9

主题

382

帖子

3702

积分

论坛元老

Rank: 8Rank: 8

积分
3702
金钱
3320
HASS币
0
发表于 2020-12-23 13:43:50 | 显示全部楼层
hellkun 发表于 2020-12-23 08:40
大致上就是这样,思路上倒是挺简单的

但是因为改到了他原有代码里bluetooth core里关于状态查询后的分发 ...

您好,我合并了您的代码之后,双键开关还是只能识别左键
回复

使用道具 举报

6

主题

46

帖子

269

积分

中级会员

Rank: 3Rank: 3

积分
269
金钱
223
HASS币
0
 楼主| 发表于 2020-12-23 13:59:22 | 显示全部楼层
hellkun 发表于 2020-12-23 11:05
主要是我没有PTX三键的硬件。。
如果你那边方便的话可以截一下debug日志,我可以加进去 ...

debug日志里显示三开的model是2093,具体型号PTX-TK3/M
回复

使用道具 举报

1

主题

50

帖子

331

积分

论坛分享达人

积分
331
金钱
281
HASS币
0
发表于 2020-12-23 14:11:48 | 显示全部楼层
我的也是
虽然说你可以强行给他改过来属性
但是我这种是最简单的开关,只有开和关的状态
对于那些三开关的大概就要等大神适配了
回复

使用道具 举报

0

主题

92

帖子

1611

积分

金牌会员

Rank: 6Rank: 6

积分
1611
金钱
1519
HASS币
0
发表于 2020-12-23 14:17:23 | 显示全部楼层
xf_hfg 发表于 2020-12-23 13:59
debug日志里显示三开的model是2093,具体型号PTX-TK3/M

另外还需要第三个按键的piid和siid
你可以三个键分别按一下,然后在日志中以properties_changed为关键字搜索,把log直接发上来就好了,我回头加进去
回复

使用道具 举报

0

主题

92

帖子

1611

积分

金牌会员

Rank: 6Rank: 6

积分
1611
金钱
1519
HASS币
0
发表于 2020-12-23 14:20:20 | 显示全部楼层
zhizhi1991 发表于 2020-12-23 13:43
您好,我合并了您的代码之后,双键开关还是只能识别左键

麻烦看下debug日志,估计可能是我没加上你的那个型号(因为我没有。。。)
回复

使用道具 举报

6

主题

46

帖子

269

积分

中级会员

Rank: 3Rank: 3

积分
269
金钱
223
HASS币
0
 楼主| 发表于 2020-12-23 15:00:38 | 显示全部楼层
本帖最后由 xf_hfg 于 2020-12-23 15:29 编辑
hellkun 发表于 2020-12-23 14:17
另外还需要第三个按键的piid和siid
你可以三个键分别按一下,然后在日志中以properties_changed为关键字 ...

大神,没有找到properties_changed的关键字。。。是不是与没有识别成开关有关,只找到一个pull mesh的事件,不知道是不是这个。。。
DEBUG (Thread-9) [custom_components.xiaomi_gateway3.core.gateway3] 192.168.1.87 | Pull Mesh [{'did': '1041965416', 'siid': 2, 'piid': 1, 'code': -4004}, {'did': '1041943383', 'siid': 2, 'piid': 1, 'code': -4004}, {'did': '1041965419', 'siid': 2, 'piid': 1, 'code': -4004}, {'did': '1042085551', 'siid': 2, 'piid': 1, 'value': True, 'code': 0}, {'did': '1041960010', 'siid': 2, 'piid': 1, 'value': False, 'code': 0}, {'did': '1042086186', 'siid': 2, 'piid': 1, 'value': False, 'code': 0}, {'did': '1042085551', 'siid': 2, 'piid': 2, 'value': 65535, 'code': 0, 'ts': 1608614493, 'ret': 0}, {'did': '1042085551', 'siid': 2, 'piid': 3, 'value': 4000, 'code': 0, 'ts': 1608614493, 'ret': 0}]
2020-12-23 15:21:14  DEBUG    gateway3      192.168.1.87 | [MQ] gw/842E14FFFEC16FEF/heartbeat {"networkUp":true,"networkPanId":"0xBD56","radioTxPower":7,"radioChannel":25}2020-12-23 15:21:14  DEBUG    gateway3      192.168.1.87 | gateway <= {'networkUp': True, 'networkPanId': '0xBD56', 'radioTxPower': 7, 'radioChannel': 25}2020-12-23 15:21:15  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.079 [D] otu: {"id":897478931,"method":"get_properties","params":[{"did":"1041965416","siid":2,"piid":1},{"did":"1041943383","siid":2,"piid":1},{"did":"1041965419","siid":2,"piid":1},{"did":"1042085551","siid":2,"piid":1},{"did":"1041960010","siid":2,"piid":1},{"did":"1042086186","siid":2,"piid":1}]}.2020-12-23 15:21:15  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.079 [D] otu: {"id":897478931,"method":"get_properties","params":[{"did":"1041965416","siid":2,"piid":1},{"did":"1041943383","siid":2,"piid":1},{"did":"1041965419","siid":2,"piid":1},{"did":"1042085551","siid":2,"piid":1},{"did":"1041960010","siid":2,"piid":1},{"did":"1042086186","siid":2,"piid":1}]}.\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.183 [D] miio_client_func: ot_agent_recv_handler_one(): fd:9, msg:{"method":"local.query_status","params":"","id":24083} length:54 bytes2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.183 [D] miio_client_func: ot_agent_recv_handler_one(): fd:9, msg:{"method":"local.query_status","params":"","id":24083} length:54 bytes\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.183 [I] internal: handle_local_msg_state:{"id":24083,"method":"local.status","params":"cloud_connected"}2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.183 [I] internal: handle_local_msg_state:{"id":24083,"method":"local.status","params":"cloud_connected"}\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.184 [D] miio_client_func: method_local_broadcast_msg(), {"id":897478931,"method":"get_properties","params":[{"did":"1041965416","siid":2,"piid":1},{"did":"1041943383","siid":2,"piid":1},{"did":"1041965419","siid":2,"piid":1},{"did":"1042085551","siid":2,"piid":1},{"did":"1041960010","siid":2,"piid":1},{"did":"1042086186","siid":2,"piid":1}]}2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.184 [D] miio_client_func: method_local_broadcast_msg(), {"id":897478931,"method":"get_properties","params":[{"did":"1041965416","siid":2,"piid":1},{"did":"1041943383","siid":2,"piid":1},{"did":"1041965419","siid":2,"piid":1},{"did":"1042085551","siid":2,"piid":1},{"did":"1041960010","siid":2,"piid":1},{"did":"1042086186","siid":2,"piid":1}]}\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.184 [D] miio_client_func: 9, msg: {"id":897478931,"method":"get_properties","params":[{"did":"1041965416","siid":2,"piid":1},{"did":"1041943383","siid":2,"piid":1},{"did":"1041965419","siid":2,"piid":1},{"did":"1042085551","siid":2,"piid":1},{"did":"1041960010","siid":2,"piid":1},{"did":"1042086186","siid":2,"piid":1}]},  len:2872020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.184 [D] miio_client_func: 9, msg: {"id":897478931,"method":"get_properties","params":[{"did":"1041965416","siid":2,"piid":1},{"did":"1041943383","siid":2,"piid":1},{"did":"1041965419","siid":2,"piid":1},{"did":"1042085551","siid":2,"piid":1},{"did":"1041960010","siid":2,"piid":1},{"did":"1042086186","siid":2,"piid":1}]},  len:287\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.191 [D] miio_client_func: ot_agent_recv_handler_one(): fd:9, msg:{"id":897478931,"result":[{"did":"1041965416","siid":2,"piid":1,"code":-4004},{"did":"1041943383","siid":2,"piid":1,"code":-4004},{"did":"1041965419","siid":2,"piid":1,"code":-4004},{"did":"1042085551","siid":2,"piid":1,"value":true,"code":0},{"did":"1041960010","siid":2,"piid":1,"value":false,"code":0},{"did":"1042086186","siid":2,"piid":1,"value":false,"code":0}]} length:368 bytes2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.191 [D] miio_client_func: ot_agent_recv_handler_one(): fd:9, msg:{"id":897478931,"result":[{"did":"1041965416","siid":2,"piid":1,"code":-4004},{"did":"1041943383","siid":2,"piid":1,"code":-4004},{"did":"1041965419","siid":2,"piid":1,"code":-4004},{"did":"1042085551","siid":2,"piid":1,"value":true,"code":0},{"did":"1041960010","siid":2,"piid":1,"value":false,"code":0},{"did":"1042086186","siid":2,"piid":1,"value":false,"code":0}]} length:368 bytes\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.193 [D] miio_client_func: handle_command_ack_msg: {"id":897478931,"result":[{"did":"1041965416","siid":2,"piid":1,"code":-4004},{"did":"1041943383","siid":2,"piid":1,"code":-4004},{"did":"1041965419","siid":2,"piid":1,"code":-4004},{"did":"1042085551","siid":2,"piid":1,"value":true,"code":0},{"did":"1041960010","siid":2,"piid":1,"value":false,"code":0},{"did":"1042086186","siid":2,"piid":1,"value":false,"code":0}]}2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.193 [D] miio_client_func: handle_command_ack_msg: {"id":897478931,"result":[{"did":"1041965416","siid":2,"piid":1,"code":-4004},{"did":"1041943383","siid":2,"piid":1,"code":-4004},{"did":"1041965419","siid":2,"piid":1,"code":-4004},{"did":"1042085551","siid":2,"piid":1,"value":true,"code":0},{"did":"1041960010","siid":2,"piid":1,"value":false,"code":0},{"did":"1042086186","siid":2,"piid":1,"value":false,"code":0}]}\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.285 [D] otu: otu_down_rpc_delegate_ack(), 324, ack: {"id":897478931,"result":[{"did":"1041965416","siid":2,"piid":1,"code":-4004},{"did":"1041943383","siid":2,"piid":1,"code":-4004},{"did":"1041965419","siid":2,"piid":1,"code":-4004},{"did":"1042085551","siid":2,"piid":1,"value":true,"code":0},{"did":"1041960010","siid":2,"piid":1,"value":false,"code":0},{"did":"1042086186","siid":2,"piid":1,"value":false,"code":0}],"exe_time":113}, len: 3832020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.285 [D] otu: otu_down_rpc_delegate_ack(), 324, ack: {"id":897478931,"result":[{"did":"1041965416","siid":2,"piid":1,"code":-4004},{"did":"1041943383","siid":2,"piid":1,"code":-4004},{"did":"1041965419","siid":2,"piid":1,"code":-4004},{"did":"1042085551","siid":2,"piid":1,"value":true,"code":0},{"did":"1041960010","siid":2,"piid":1,"value":false,"code":0},{"did":"1042086186","siid":2,"piid":1,"value":false,"code":0}],"exe_time":113}, len: 383\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.289 [D] otu: {"id":823703807,"method":"get_properties","params":[{"did":"1042085551","siid":2,"piid":2},{"did":"1042085551","siid":2,"piid":3}]}.2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.289 [D] otu: {"id":823703807,"method":"get_properties","params":[{"did":"1042085551","siid":2,"piid":2},{"did":"1042085551","siid":2,"piid":3}]}.\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.422 [D] miio_client_func: method_local_broadcast_msg(), {"id":823703807,"method":"get_properties","params":[{"did":"1042085551","siid":2,"piid":2},{"did":"1042085551","siid":2,"piid":3}]}2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.422 [D] miio_client_func: method_local_broadcast_msg(), {"id":823703807,"method":"get_properties","params":[{"did":"1042085551","siid":2,"piid":2},{"did":"1042085551","siid":2,"piid":3}]}\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.424 [D] miio_client_func: 9, msg: {"id":823703807,"method":"get_properties","params":[{"did":"1042085551","siid":2,"piid":2},{"did":"1042085551","siid":2,"piid":3}]},  len:1312020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.424 [D] miio_client_func: 9, msg: {"id":823703807,"method":"get_properties","params":[{"did":"1042085551","siid":2,"piid":2},{"did":"1042085551","siid":2,"piid":3}]},  len:131\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.429 [D] miio_client_func: ot_agent_recv_handler_one(): fd:9, msg:{"id":823703807,"result":[{"did":"1042085551","siid":2,"piid":2,"value":65535,"code":0,"ts":1608614493,"ret":0},{"did":"1042085551","siid":2,"piid":3,"value":4000,"code":0,"ts":1608614493,"ret":0}]} length:198 bytes2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.429 [D] miio_client_func: ot_agent_recv_handler_one(): fd:9, msg:{"id":823703807,"result":[{"did":"1042085551","siid":2,"piid":2,"value":65535,"code":0,"ts":1608614493,"ret":0},{"did":"1042085551","siid":2,"piid":3,"value":4000,"code":0,"ts":1608614493,"ret":0}]} length:198 bytes\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.431 [D] miio_client_func: handle_command_ack_msg: {"id":823703807,"result":[{"did":"1042085551","siid":2,"piid":2,"value":65535,"code":0,"ts":1608614493,"ret":0},{"did":"1042085551","siid":2,"piid":3,"value":4000,"code":0,"ts":1608614493,"ret":0}]}2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.431 [D] miio_client_func: handle_command_ack_msg: {"id":823703807,"result":[{"did":"1042085551","siid":2,"piid":2,"value":65535,"code":0,"ts":1608614493,"ret":0},{"did":"1042085551","siid":2,"piid":3,"value":4000,"code":0,"ts":1608614493,"ret":0}]}\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | Pull Mesh [{'did': '1041965416', 'siid': 2, 'piid': 1, 'code': -4004}, {'did': '1041943383', 'siid': 2, 'piid': 1, 'code': -4004}, {'did': '1041965419', 'siid': 2, 'piid': 1, 'code': -4004}, {'did': '1042085551', 'siid': 2, 'piid': 1, 'value': True, 'code': 0}, {'did': '1041960010', 'siid': 2, 'piid': 1, 'value': False, 'code': 0}, {'did': '1042086186', 'siid': 2, 'piid': 1, 'value': False, 'code': 0}, {'did': '1042085551', 'siid': 2, 'piid': 2, 'value': 65535, 'code': 0, 'ts': 1608614493, 'ret': 0}, {'did': '1042085551', 'siid': 2, 'piid': 3, 'value': 4000, 'code': 0, 'ts': 1608614493, 'ret': 0}]2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:14.512 [D] otu: otu_down_rpc_delegate_ack(), 324, ack: {"id":823703807,"result":[{"did":"1042085551","siid":2,"piid":2,"value":65535,"code":0,"ts":1608614493,"ret":0},{"did":"1042085551","siid":2,"piid":3,"value":4000,"code":0,"ts":1608614493,"ret":0}],"exe_time":110}, len: 2132020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:14.512 [D] otu: otu_down_rpc_delegate_ack(), 324, ack: {"id":823703807,"result":[{"did":"1042085551","siid":2,"piid":2,"value":65535,"code":0,"ts":1608614493,"ret":0},{"did":"1042085551","siid":2,"piid":3,"value":4000,"code":0,"ts":1608614493,"ret":0}],"exe_time":110}, len: 213\x1b[0m'2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MQ] log/miio 2020:12:23:15:21:15.733 [D] ots: ots_up_rpc_delegate_out_cb(), 289, {"id":821232714,"method":"_otc.pull_ip_list","params":{}}2020-12-23 15:21:16  DEBUG    gateway3      192.168.1.87 | [MI] b'\x1b[0;32m2020:12:23:15:21:15.733 [D] ots: ots_up_rpc_delegate_out_cb(), 289, {"id":821232714,"method":"_otc.pull_ip_list","params":{}}\x1b[0m'
回复

使用道具 举报

9

主题

382

帖子

3702

积分

论坛元老

Rank: 8Rank: 8

积分
3702
金钱
3320
HASS币
0
发表于 2020-12-23 15:33:09 | 显示全部楼层
hellkun 发表于 2020-12-23 14:20
麻烦看下debug日志,估计可能是我没加上你的那个型号(因为我没有。。。)
...

尴尬了~HA的log找不到网关的debug日志
回复

使用道具 举报

6

主题

46

帖子

269

积分

中级会员

Rank: 3Rank: 3

积分
269
金钱
223
HASS币
0
 楼主| 发表于 2020-12-23 15:39:44 | 显示全部楼层
这三个就是三开的蓝牙mesh开关:
Setup Mesh device {'did': '1041965416', 'mac': '28D127376ADA', 'model': 2093, 'type': 'mesh', 'device_name': 'Mesh', 'device_model': 2093}
2020-12-23 15:20:42  DEBUG    gateway3      192.168.1.87 | Setup Mesh device {'did': '1041943383', 'mac': '28D127246A93', 'model': 2093, 'type': 'mesh', 'device_name': 'Mesh', 'device_model': 2093}
2020-12-23 15:20:42  DEBUG    gateway3      192.168.1.87 | Setup Mesh device {'did': '1041965419', 'mac': '28D127376451', 'model': 2093, 'type': 'mesh', 'device_name': 'Mesh', 'device_model': 2093}
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-27 00:32 , Processed in 0.054792 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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