Skip to content

Feature : Collect and analyze power consumption data from Shelly Pro 2PM - #380#381

Open
romainantes wants to merge 4 commits into
developfrom
feature/shelly_power_consumption_380
Open

Feature : Collect and analyze power consumption data from Shelly Pro 2PM - #380#381
romainantes wants to merge 4 commits into
developfrom
feature/shelly_power_consumption_380

Conversation

@romainantes

Copy link
Copy Markdown
Collaborator

Add Shelly power monitoring tools
Add two scripts under tools/shelly_power/ to collect and analyze power consumption data from a Shelly Gen2 device (local API, no cloud dependency) :

  • collect.py queries Switch.GetStatus for each configured channel and appends the results to a CSV file. Intended to run periodically via cron on the Raspberry Pi (e.g. every 10 minutes).

  • analyze.py processes the collected CSV and produces a per-channel and combined report including average/peak power, total energy, energy per 24h, and day vs night consumption split. An optional matplotlib chart can be generated with --plot.

Both scripts require no external dependencies beyond the standard library (matplotlib is optional).
A README.md documents usage, cron setup, CSV format, and how to retrieve data from the RPi for local analysis.

Example of plot generated:
shelly_power_BIG

@romainantes romainantes linked an issue Jun 26, 2026 that may be closed by this pull request
@romainantes romainantes requested a review from fe51 June 26, 2026 14:09
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.83%. Comparing base (a227753) to head (3d99898).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #381   +/-   ##
========================================
  Coverage    78.83%   78.83%           
========================================
  Files            6        6           
  Lines          841      841           
========================================
  Hits           663      663           
  Misses         178      178           
Flag Coverage Δ
unittests 78.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collect and analyze power consumption data from Shelly Pro 2PM

1 participant