Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

powerlogs

ESP32 sketch that logs electricity-related timestamps to local storage and uploads daily files to S3 via AWS Lambda.

What it does

  • Every 5 min: Appends current time (HHMM) to a daily file on LittleFS. Filename format: YYMMDD (e.g. 250129).
  • Every 30 min: Uploads today’s file to an AWS Lambda URL (e.g. Lambda writes to S3). Uses X-Device-Token and X-Filename headers.

Hardware / environment

  • Board: ESP32 (e.g. ESP32-DevKit with WiFi).
  • Libraries: Built-in WiFi, HTTPClient, WiFiClientSecure, LittleFS, and time (NTP).

Setup

  1. Config

    • Copy config.example.h to config.h.
    • Set WIFI_SSID, WIFI_PASS, LAMBDA_URL, and DEVICE_TOKEN in config.h.
    • Do not commit config.h (it is gitignored).
  2. Arduino IDE

    • Open the powerlogs folder as a sketch (main file is powerlogs.ino).
    • Select your ESP32 board and port, then compile and upload.
  3. Lambda

    • Expects POST with body = file contents, X-Device-Token, X-Filename. Implement your Lambda to validate the token and store the body in S3 under the given filename (or your chosen key).

Sketch layout

  • powerlogs.ino — setup, loop, intervals, timezone.
  • wifi.ino — WiFi connect.
  • time.ino — NTP sync, daily filename, HHMM line.
  • logging.ino — append HHMM to daily file.
  • upload.ino — send today’s file to Lambda.

Timezone

Configured for Kyiv (EET/EEST). Change TZ_UKRAINE in powerlogs.ino if needed.

Development

Conventional commits — After cloning, run once so commit-msg validation uses the repo hooks:

./scripts/setup-hooks.sh

This sets core.hooksPath to .githooks. Commit messages must follow type(scope)?: description (e.g. feat: add thing, fix(wifi): reconnect).

About

ESP32 power logger — electricity data to S3 via AWS Lambda

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages