Narzędzia użytkownika

Narzędzia witryny


narzedzia:node_red_temperature_collector

To jest stara wersja strony!


Zbieranie informacji na temat temperatury za pomocą narzędzia Node-Red

Jeżeli chcesz przeczytać jak działa Node-Red kliknij tutaj.

Przepływ node-red.

konfiguracja HTTP request

Kod w środku węzła Make Query

// Format current date-time as a string
const now = new Date();
const dateStr = now.toISOString(); // You can reformat if needed
 
// Get the temperature from the payload
const temp = msg.payload;
 
// Extract the numeric value from the temperature string
const tempValue = parseInt(temp.replace(/[^\-?\d]/g, ''));
msg.temp = tempValue;
// Construct the SQL query (excluding ID)
msg.topic = `
    INSERT INTO WarsawTemp ([DATE], [TEMP]) 
    VALUES ('${dateStr}', ${tempValue})
`;
 
return msg;
narzedzia/node_red_temperature_collector.1747139565.txt.gz · ostatnio zmienione: 2025/05/13 14:32 przez administrator