Add outgoing power visualization to Sankey diagram - #20
Conversation
|
"Hey! @srimanachanta Just a quick heads-up: I've submitted 6 modular PRs (PRs #17 through #22) to break down a larger set of features and make the review process much easier for you. Because a few of these PRs touch the same core files (like Once you merge a PR, if GitHub flags any of my remaining open PRs with conflicts, just let me know or leave them be—I will actively monitor the repo and locally rebase my remaining branches against your updated
Thanks for maintaining Stasis! Let me know if you need any adjustments. |
|
|
Yeah its available on MacOS 26, the current version installed on my device is 26.5. dinanath@Dinanaths-MacBook-Air Stasis % ioreg -w 0 -r -c AppleSmartBattery | grep "PowerTelemetryData"
"PowerTelemetryData" = {
"AccumulatedWallEnergyEstimate" = 224764618,
"SystemEnergyConsumed" = 1648,
"SystemPowerInAccumulatorCount" = 99773,
"AdapterEfficiencyLoss" = 18446744073709551561,
"SystemLoad" = 5933,
"AccumulatedSystemLoad" = 781532860,
"AccumulatedSystemEnergyConsumed" = 486985061425,
"SystemCurrentIn" = 294,
"WallEnergyEstimate" = 1593,
"SystemLoadAccumulatorCount" = 320468,
"AdapterEfficiencyLossAccumulatorCount" = 98439,
"SystemVoltageIn" = 20180,
"SystemPowerIn" = 5933,
"AccumulatedBatteryPower" = 90369720,
"PowerTelemetryErrorCount" = 0,
"AccumulatedAdapterEfficiencyLoss" = 215985318490873,
"BatteryPowerAccumulatorCount" = 4686,
"AccumulatedSystemPowerIn" = 1753146347945,
"BatteryPower" = 0,
"AccumulatedBatteryDischarge" = 18446744073637340213,
"BatteryDischargeAccumulatorCount" = 12559
}
dinanath@Dinanaths-MacBook-Air Stasis % |
|
Given this value is from IORegistry, it will only update on percent changes or adapter changes which wouldn't achieve the desired effect. The better solution would be to use the SMC data we already get which is synchronous, real time data insted. Additionally, given this registry entry is only available on ~macOS 26+, it would require weird branching to use different APIs. |
So how do you propose the solution? Can you help with it so I can try implementing that? |
Both "PowerOutDetails" and "PowerTelemetryData" don't exist on macOS 15.7 . You need to determine which SMC keys they are using and I'll see if they exist on macOS 15.7 . If they don't exist, we may want to guard this feature for macOS 26 only. |
…eat/display-outgoing-power # Conflicts: # Stasis/DefaultsKeys.swift # Stasis/L10n/Localizable.xcstrings # Stasis/ViewModels/MenuViewModel.swift
|
@srimanachanta I pushed a follow-up update addressing PR #20 feedback. What was updated:
Result:
If useful, I can post sample runtime logs from both a macOS 26 machine and a macOS 15.7 machine for direct comparison. |
This pull request adds support for visualizing output power and output ports in the app's power metrics and UI. It introduces new data structures and UI logic to track, compute, and display the power delivered to output ports, including per-port details and visualization controls. The changes affect models, services, view models, and UI components to provide a comprehensive and configurable representation of output power.
Key changes:
1. Output Power and Ports Tracking
OutputPortPowerstruct and associated fields toBatteryMetricsto represent and store per-port output power data. [1] [2]IOKitServiceto fetch, compute, and emit output power and per-port details using new helper methods (getOutputPortPowers,getSystemInputPowerWatts, etc.), and to include these in the emitted metrics. [1] [2]2. Output Power Visualization and UI
MenuViewModelto process, stabilize, and expose output port power data and formatted text for UI display. [1] [2]PowerSankeyViewand related UI logic to visualize output power and per-port flows, including support for multiple output ports and dynamic Sankey diagram layouts. [1] [2] [3] [4]3. User Preferences and Localization
OutputVisualizationModeenum) and for toggling the display of output ports text, with corresponding keys inDefaultsKeys.swift. [1] [2]4. UI Control Logic
MenuBuilderand related UI components to conditionally show output ports information and visualization based on user preferences and current power source. [1] [2]5. Adapter Metrics Improvements
adapterCapacityWattsand refining logic for determining adapter connection status. [1] [2]These changes collectively provide more detailed and configurable output power insights for users, both in the underlying data and in the app's UI.