add keep-alive
This commit is contained in:
@@ -103,6 +103,9 @@ def generate_listener(device, global_config, mappings, command_sets, global_comm
|
||||
# 确定使用哪个 sender 脚本(每个设备独立的 sender)
|
||||
sender_file = f"{global_config['base_dir']}/bin/sender_{device['id']}.py"
|
||||
|
||||
# 获取 keep_alive 配置(仅TCP有效,默认False)
|
||||
keep_alive = device.get('keep_alive', False)
|
||||
|
||||
# 替换模板变量
|
||||
content = template.format(
|
||||
device_id=device['id'],
|
||||
@@ -115,7 +118,8 @@ def generate_listener(device, global_config, mappings, command_sets, global_comm
|
||||
python_path=global_config['python_path'],
|
||||
command_mappings=mappings_str,
|
||||
sender_file=sender_file,
|
||||
device_protocol=device_protocol.upper()
|
||||
device_protocol=device_protocol.upper(),
|
||||
keep_alive='True' if keep_alive else 'False'
|
||||
)
|
||||
|
||||
output_file = os.path.join(global_config['base_dir'], 'bin', f"{device['id']}.py")
|
||||
|
||||
Reference in New Issue
Block a user