Created
July 20, 2025 13:36
-
-
Save Murdo-C/f7e160993899861e0118afd58f29cff2 to your computer and use it in GitHub Desktop.
Home Status App Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function doPost(e) { | |
| try { | |
| const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Data"); | |
| const payload = JSON.parse(e.postData.contents); | |
| const row = [ | |
| payload.timestamp, | |
| payload.livingRoom.temperature, | |
| payload.livingRoom.humidity, | |
| payload.livingRoom.airQuality, | |
| payload.elenaRoom.temperature, | |
| payload.elenaRoom.humidity, | |
| payload.elenaRoom.airQuality | |
| ]; | |
| sheet.appendRow(row); | |
| return ContentService.createTextOutput("Success").setMimeType(ContentService.MimeType.TEXT); | |
| } catch (err) { | |
| return ContentService.createTextOutput("Error: " + err.toString()) | |
| .setMimeType(ContentService.MimeType.TEXT); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment