iSpindel – Hidrómetro. Parte 2: Software
– Versión impresora 3d [link!]
– Versión PCB Jeffrey 2.0 [link!]
– Versión PCB iSpindel 4.0 [link!]
Enviar Datos iSpindel hacia Google Sheets


function doPost(e) {
try {
// Parsear el contenido JSON recibido
var data = JSON.parse(e.postData.contents);
// Abrir la hoja activa
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
// Agregar encabezados si es la primera vez (opcional)
if (sheet.getLastRow() === 0) {
sheet.appendRow([
"Timestamp", "Name", "ID", "Token", "Interval", "Temperature",
"Temp Units", "Gravity", "Angle", "Battery", "RSSI",
"Corrected Gravity", "Gravity Unit", "Run Time"
]);
}
// Agregar datos a la hoja
sheet.appendRow([
new Date(), // Timestamp
data.name, // Name
data.ID, // ID
data.interval, // Interval
data.temperature, // Temperature
data.temp_units, // Temp Units
data.gravity, // Gravity
data.angle, // Angle
data.battery, // Battery
data.RSSI, // RSSI
]);
// Respuesta de éxito
return ContentService.createTextOutput("Datos recibidos correctamente.");
} catch (error) {
// Respuesta de error
return ContentService.createTextOutput("Error: " + error.message);
}
}
Pulsamos en Implementar y nueva Implementación:

Y creamos una nueva implementación accesible desde cualquier usuario.
*Generalmente sería mejor solo con tu usuario pero iSpindel no permite actualmente la configuración con autentificación de usuario:

Por último, copiaremos el link de URL generado y lo añadiremos en la configuración del iSpindel sin TOKEN y como https.

A partir de este momento recibiremos los datos en el intervalo establecido:

Enlaces: últimos releases.
21 comentarios