Skip to content

Instantly share code, notes, and snippets.

@taraspos
Created September 23, 2025 09:11
Show Gist options
  • Save taraspos/94f5e3a53e60a87ab356b2f1be818fe7 to your computer and use it in GitHub Desktop.
Save taraspos/94f5e3a53e60a87ab356b2f1be818fe7 to your computer and use it in GitHub Desktop.
Script to read Nest Thermostat recorded temperature (exported from https://takeout.google.com/)
package main
import (
"bufio"
"encoding/json"
"fmt"
"os"
"strings"
)
func main() {
// Path to the `HvacRuntime.jsonl` file
file, err := os.Open(os.Args[1])
if err != nil {
panic(err)
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
var obj map[string]interface{}
line := scanner.Text()
// Remove leading/trailing double quotes and unescape inner quotes
if strings.HasPrefix(line, "\"") && strings.HasSuffix(line, "\"") {
line = line[1 : len(line)-1]
}
line = strings.ReplaceAll(line, `""`, `"`)
if err := json.Unmarshal([]byte(line), &obj); err != nil {
fmt.Fprintf(os.Stderr, "error parsing line: %v\n", err)
continue
}
fmt.Printf("[%s]: %f\n", obj["interval_start"], obj["indoor_temp"])
}
if err := scanner.Err(); err != nil {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment