From 0a2c53f9c820514efb6a0364873a8c8edeeb2d65 Mon Sep 17 00:00:00 2001 From: gsd Date: Fri, 13 Feb 2026 18:39:41 +0300 Subject: [PATCH] telemetry protobuf --- mesht_protobuf_extra.py | 72 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/mesht_protobuf_extra.py b/mesht_protobuf_extra.py index 08d6a3b..fccf43a 100644 --- a/mesht_protobuf_extra.py +++ b/mesht_protobuf_extra.py @@ -47,6 +47,74 @@ FILE_INFO = [ ] ######### + +DEVICE_METRICS_SCHEME = [ + ("uint32", "battary_level", 1), + ("float", "voltage", 2), + ("float", "channel_utilization", 3), + ("float", "air_util_tx", 4), + ("uint32", "uptime_seconds", 5) +] + +ENVIRONMENT_METRICS_SCHEME = [ + ("float", "temperature", 1) + ##and moreeee +] + +AIR_QUALITY_METRICS_SCHEME = [ + ("uint32", "pm10_standard", 1) + #and moreee +] + +POWER_METRICS_SCHEME = [ + ("float", "ch1_voltage", 1) + #and moreee +] + +LOCAL_STATS_SCHEME = [ + ("uint32", "uptime_seconds", 1), + ("float", "channel_utilization", 2), + ("float", "air_util_tx", 3), + ("uint32", "num_packets_tx", 4), + ("uint32", "num_packets_rx", 5), + ("uint32", "num_packets_rx_bad", 6), + ("uint32", "num_online_nodes", 7), + ("uint32", "num_total_nodes", 8), + ("uint32", "num_rx_dupe", 9), + ("uint32", "num_tx_relay", 10), + ("uint32", "num_tx_relay_canceled", 11), + ("uint32", "heap_total_bytes", 12), + ("uint32", "heap_free_bytes", 13), + ("uint32", "num_tx_dropped", 14), + ("int32", "noise_floor", 15) +] + +HEALTH_METRICS_SCHEME = [ + ("uint32", "heart_bpm", 1), + ("uint32", "spO2", 2), + ("float", "temperature", 3) +] + +HOST_METRICS_SCHEME = [ + ("uint32", "uptime_seconds", 1) + #and moooore +] + +TRAFFIC_MANAGEMENT_SCHEME = [ + ("uint32", "packets_inspected", 1) + #AnD MOREEE +] + TELEMETRY_SCHEME = [ - ("fixed32", "time", 1) -] \ No newline at end of file + ("fixed32", "time", 1), + ("oneof", "variant", [ + (DEVICE_METRICS_SCHEME, "device_metrics", 2), + (ENVIRONMENT_METRICS_SCHEME, "environment_metrics", 3), + (AIR_QUALITY_METRICS_SCHEME, "air_quality_metrics", 4), + (POWER_METRICS_SCHEME, "power_metrics", 5), + (LOCAL_STATS_SCHEME, "local_stats", 6), + (HEALTH_METRICS_SCHEME, "health_metrics", 7), + (HOST_METRICS_SCHEME, "host_metrics", 8), + (TRAFFIC_MANAGEMENT_SCHEME, "traffic_management_stats", 9) + ]) +]