From 4f33866ce32f4d62c911ff865514e63a36be254a Mon Sep 17 00:00:00 2001 From: Daniel Pupius Date: Wed, 23 Apr 2025 13:07:26 -0700 Subject: [PATCH] Update visualization of Telemetry Packets --- .../{telemetry.json => telemetry1.json} | 14 +- web/fixtures/telemetry2.json | 41 +++++ web/src/components/PacketList.tsx | 2 +- .../packets/DeviceMetricsPacket.tsx | 133 ++++++++++++++++ .../packets/EnvironmentMetricsPacket.tsx | 143 ++++++++++++++++++ web/src/components/packets/PacketRenderer.tsx | 2 + .../components/packets/TelemetryPacket.tsx | 137 +++++------------ web/src/routes/demo.tsx | 18 ++- 8 files changed, 372 insertions(+), 118 deletions(-) rename web/fixtures/{telemetry.json => telemetry1.json} (72%) create mode 100644 web/fixtures/telemetry2.json create mode 100644 web/src/components/packets/DeviceMetricsPacket.tsx create mode 100644 web/src/components/packets/EnvironmentMetricsPacket.tsx diff --git a/web/fixtures/telemetry.json b/web/fixtures/telemetry1.json similarity index 72% rename from web/fixtures/telemetry.json rename to web/fixtures/telemetry1.json index 0277223..82eac2e 100644 --- a/web/fixtures/telemetry.json +++ b/web/fixtures/telemetry1.json @@ -24,23 +24,15 @@ "telemetry": { "time": 1745300043, "deviceMetrics": { - "batteryLevel": 100, + "batteryLevel": 88, "voltage": 4.19, "channelUtilization": 13.37, "airUtilTx": 2.58, - "uptimeSeconds": 771327 - }, - "environmentMetrics": { - "temperature": 22.5, - "relativeHumidity": 58.2, - "barometricPressure": 101325, - "gasResistance": 250000, - "voltage": 3.3, - "current": 0.01 + "uptimeSeconds": 189327 } }, "requestId": 0, "replyId": 0, "wantResponse": false } -} \ No newline at end of file +} diff --git a/web/fixtures/telemetry2.json b/web/fixtures/telemetry2.json new file mode 100644 index 0000000..27c47df --- /dev/null +++ b/web/fixtures/telemetry2.json @@ -0,0 +1,41 @@ +{ + "info": { + "fullTopic": "msh/US/bayarea/2/e/LongFast/!defg4567", + "regionPath": "US/bayarea", + "version": "2", + "format": "e", + "channel": "LongFast", + "userId": "!defg4567" + }, + "data": { + "channelId": "LongFast", + "gatewayId": "!defg4567", + "id": 5567890123, + "from": 3949439480, + "to": 4294967295, + "hopLimit": 3, + "hopStart": 3, + "wantAck": false, + "priority": "UNSET", + "viaMqtt": true, + "nextHop": 0, + "relayNode": 0, + "portNum": "TELEMETRY_APP", + "telemetry": { + "time": 1745300047, + "environmentMetrics": { + "temperature": 22.5, + "relativeHumidity": 58.2, + "barometricPressure": 101325, + "lux": 450, + "windSpeed": 3.2, + "rainfall1h": 0.5, + "soilMoisture": 65, + "soilTemperature": 18.5 + } + }, + "requestId": 0, + "replyId": 0, + "wantResponse": false + } +} diff --git a/web/src/components/PacketList.tsx b/web/src/components/PacketList.tsx index 29eef17..16559d4 100644 --- a/web/src/components/PacketList.tsx +++ b/web/src/components/PacketList.tsx @@ -131,7 +131,7 @@ export const PacketList: React.FC = () => { -