解析云快充充电桩通信协议报文,支持CRC16校验、多种帧类型解析、错误诊断,返回标准JSON格式。用于处理云快充协议V1.6的报文数据。
How this skill is triggered — by the user, by Claude, or both
Slash command
/dayepython-ykc-parser:ykc-parserThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
解析云快充充电桩通信协议报文,将十六进制报文转换为结构化的JSON数据。
解析云快充充电桩通信协议报文,将十六进制报文转换为结构化的JSON数据。
本技能用于解析云快充充电平台协议V1.6的报文数据,提供:
当用户需要:
scripts/parse_ykc.py 脚本解析报文使用Python脚本解析报文:
python "$SKILL_DIR"/scripts/parse_ykc.py "<hex_string>"
示例:
python "$SKILL_DIR"/scripts/parse_ykc.py "68 22 0000 00 01 55031412782305 00 02 0F 56342E312E353000 01 01010101010101010101 04 675A"
scripts/parse_ykc.py: 主解析脚本
scripts/crc16.py: CRC16校验模块
{
"code": 200,
"msg": "解析成功",
"start_flag": "0x68",
"data_length": 34,
"sequence_number": 0,
"encrypt_flag": "0x00",
"is_encrypted": false,
"frame_type": "0x01",
"frame_type_name": "充电桩登录认证",
"body_length": 28,
"body_hex": "...",
"crc16_received": "0x675A",
"crc16_calculated": "0x675A",
"crc16_valid": true,
"body_data": {
"pile_code": "55031412782305",
"pile_type": "直流桩",
"gun_count": 2,
"protocol_version": "v1.5",
"program_version": "v4.1.50",
"network_type": "LAN",
"sim_card": "01010101010101010101",
"operator": "其他"
}
}
{
"code": 500,
"msg": "解析失败: 错误描述",
"errors": [
"具体错误信息1",
"具体错误信息2"
],
"warnings": [
"CRC16校验失败: 期望0x675A, 计算0x675B"
],
"partial_data": {
"frame_type": "0x01",
"frame_type_name": "登录认证"
}
}
当前实现详细解析的帧类型:
其他帧类型会返回帧类型名称和原始十六进制数据,但不进行详细字段解析。
如需了解协议概要,查阅以下快速参考:
技能包含云快充协议V1.6的完整文档,位于 references/docs/ 目录:
协议基础:
references/docs/02-协议基础/01-通信协议结构.mdreferences/docs/02-协议基础/02-应用层报文帧格式.mdreferences/docs/02-协议基础/03-数据格式定义.mdreferences/docs/02-协议基础/05-帧类型定义表.md业务流程:
references/docs/04-注册心跳/01-登录认证.md: 登录认证流程和报文格式references/docs/04-注册心跳/02-心跳包.md: 心跳包协议references/docs/05-实时数据/01-实时监测数据.md: 实时数据上报references/docs/06-运营交互/01-充电启动.md: 充电启动流程references/docs/06-运营交互/02-充电停止.md: 充电停止流程references/docs/07-平台设置/: 平台配置相关references/docs/09-远程维护/: 远程维护命令references/docs/10-并充模式/: 双枪并充模式附录:
references/docs/11-附录/01-充电停止原因代码表.mdreferences/docs/11-附录/02-CRC16校验计算方法.mdreferences/docs/11-附录/03-协议需知.md文档索引:
references/docs/INDEX.md: 完整的文档目录索引references/docs/README.md: 协议文档总览搜索特定内容示例:
grep -i "0x13" "$SKILL_DIR"/references/frame_types.mdgrep -i "BCD" "$SKILL_DIR"/references/data_formats.mdgrep -r "登录认证" "$SKILL_DIR"/references/docs/grep -r "充电启动" "$SKILL_DIR"/references/docs/"crc16_valid": false如需添加新帧类型的详细解析:
parse_ykc.py 的 _parse_body 方法中添加新的条件分支_parse_<frame_name> 方法_parse_login 和 _parse_realtime_data 的实现方式_bcd_to_str、_ascii_to_str 等辅助方法处理数据类型用户: 帮我解析这个云快充报文:
68 22 0000 00 01 55031412782305 00 02 0F 56342E312E353000 01 01010101010101010101 04 675A
Claude: 执行解析脚本并返回结果,说明这是一个登录认证报文,桩编码为55031412782305,直流桩,2个充电枪,协议版本v1.5等
用户: 这个报文有什么问题?
68 40 1A03 00 13 ... 9DAC
Claude: 执行解析脚本,发现CRC校验失败,但继续解析,返回完整的实时数据(电压、电流、SOC、充电度数等),并标注CRC错误
用户: 解析报文 68 22 00
Claude: 执行解析脚本,返回错误信息"报文长度过短: 3字节,最少需要8字节"
int.from_bytes(byteorder='little') 转换decode('ascii') 转换,移除尾部0x00npx claudepluginhub joshuarweaver/cascade-code-general-misc-4 --plugin dayepython-ykc-parserGuides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Guides reception of code review feedback: verify before implementing, avoid performative agreement, push back with technical reasoning when needed.