MacBook Battery Health, Cycle Count & Power Adapter Telemetry #17
Notifications
Due Date
No due date set.
Depends on
Reference: gronod/MacMonitor#17
Reference in New Issue
Block a user
Resolved in Milestone 3. Implemented
MMBatteryTelemetryProvider.h/.mquerying IOKitAppleSmartBatteryproperties, cycle counts, maximum and design capacity, health condition evaluation, voltage, wattage, and power adapter status. Verified with unit tests. Merged intodevelop.Technical Implementation Plan & Code Solution
1. AppleSmartBattery & Power Source Architecture
On Intel MacBooks, power metrics are delivered through:
IOPowerSources.hfor high-level battery percentages and charger attachment.AppleSmartBatteryservice for hardware telemetry (cycle count, cell voltage, wear level, wattage).AppleSmartBatterynode and are handled gracefully.2. Objective-C Provider (
MMBatteryProvider.m)3. Swift UI Integration
4. Desktop Mac Handling
If
AppleSmartBatteryreturns 0 services, the provider immediately yieldsnil, allowing SwiftUI views to hide battery cards cleanly when running on an iMac, Mac mini, or Mac Pro.