Energy and cost report: what the lights actually used this season #153
Labels
No labels
area/ai
area/backend
area/frontend
area/infra
area/scheduler
area/wled
good-first-issue
priority/high
priority/low
priority/medium
security
type/bug
type/chore
type/ci-cd
type/docs
type/feature
type/qa
v1.0.0
v1.1.0
v1.2.0
v2.0.0
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/Iris-WLED#153
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Idea
"What did the lights cost this year?" is a question everyone with a big display asks, and WLED already knows most of the answer. Report it per night, per event and per season, in kWh and in money.
What WLED provides
/json/info→leds.pwris the estimated current draw in mA, computed by WLED's automatic brightness limiter (ABL) from the pixel values and brightness.leds.maxpwris the configured limit.leds.pwron the 16.0.0 controller during a fade and found it smooth and responsive (about 95 mA per 2 s).Verified against
main:WLEDInfodoesn't parsepwrormaxpwrtoday (services/wled_controller.py), and nothing samples it.Design
leds.pwrevery 5 minutes while the lights are on. This can share the watchdog's/json/inforead if that lands first (#148), with no extra request.power_samples→energy_dailyrollup: Wh per night, attributed to the event and scheme that ran. Keep the raw samples for about 30 days and the dailies forever. It's a few hundred rows a year.led_voltage(required for the report; the report says so when it's unset rather than guessing),psu_efficiency(0.85),energy_price_per_kwh, andcurrency.iris_wled_current_milliamps(gauge) andiris_energy_wh_total(counter), so it also works in Grafana.Relationship to #55
#55 (power-draw estimation and PSU budget warning) is the before: predict a scheme's draw and warn if it exceeds the PSU. This is the after: record what was actually drawn. They share the voltage and efficiency settings, and the measured data can validate #55's estimator: predicted versus observed per scheme. Build whichever comes first so that the settings are shared.
Acceptance
leds.pwrandleds.maxpwrare parsed. Fixtures updated for each supported firmware version (#62), and older firmware withoutpwrdegrades to "not available".Picking this up now that #148's watchdog is merged. The power sample piggybacks on the watchdog's
/json/inforead, so there's no second poll of the controller.Can't be done from here: the sanity check against a plug-in power meter on the real PSU. It stays a manual acceptance item, with the method written into the docs.
Done in #180 (squash-merged, CI green).
Delivered:
/json/inforead. Anenergy_samplerjob takes over when the watchdog isoff, so exactly one job reads the controller.energy_dailyin mAh, so the voltage can be set later./energypage and shortcut, the CSV export, the metrics, and migration 0012.Deviations from the spec:
led_voltageis limited to 5, 12 or 24.Fixed along the way, by root cause:
list_schemes, 77.8% of server CPU under load.Still open:
pwrmay read about 100 mA (the ESP's own allowance) rather than 0. It's worth checking during #179.