parse telemetry data with pycayennelpp

This commit is contained in:
Florent de Lamotte 2025-05-14 14:48:11 +02:00
parent 7ecd237377
commit 0aa586fe4e
2 changed files with 5 additions and 2 deletions

View file

@ -18,7 +18,7 @@ classifiers = [
] ]
license = "MIT" license = "MIT"
license-files = ["LICEN[CS]E*"] license-files = ["LICEN[CS]E*"]
dependencies = [ "bleak", "pyserial-asyncio" ] dependencies = [ "bleak", "pyserial-asyncio", "pycayennelpp" ]
[project.optional-dependencies] [project.optional-dependencies]
dev = ["pytest", "pytest-asyncio"] dev = ["pytest", "pytest-asyncio"]

View file

@ -1,6 +1,7 @@
import sys import sys
import logging import logging
import asyncio import asyncio
from cayennelpp import LppFrame
from typing import Any, Optional, Dict from typing import Any, Optional, Dict
from .events import Event, EventType, EventDispatcher from .events import Event, EventType, EventDispatcher
from .packets import PacketType from .packets import PacketType
@ -378,7 +379,9 @@ class MessageReader:
res = {} res = {}
res["pubkey_pre"] = data[2:8].hex() res["pubkey_pre"] = data[2:8].hex()
res["data"] = data[8:12].hex() buf = data[8:]
res["data"] = buf.hex()
res["lpp"] = LppFrame().from_bytes(buf)
attributes = { attributes = {
"data" : res["data"], "data" : res["data"],