GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bitengine-hub-zigbee-ncp/ncp_stress.py at main · bitEngineTech/bitengine-hub-zigbee-ncp

Expand file tree

/

ncp_stress.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
395 lines (357 loc) · 21.4 KB
/

ncp_stress.py

Copy path

File metadata and controls

395 lines (357 loc) · 21.4 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
#!/usr/bin/env python3
"""NCP 在途单播压测:ZHA 并发给到 32 之后,NCP 侧扛不扛得住(2026-10-06)。
为什么有它:XNCP 声明 CHIP_INFO 后,bellows 把 ZHA 并发从 8 给到 32(mg24/README.md「NCP 表容量」)。
现网只有两个电池终端,ZHA 自己永远发不出 32 个在途请求,所以靠这个脚本合成:照 ZHA 握手
(bellows 0.49.0:connect → write_config → networkInit)把 NCP 拉起来,对**直连协调器的休眠终端**
并发发 N 条单播,记录:
- sendUnicast 返回码与每条 EZSP 命令的服务时间
- messageSentHandler 状态 / 时延 / 缺失 / 重复 / 意外 tag
- 包缓冲堆空闲(getValue VALUE_FREE_BUFFERS)最低点 → 每条在途消息占多少字节 → 容量投影
- readCounters 差分(缓冲分配失败 / 路由发现 / APS 广播 / ASH 错误 …)
- NCP 有没有复位(unexpected reset 回调 + BOOT_COUNTER / ANALYSIS_REBOOT 令牌前后对比)
判据(全部满足才 exit 0):每档 sendUnicast 全 OK、回调一一对上、MUST_ZERO 计数不涨、堆最低 ≥ 4096 且
跑完回基线、没复位、子设备都还在;另按"带重试"档实测的每条字节数,堆在 4096 地板之上要装得下 112 条
(并发 32 时 NCP 侧最坏在途:bellows 对终端 8 s 就放槽,而 NCP 对休眠子设备 APS 重试约 28 s 才回失败)。
10-06 实测(扩容版 NCP fec8b323,两个直连电池终端):8 / 32 / 64 条 × 不带 / 带 APS 重试全过;
64 条在途时堆 16364 → 最低 12728、每条约 57 B、跑完回基线;容量投影 185 ≥ 112;零分配失败、零复位。
起网后十几秒内协议栈自己会发 APS 广播(推断是 R21 的 Parent_annce;两轮预检各 +1),只落在预检,不计判据。
⚠️ 安全边界:不发广播/组播、不发给子设备表之外的地址、APS 选项只有 NONE 或 RETRY(不开路由发现、
不开地址发现)、不调 set_extended_timeout(bellows 的实现会改写地址表)、不改任何网络参数、
不调 xncp_get_tx_power_info(它在我们的 NCP 里会把国家锁存进 NVM3)。
载荷只有两种只读请求:ZCL Basic.ZCLVersion 读属性、ZDO Node_Desc_req。约 210 条,电池设备若来取会回应。
⚠️ 网关只接一个上位机:先 docker pause homeassistant,再 POST /api/v1/zigbee/clients/disconnect
{"ip":"<HA 主机 IP>"},跑完 unpause(ZHA 会报一条 Watchdog failure 然后重载重连,预期内)。
用法(venv 同 mg24/ncp_probe.py:bellows==0.49.0):
python mg24/ncp_stress.py socket://<网关IP>:6638 [--n 8,32,64] [--modes noack,ack] [--targets 0xCAF5,0xFC2C]
python mg24/ncp_stress.py --selftest # 不连任何东西:只验 API 名与帧构造
--targets 是直连协调器的休眠终端的短地址(脚本会先读子设备表,不在表里就中止)。
退出码:0 判据全过 · 1 有判据不过 · 2 中止(复位/掉网/目标不在子设备表)· 3 脚本自身出错
"""
import argparse
import asyncio
import json
import logging
import statistics
import struct
import sys
import time
import zigpy.config as zconf
import zigpy.types as zt
from bellows.ezsp import EZSP
from bellows.ezsp.xncp import FirmwareFeatures
import bellows.types as t
INDIRECT_S = 7.68 # bellows ezsp/config.py:23-26 写进 NCP 的 INDIRECT_TRANSMISSION_TIMEOUT
APS_ACK_S = 1.6 # SDK message.h:58-65:50 ms × MAX_HOPS(30) + 100 ms(推定)
WAIT = {"noack": INDIRECT_S + 2.5, "ack": 3 * (INDIRECT_S + APS_ACK_S) + 6.0}
HEAP_ABORT = 2048 # 包缓冲堆空闲低于此值立即停发
HEAP_FLOOR = 4096 # 本脚本自定的地板:MG24 包缓冲堆至少留 1/4 给协议栈自己(与 C5 那边 test_api.sh 的 4096 不是一回事)
BELLOWS_ED_TIMEOUT = 8.0 # bellows 对终端 8 s 就放槽(application.py:49-50);超过它才回的回调单独计数
WORST_INFLIGHT_32 = 112 # 并发 32 时 NCP 侧最坏在途(bellows 8 s 放槽、NCP 对休眠子设备 APS 重试约 28 s → 约 3.5×)
OK_SENT = {t.sl_Status.OK, t.sl_Status.MAC_INDIRECT_TIMEOUT,
t.sl_Status.ZIGBEE_DELIVERY_FAILED, t.sl_Status.MAC_NO_ACK_RECEIVED}
C = t.EmberCounterType
MUST_ZERO = [C.COUNTER_ALLOCATE_PACKET_BUFFER_FAILURE, C.COUNTER_ROUTE_DISCOVERY_INITIATED,
C.COUNTER_APS_DATA_TX_BROADCAST, C.COUNTER_TYPE_NWK_RETRY_OVERFLOW,
C.COUNTER_PHY_TO_MAC_QUEUE_LIMIT_REACHED, C.COUNTER_CHILD_REMOVED,
C.COUNTER_ASH_OVERFLOW_ERROR, C.COUNTER_ASH_FRAMING_ERROR, C.COUNTER_ASH_OVERRUN_ERROR]
REPORT = MUST_ZERO + [C.COUNTER_MAC_TX_BROADCAST, C.COUNTER_MAC_TX_UNICAST_SUCCESS,
C.COUNTER_MAC_TX_UNICAST_RETRY, C.COUNTER_MAC_TX_UNICAST_FAILED,
C.COUNTER_APS_DATA_TX_UNICAST_SUCCESS, C.COUNTER_APS_DATA_TX_UNICAST_RETRY,
C.COUNTER_APS_DATA_TX_UNICAST_FAILED, C.COUNTER_APS_DATA_RX_UNICAST,
C.COUNTER_UTILITY] # SDK 第 23 号是 ASH_XOFF,bellows 叫 UTILITY
class Stub:
"""EZSP(application=…):uart.reset_received/error_received → enter_failed_state → 这里。"""
def __init__(self):
self.failures = []
def connection_lost(self, exc):
self.failures.append((time.monotonic(), repr(exc)))
def payload(kind, tsn, nwk):
"""两种只读请求。返回 (EmberApsFrame 的非选项字段, 载荷)。"""
if kind == "zcl": # ZCL 全局 Read Attributes:Basic(0x0000).ZCLVersion(0x0000),ep1→ep1
return (0x0104, 0x0000, 1, 1), bytes([0x00, tsn, 0x00, 0x00, 0x00])
# ZDO Node_Desc_req(0x0002):TSN + NWKAddrOfInterest(就是目标自己)
return (0x0000, 0x0002, 0, 0), bytes([tsn]) + int(nwk).to_bytes(2, "little")
def aps_frame(fields, tsn, mode):
prof, clus, sep, dep = fields
opt = t.EmberApsOption.APS_OPTION_RETRY if mode == "ack" else t.EmberApsOption.APS_OPTION_NONE
return t.EmberApsFrame(profileId=prof, clusterId=clus, sourceEndpoint=sep,
destinationEndpoint=dep, options=opt, groupId=0, sequence=tsn)
async def free_heap(ezsp):
st, v = await ezsp.getValue(valueId=t.EzspValueId.VALUE_FREE_BUFFERS) # 优先级 999,插队
return int.from_bytes(v, "little") if t.sl_Status.from_ember_status(st) == t.sl_Status.OK else None
async def token_u16(ezsp, key):
rsp = await ezsp.getTokenData(token=key, index=0)
d = bytes(rsp.value) if t.sl_Status.from_ember_status(rsp.status) == t.sl_Status.OK else b""
return struct.unpack_from("<H", d)[0] if len(d) >= 2 else None
async def child_table(ezsp, size=32):
out = {}
for i in range(size):
st, cd = await ezsp.getChildData(index=i)
if t.sl_Status.from_ember_status(st) == t.sl_Status.OK:
out[int(cd.id)] = cd
return out
def pct(xs, q):
return round(statistics.quantiles(xs, n=100)[q - 1], 3) if len(xs) >= 2 else (xs[0] if xs else None)
class Session:
def __init__(self, ezsp, stub, euis=None, faithful=False):
self.ezsp, self.stub = ezsp, stub
self.euis, self.faithful = euis or {}, faithful # faithful:照 ZHA 每条先 getExtendedTimeout(只读)
self.tag = 0
self.inflight = {} # (nwk, tag) -> t_ok
self.done = {} # (nwk, tag) -> (status, latency)
self.dups = self.unexpected = self.rx = self.late = 0
self.expired = set() # 等待窗结束仍未回的 (nwk, tag):之后再到算 late,不算 unexpected
self.events = []
def on_cb(self, name, args):
now = time.monotonic()
if name == "messageSentHandler":
status, _mtype, nwk, _aps, tag, _msg = args
k = (int(nwk), int(tag))
if k in self.done:
self.dups += 1
elif k in self.inflight:
self.done[k] = (t.sl_Status.from_ember_status(status), now - self.inflight.pop(k))
elif k in self.expired:
self.expired.discard(k)
self.late += 1 # 等待窗给短了(或 NCP 持有时间比推算的长)
self.events.append((round(now, 3), "late_sent", [hex(k[0]), k[1], str(status)]))
else:
self.unexpected += 1
elif name == "incomingMessageHandler":
self.rx += 1
elif name in ("stackStatusHandler", "childJoinHandler", "incomingRouteErrorHandler",
"incomingNetworkStatusHandler", "counterRolloverHandler", "pollHandler"):
self.events.append((round(now, 3), name, [str(a) for a in args]))
async def burst(self, n, mode, targets):
ezsp = self.ezsp
base_heap = await free_heap(ezsp)
c0 = await ezsp.read_counters()
stop, samples, sends = asyncio.Event(), [], []
async def sampler():
while not stop.is_set():
f = await free_heap(ezsp)
samples.append((time.monotonic(), f, len(self.inflight)))
if f is not None and f < HEAP_ABORT:
stop.set()
await asyncio.sleep(0.1)
async def one(i):
if stop.is_set():
return
self.tag = self.tag % 0xFFFE + 1
tag, tsn = self.tag, self.tag & 0xFF
nwk = targets[i % len(targets)]
fields, data = payload("zcl" if i % 2 == 0 else "zdo", tsn, nwk)
t0 = time.monotonic() # 含在协议层信号量上的排队(MAX_COMMAND_CONCURRENCY=1)
try:
if self.faithful and nwk in self.euis:
# bellows send_packet 对已知设备每条都先走 set_extended_timeout → getExtendedTimeout
# (v4/__init__.py:198-205);只读,用来量"ZHA 路径"的真实提交速率
await ezsp.getExtendedTimeout(remoteEui64=self.euis[nwk])
status, _seq = await ezsp.send_unicast(nwk=zt.NWK(nwk), aps_frame=aps_frame(fields, tsn, mode),
message_tag=tag, data=data)
status = t.sl_Status.from_ember_status(status)
except Exception as e: # noqa: BLE001 —— EZSP 命令 10 s 超时等,记下来而不是整场崩
self.events.append((round(time.monotonic(), 3), "send_exception", [repr(e)]))
status = t.sl_Status.FAIL
t1 = time.monotonic()
sends.append((status, t1 - t0))
if status == t.sl_Status.OK:
self.inflight.setdefault((nwk, tag), t1)
else:
stop.set() # 排队被拒:停发,记下门槛
# 量提交速率(--faithful)时不采样:采样命令优先级 999 会插队,系统性拉低速率
s_task = asyncio.create_task(sampler()) if not self.faithful else asyncio.create_task(asyncio.sleep(0))
t_start = time.monotonic()
# 逐条提交而不是 gather:EZSP 本来就一次只走一条命令(protocol.py MAX_COMMAND_CONCURRENCY=1,
# ZHA 的 send_packet 还另有 _req_lock),逐条提交速率相同,但能在越线时**立刻**停发。
for i in range(n):
if stop.is_set():
break
await one(i)
t_sub = time.monotonic()
deadline = t_sub + WAIT[mode]
while self.inflight and time.monotonic() < deadline and not self.stub.failures:
await asyncio.sleep(0.2)
stop.set()
await s_task
missing = len(self.inflight)
self.expired.update(self.inflight)
self.inflight.clear()
c1 = await ezsp.read_counters()
diff = {k.name[8:]: (c1.get(k, 0) - c0.get(k, 0)) % 65536 for k in REPORT}
# 冷却:等堆回到基线(泄漏判据)
post_heap = None
for _ in range(60):
post_heap = await free_heap(ezsp)
if base_heap is None or post_heap is None or post_heap >= base_heap - 64:
break
await asyncio.sleep(0.5)
sent_ok = sum(1 for s, _ in sends if s == t.sl_Status.OK)
lat = [l for (_s, l) in self.done.values()]
hist = {}
for (s, _l) in self.done.values():
hist[s.name] = hist.get(s.name, 0) + 1
frees = [f for (_t, f, _n) in samples if f is not None]
peak = max((n_ for (_t, _f, n_) in samples), default=0)
min_free = min(frees) if frees else None
per_msg = round((base_heap - min_free) / peak, 1) if (base_heap and min_free is not None and peak) else None
res = {
"n": n, "mode": mode, "submitted": len(sends), "sent_ok": sent_ok,
"send_status": {s.name: sum(1 for x, _ in sends if x == s) for s in {x for x, _ in sends}},
"queue_plus_rtt_ms_max": round(max((r for _, r in sends), default=0) * 1000, 1),
"submit_s": round(t_sub - t_start, 2),
# 每条 EZSP 命令的服务时间(串行):含 C5 tcp_server.c:594 的 20 ms 串口读超时
"cmd_service_ms": round((t_sub - t_start) / max(len(sends), 1) * 1000, 1),
"callbacks": len(self.done), "missing": missing, "dups": self.dups, "unexpected": self.unexpected,
"late_from_earlier_bursts": self.late,
"sent_status": hist, "lat_p50": pct(lat, 50), "lat_max": round(max(lat), 2) if lat else None,
"heap_base": base_heap, "heap_min": min_free, "heap_post": post_heap, "peak_inflight": peak,
"bytes_per_msg": per_msg,
"proj_capacity": int((base_heap - HEAP_FLOOR) / per_msg) if (per_msg and base_heap) else None,
"beyond_bellows_timeout": sum(1 for l in lat if l > BELLOWS_ED_TIMEOUT),
"counters": diff, "rx_msgs": self.rx,
}
fails = []
if sent_ok != n:
fails.append("sendUnicast 有拒绝")
if missing or self.dups or self.unexpected:
fails.append("messageSentHandler 缺失/重复/意外")
if any(s not in OK_SENT for (s, _l) in self.done.values()):
fails.append("出现意料外的发送状态")
if lat and max(lat) > WAIT[mode]:
fails.append("时延超出等待窗")
for k in MUST_ZERO:
if diff[k.name[8:]]:
fails.append(f"{k.name[8:]} 增加 {diff[k.name[8:]]}")
if min_free is not None and min_free < 4096:
fails.append(f"堆最低 {min_free} < 4096")
if base_heap and post_heap is not None and post_heap < base_heap - 64:
fails.append(f"堆未回基线({post_heap} < {base_heap}-64)")
res["fails"] = fails
self.done.clear()
self.dups = self.unexpected = self.rx = self.late = 0
return res
async def main(a):
stub = Stub()
ezsp = EZSP(zconf.SCHEMA_DEVICE({zconf.CONF_DEVICE_PATH: a.path}), application=stub)
await ezsp.connect(use_thread=False) # ASH RST + version + get_xncp_features
rc = 0
try:
feats = ezsp._xncp_features
conc = await ezsp.get_default_adapter_concurrency() # 与 HA 内同一函数(文件哈希一致)
chip = await ezsp.xncp_get_chip_info() if FirmwareFeatures.CHIP_INFO in feats else None
print(json.dumps({"xncp_features": str(feats), "default_concurrency": conc,
"chip_info": chip.as_dict() if chip else None}, ensure_ascii=False))
await ezsp.write_config({}) # 与 ZHA 握手相同
(state,) = await ezsp.networkState()
if state != t.EmberNetworkStatus.JOINED_NETWORK:
with ezsp.wait_for_stack_status(t.sl_Status.NETWORK_UP) as up:
st = await ezsp.initialize_network()
if st != t.sl_Status.OK:
print(f"ABORT: networkInit = {st!r}")
return 2
async with asyncio.timeout(10):
await up
cfg = {}
for cid in (t.EzspConfigId.CONFIG_INDIRECT_TRANSMISSION_TIMEOUT, t.EzspConfigId.CONFIG_APS_UNICAST_MESSAGE_COUNT,
t.EzspConfigId.CONFIG_PACKET_BUFFER_COUNT, t.EzspConfigId.CONFIG_MAX_END_DEVICE_CHILDREN):
st, v = await ezsp.getConfigurationValue(configId=cid)
cfg[cid.name] = int(v)
k = t.NV3KeyId
boot0 = await token_u16(ezsp, k.NVM3KEY_STACK_BOOT_COUNTER)
crash0 = await token_u16(ezsp, k.NVM3KEY_STACK_ANALYSIS_REBOOT)
kids = await child_table(ezsp, cfg.get("CONFIG_MAX_END_DEVICE_CHILDREN", 32))
print(json.dumps({"config": cfg, "boot_counter": boot0, "analysis_reboot": crash0,
"children": {f"0x{n:04X}": {"eui64": str(c.eui64), "type": c.type.name,
"timeout": int(c.timeout), "remaining": int(c.timeout_remaining)}
for n, c in kids.items()}}, ensure_ascii=False))
missing = [n for n in a.targets if n not in kids]
if missing:
print(f"ABORT: 目标不在子设备表 {[hex(x) for x in missing]} —— 发过去就可能触发路由/地址发现")
return 2
s = Session(ezsp, stub, euis={n: kids[n].eui64 for n in a.targets}, faithful=a.faithful)
caps = []
cb = ezsp.add_callback(s.on_cb)
try:
# 预检:每个目标 1 条,看它在间接超时窗内会不会来 poll(决定后面测的是"投递"还是"满时长占用")
for _ in range(2):
print(json.dumps({"probe": await s.burst(len(a.targets), "noack", a.targets)}, ensure_ascii=False))
for n in a.n:
for mode in a.modes:
r = await s.burst(n, mode, a.targets)
print(json.dumps(r, ensure_ascii=False))
if mode == "ack" and r.get("proj_capacity") is not None:
caps.append(r["proj_capacity"])
rc = rc or (1 if r["fails"] else 0)
if stub.failures:
print(f"ABORT: NCP 复位/失败 {stub.failures}")
return 2
await asyncio.sleep(a.cooldown)
finally:
ezsp.remove_callback(cb)
boot1 = await token_u16(ezsp, k.NVM3KEY_STACK_BOOT_COUNTER)
crash1 = await token_u16(ezsp, k.NVM3KEY_STACK_ANALYSIS_REBOOT)
(state,) = await ezsp.networkState()
kids1 = await child_table(ezsp, cfg.get("CONFIG_MAX_END_DEVICE_CHILDREN", 32))
tail = {"boot_counter_delta": (boot1 - boot0) if None not in (boot0, boot1) else None,
"analysis_reboot_changed": crash1 != crash0, "network": state.name,
"children_still_present": all(n in kids1 for n in a.targets),
"unexpected_resets": stub.failures, "events": s.events[-50:]}
tail["proj_capacity_ack_min"] = min(caps) if caps else None
print(json.dumps(tail, ensure_ascii=False, default=str))
if caps and min(caps) < WORST_INFLIGHT_32:
print(f"FAIL: 按带重试档实测每条字节数,堆在地板 {HEAP_FLOOR} 之上只装得下 {min(caps)} 条 < {WORST_INFLIGHT_32}")
rc = rc or 1
if tail["boot_counter_delta"] or tail["analysis_reboot_changed"] or stub.failures \
or state != t.EmberNetworkStatus.JOINED_NETWORK or not tail["children_still_present"]:
return 2
return rc
finally:
await ezsp.disconnect()
def selftest():
"""不连任何东西:确认用到的 API/枚举都存在、帧能构造出来。"""
from bellows.ezsp.v18 import EZSPv18
p = EZSPv18(lambda *x: None, None)
for kind in ("zcl", "zdo"):
fields, data = payload(kind, 7, 0xCAF5)
for mode in ("noack", "ack"):
p._ezsp_frame("sendUnicast", message_type=t.EmberOutgoingMessageType.OUTGOING_DIRECT,
nwk=zt.NWK(0xCAF5), aps_frame=aps_frame(fields, 7, mode), message_tag=7, message=data)
for name in ("getExtendedTimeout", "getValue", "readCounters", "getChildData", "getTokenData", "getConfigurationValue",
"networkState", "messageSentHandler", "stackStatusHandler", "pollHandler"):
assert name in EZSPv18.COMMANDS, name
for attr in ("connect", "write_config", "wait_for_stack_status", "add_callback", "remove_callback",
"get_default_adapter_concurrency", "xncp_get_chip_info", "disconnect"):
assert hasattr(EZSP, attr), attr
for attr in ("send_unicast", "read_counters", "initialize_network"):
assert hasattr(EZSPv18, attr), attr
assert int(t.EzspValueId.VALUE_FREE_BUFFERS) == 0x03
assert p._get_command_priority("getValue") > p._get_command_priority("sendUnicast")
print("selftest OK")
return 0
if __name__ == "__main__":
ap = argparse.ArgumentParser()
ap.add_argument("path", nargs="?")
ap.add_argument("--n", default="8,32,64")
ap.add_argument("--modes", default="noack,ack")
ap.add_argument("--targets", default="0xCAF5,0xFC2C")
ap.add_argument("--cooldown", type=float, default=10.0)
ap.add_argument("--selftest", action="store_true")
ap.add_argument("--faithful", action="store_true", help="每条前加一次只读 getExtendedTimeout,复现 ZHA 的提交节奏")
ap.add_argument("-v", action="store_true")
a = ap.parse_args()
logging.basicConfig(level=logging.DEBUG if a.v else logging.WARNING)
if a.selftest:
sys.exit(selftest())
if not a.path:
sys.exit(__doc__)
a.n = [int(x) for x in a.n.split(",")]
a.modes = a.modes.split(",")
a.targets = [int(x, 0) for x in a.targets.split(",")]
try:
sys.exit(asyncio.run(main(a)))
except SystemExit:
raise
except Exception as e: # noqa: BLE001
print(f"ERROR: {type(e).__name__}: {e}")
sys.exit(3)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.