Compare commits

5 Commits

Author SHA1 Message Date
2f76091ae6 fix nodeinfo and telemetry
All checks were successful
Build Docker containers / Build (push) Successful in 42s
2025-04-18 13:06:11 +00:00
0f4035ec3a add debug-incoming-packets option
All checks were successful
Build Docker containers / Build (push) Successful in 42s
2025-04-17 14:22:37 +00:00
18df989fc6 fix markercluster issues
All checks were successful
Build Docker containers / Build (push) Successful in 40s
2025-04-16 01:49:20 -04:00
e694ffa66a remove extra )
All checks were successful
Build Docker containers / Build (push) Successful in 40s
2025-04-16 00:54:04 -04:00
da99bfdeef add arrowheads plugin 2025-04-16 00:53:54 -04:00
6 changed files with 68 additions and 33 deletions

View File

@ -107,6 +107,11 @@ const optionsList = [
type: Boolean,
description: "This option will drop all packets that have 'OK to MQTT' set to false.",
},
{
name: "debug-incoming-packets",
type: Boolean,
description: "This option will print out all known packets as they arrive.",
},
{
name: "drop-portnums-without-bitfield",
type: Number,
@ -225,7 +230,7 @@ const collectorEnabled = {
const decryptionKeys = options["decryption-keys"] ?? [
"1PG7OiApB1nwvP+rz05pAQ==", // add default "AQ==" decryption key
];
const logKnownPacketTypes = false;
const logKnownPacketTypes = options["debug-incoming-packets"] ?? false;
const dropPacketsNotOkToMqtt = options["drop-packets-not-ok-to-mqtt"] ?? false;
const dropPortnumsWithoutBitfield = options["drop-portnums-without-bitfield"] ?? null;
const oldFirmwarePositionPrecision = options["old-firmware-position-precision"] ?? null;
@ -787,7 +792,7 @@ client.on('message', async (topic, message) => {
break;
case Portnums.PortNum.NODEINFO_APP:
callback = onNodeInfo;
schema = Mesh.NodeInfoSchema;
schema = Mesh.UserSchema;
break;
case Portnums.PortNum.WAYPOINT_APP:
callback = onWaypoint;
@ -1218,25 +1223,28 @@ async function onRouteDiscovery(envelope, payload) {
}
async function onTelemetry(envelope, payload) {
// we need to do some work on the packet to log it properly
const telemetryType = payload.variant.case
if(logKnownPacketTypes) {
console.log('TELEMETRY_APP', {
from: envelope.packet.from.toString(16),
telemetry: payload,
type: telemetryType,
telemetry: payload.variant.value,
});
}
payload = payload.variant.value
// data to update
const data = {};
// handle device metrics
if(payload.deviceMetrics){
if (telemetryType === 'deviceMetrics'){
data.battery_level = payload.deviceMetrics.batteryLevel !== 0 ? payload.deviceMetrics.batteryLevel : null;
data.voltage = payload.deviceMetrics.voltage !== 0 ? payload.deviceMetrics.voltage : null;
data.channel_utilization = payload.deviceMetrics.channelUtilization !== 0 ? payload.deviceMetrics.channelUtilization : null;
data.air_util_tx = payload.deviceMetrics.airUtilTx !== 0 ? payload.deviceMetrics.airUtilTx : null;
data.uptime_seconds = payload.deviceMetrics.uptimeSeconds !== 0 ? payload.deviceMetrics.uptimeSeconds : null;
data.battery_level = payload.batteryLevel !== 0 ? payload.batteryLevel : null;
data.voltage = payload.voltage !== 0 ? payload.voltage : null;
data.channel_utilization = payload.channelUtilization !== 0 ? payload.channelUtilization : null;
data.air_util_tx = payload.airUtilTx !== 0 ? payload.airUtilTx : null;
data.uptime_seconds = payload.uptimeSeconds !== 0 ? payload.uptimeSeconds : null;
// create device metric
try {
@ -1275,20 +1283,20 @@ async function onTelemetry(envelope, payload) {
}
// handle environment metrics
if(payload.environmentMetrics){
if(telemetryType === 'environmentMetrics'){
// get metric values
const temperature = payload.environmentMetrics.temperature !== 0 ? payload.environmentMetrics.temperature : null;
const relativeHumidity = payload.environmentMetrics.relativeHumidity !== 0 ? payload.environmentMetrics.relativeHumidity : null;
const barometricPressure = payload.environmentMetrics.barometricPressure !== 0 ? payload.environmentMetrics.barometricPressure : null;
const gasResistance = payload.environmentMetrics.gasResistance !== 0 ? payload.environmentMetrics.gasResistance : null;
const voltage = payload.environmentMetrics.voltage !== 0 ? payload.environmentMetrics.voltage : null;
const current = payload.environmentMetrics.current !== 0 ? payload.environmentMetrics.current : null;
const iaq = payload.environmentMetrics.iaq !== 0 ? payload.environmentMetrics.iaq : null;
const windDirection = payload.environmentMetrics.windDirection;
const windSpeed = payload.environmentMetrics.windSpeed;
const windGust = payload.environmentMetrics.windGust;
const windLull = payload.environmentMetrics.windLull;
const temperature = payload.temperature !== 0 ? payload.temperature : null;
const relativeHumidity = payload.relativeHumidity !== 0 ? payload.relativeHumidity : null;
const barometricPressure = payload.barometricPressure !== 0 ? payload.barometricPressure : null;
const gasResistance = payload.gasResistance !== 0 ? payload.gasResistance : null;
const voltage = payload.voltage !== 0 ? payload.voltage : null;
const current = payload.current !== 0 ? payload.current : null;
const iaq = payload.iaq !== 0 ? payload.iaq : null;
const windDirection = payload.windDirection;
const windSpeed = payload.windSpeed;
const windGust = payload.windGust;
const windLull = payload.windLull;
// set metrics to update on node table
data.temperature = temperature;
@ -1337,15 +1345,15 @@ async function onTelemetry(envelope, payload) {
}
// handle power metrics
if(payload.powerMetrics){
if(telemetryType === 'powerMetrics'){
// get metric values
const ch1Voltage = payload.powerMetrics.ch1Voltage !== 0 ? payload.powerMetrics.ch1Voltage : null;
const ch1Current = payload.powerMetrics.ch1Current !== 0 ? payload.powerMetrics.ch1Current : null;
const ch2Voltage = payload.powerMetrics.ch2Voltage !== 0 ? payload.powerMetrics.ch2Voltage : null;
const ch2Current = payload.powerMetrics.ch2Current !== 0 ? payload.powerMetrics.ch2Current : null;
const ch3Voltage = payload.powerMetrics.ch3Voltage !== 0 ? payload.powerMetrics.ch3Voltage : null;
const ch3Current = payload.powerMetrics.ch3Current !== 0 ? payload.powerMetrics.ch3Current : null;
const ch1Voltage = payload.ch1Voltage !== 0 ? payload.ch1Voltage : null;
const ch1Current = payload.ch1Current !== 0 ? payload.ch1Current : null;
const ch2Voltage = payload.ch2Voltage !== 0 ? payload.ch2Voltage : null;
const ch2Current = payload.ch2Current !== 0 ? payload.ch2Current : null;
const ch3Voltage = payload.ch3Voltage !== 0 ? payload.ch3Voltage : null;
const ch3Current = payload.ch3Current !== 0 ? payload.ch3Current : null;
// create power metric
try {

View File

@ -15,6 +15,8 @@
"chartjs-adapter-moment": "^1.0.1",
"install": "^0.13.0",
"leaflet": "^1.9.4",
"leaflet-arrowheads": "^1.4.0",
"leaflet-geometryutil": "^0.10.3",
"leaflet-groupedlayercontrol": "^0.6.1",
"leaflet.markercluster": "^1.5.3",
"moment": "^2.30.1",
@ -2700,6 +2702,25 @@
"integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==",
"license": "BSD-2-Clause"
},
"node_modules/leaflet-arrowheads": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/leaflet-arrowheads/-/leaflet-arrowheads-1.4.0.tgz",
"integrity": "sha512-aIjsmoWe1VJXaGOpKpS6E8EzN2vpx3GGCNP/FxQteLVzAg5xMID7elf9hj/1CWLJo8FuGRjSvKkUQDj7mocrYA==",
"license": "MIT",
"dependencies": {
"leaflet": "^1.7.1",
"leaflet-geometryutil": "^0.10.0"
}
},
"node_modules/leaflet-geometryutil": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/leaflet-geometryutil/-/leaflet-geometryutil-0.10.3.tgz",
"integrity": "sha512-Qeas+KsnenE0Km/ydt8km3AqFe7kJhVwuLdbCYM2xe2epsxv5UFEaVJiagvP9fnxS8QvBNbm7DJlDA0tkKo9VA==",
"license": "BSD-3-Clause",
"dependencies": {
"leaflet": "^1.6.0"
}
},
"node_modules/leaflet-groupedlayercontrol": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/leaflet-groupedlayercontrol/-/leaflet-groupedlayercontrol-0.6.1.tgz",

View File

@ -16,6 +16,8 @@
"chartjs-adapter-moment": "^1.0.1",
"install": "^0.13.0",
"leaflet": "^1.9.4",
"leaflet-arrowheads": "^1.4.0",
"leaflet-geometryutil": "^0.10.3",
"leaflet-groupedlayercontrol": "^0.6.1",
"leaflet.markercluster": "^1.5.3",
"moment": "^2.30.1",

View File

@ -83,7 +83,7 @@ import { getNodeColor, getNodeTextColor, findNodeById, findNodeMarkerById } from
</div>
<div class="my-auto relative flex flex-none items-center justify-center">
<div>
<div class="flex rounded-full h-12 w-12 text-white shadow" :style="{backgroundColor: getNodeColor(route))}" :class="[ `text-[${getNodeTextColor(route)}]` ]">
<div class="flex rounded-full h-12 w-12 text-white shadow" :style="{backgroundColor: getNodeColor(route)}" :class="[ `text-[${getNodeTextColor(route)}]` ]">
<div class="mx-auto my-auto drop-shadow-sm">{{ findNodeById(route)?.short_name ?? "?" }}</div>
</div>
</div>

View File

@ -1,5 +1,6 @@
import moment from 'moment';
import L from 'leaflet/dist/leaflet.js';
import 'leaflet/dist/leaflet.js';
const L = window.L;
import 'leaflet.markercluster/dist/leaflet.markercluster.js';
import 'leaflet-groupedlayercontrol/dist/leaflet.groupedlayercontrol.min.js';
import {

View File

@ -11,8 +11,11 @@ import Announcement from '../components/Announcement.vue';
import axios from 'axios';
import moment from 'moment';
import L from 'leaflet/dist/leaflet.js';
import 'leaflet.markercluster/dist/leaflet.markercluster.js';
import 'leaflet/dist/leaflet';
const L = window.L;
import 'leaflet-geometryutil';
import 'leaflet-arrowheads';
import 'leaflet.markercluster';
import 'leaflet-groupedlayercontrol/dist/leaflet.groupedlayercontrol.min.js';
import { onMounted, useTemplateRef, ref, watch, markRaw } from 'vue';
import { state } from '../store.js';