messages appear again

This commit is contained in:
Will Bradley
2025-10-11 22:42:33 -07:00
parent 18d5114f6f
commit be243e3b50
2 changed files with 13 additions and 8 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ const nodeQueries = {
hardware_model = COALESCE(excluded.hardware_model, hardware_model), hardware_model = COALESCE(excluded.hardware_model, hardware_model),
role = COALESCE(excluded.role, role), role = COALESCE(excluded.role, role),
firmware_version = COALESCE(excluded.firmware_version, firmware_version), firmware_version = COALESCE(excluded.firmware_version, firmware_version),
last_heard = COALESCE(excluded.last_heard, last_heard), last_heard = COALESCE(excluded.last_heard, CURRENT_TIMESTAMP),
battery_level = COALESCE(excluded.battery_level, battery_level), battery_level = COALESCE(excluded.battery_level, battery_level),
voltage = COALESCE(excluded.voltage, voltage), voltage = COALESCE(excluded.voltage, voltage),
channel_utilization = COALESCE(excluded.channel_utilization, channel_utilization), channel_utilization = COALESCE(excluded.channel_utilization, channel_utilization),
+12 -7
View File
@@ -92,8 +92,13 @@ class MeshtasticMQTTClient {
const fromNode = from ? `!${from.toString(16).padStart(8, '0')}` : sender; const fromNode = from ? `!${from.toString(16).padStart(8, '0')}` : sender;
const toNode = to ? `!${to.toString(16).padStart(8, '0')}` : null; const toNode = to ? `!${to.toString(16).padStart(8, '0')}` : null;
// Debug log for Aether channel
if (topic.includes('Aether')) {
logger.info(`Aether message - Type: ${payload.type}, From: ${fromNode}, Channel: ${channel}, Payload: ${JSON.stringify(payload)}`);
}
// Handle different message types based on actual JSON structure // Handle different message types based on actual JSON structure
if (payload.type === 'sendtext' && payload.payload) { if ((payload.type === 'sendtext' || payload.type === 'text') && payload.payload) {
this.handleTextMessage(fromNode, toNode, { this.handleTextMessage(fromNode, toNode, {
...payload, ...payload,
text: typeof payload.payload === 'string' ? payload.payload : payload.payload.text, text: typeof payload.payload === 'string' ? payload.payload : payload.payload.text,
@@ -140,7 +145,7 @@ class MeshtasticMQTTClient {
nodeQueries.upsertNode.run( nodeQueries.upsertNode.run(
fromNode, fromNode,
null, null, null, null, null, null, null, null, null, null,
new Date().toISOString(), null, // last_heard - will use CURRENT_TIMESTAMP
null, null, null, null, null null, null, null, null, null
); );
} }
@@ -173,7 +178,7 @@ class MeshtasticMQTTClient {
nodeQueries.upsertNode.run( nodeQueries.upsertNode.run(
fromNode, fromNode,
null, null, null, null, null, null, null, null, null, null,
new Date().toISOString(), null, // last_heard - will use CURRENT_TIMESTAMP via COALESCE
null, null, null, null, null null, null, null, null, null
); );
@@ -192,7 +197,7 @@ class MeshtasticMQTTClient {
toNode, toNode,
channel, channel,
text, text,
new Date().toISOString(), null, // rx_time - let database use CURRENT_TIMESTAMP for created_at
rxSnr, rxSnr,
rxRssi, rxRssi,
hopLimit, hopLimit,
@@ -217,7 +222,7 @@ class MeshtasticMQTTClient {
null, // hardware_model null, // hardware_model
null, // role null, // role
null, // firmware_version null, // firmware_version
new Date().toISOString(), null, // last_heard - will use CURRENT_TIMESTAMP
null, // battery_level null, // battery_level
null, // voltage null, // voltage
null, // channel_utilization null, // channel_utilization
@@ -252,7 +257,7 @@ class MeshtasticMQTTClient {
data.hardwareModel || data.user?.hwModel || null, data.hardwareModel || data.user?.hwModel || null,
data.role || null, data.role || null,
data.firmwareVersion || null, data.firmwareVersion || null,
new Date().toISOString(), null, // last_heard - will use CURRENT_TIMESTAMP
null, // battery_level null, // battery_level
null, // voltage null, // voltage
null, // channel_utilization null, // channel_utilization
@@ -281,7 +286,7 @@ class MeshtasticMQTTClient {
null, // hardware_model null, // hardware_model
null, // role null, // role
null, // firmware_version null, // firmware_version
new Date().toISOString(), null, // last_heard - will use CURRENT_TIMESTAMP
metrics.batteryLevel || null, metrics.batteryLevel || null,
metrics.voltage || null, metrics.voltage || null,
metrics.channelUtilization || null, metrics.channelUtilization || null,