When running this command on a M4 Mac mini:
ioreg -n AppleSmartBattery -r -a
it's returning some information about the power supply, but with no battery attached:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>AdapterDetails</key>
<dict>
<key>FamilyCode</key>
<integer>0</integer>
</dict>
<key>AdapterInfo</key>
<integer>0</integer>
<key>Amperage</key>
<integer>0</integer>
<key>AppleRawAdapterDetails</key>
<array/>
<key>BatteryInstalled</key>
<false/>
<key>BatteryInvalidWakeSeconds</key>
<integer>30</integer>
<key>BestAdapterIndex</key>
<integer>0</integer>
<key>BootPathUpdated</key>
<integer>1742044085</integer>
<key>CurrentCapacity</key>
<integer>0</integer>
<key>CycleCount</key>
<integer>0</integer>
<key>ExternalChargeCapable</key>
<true/>
<key>ExternalConnected</key>
<true/>
<key>FullPathUpdated</key>
<integer>1742049567</integer>
<key>IOGeneralInterest</key>
<string>IOCommand is not serializable</string>
<key>IOObjectClass</key>
<string>AppleSmartBattery</string>
<key>IOObjectRetainCount</key>
<integer>8</integer>
<key>IORegistryEntryID</key>
<integer>4294969686</integer>
<key>IORegistryEntryName</key>
<string>AppleSmartBattery</string>
<key>IOReportLegend</key>
<array>
<dict>
<key>IOReportChannelInfo</key>
<dict>
<key>IOReportChannelUnit</key>
<integer>0</integer>
</dict>
<key>IOReportChannels</key>
<array>
<array>
<integer>7167869599145487988</integer>
<integer>6460407809</integer>
<string>BatteryCycleCount</string>
</array>
</array>
<key>IOReportGroupName</key>
<string>Battery</string>
</dict>
</array>
<key>IOReportLegendPublic</key>
<true/>
<key>IOServiceBusyState</key>
<integer>0</integer>
<key>IOServiceBusyTime</key>
<integer>8132208</integer>
<key>IOServiceState</key>
<integer>30</integer>
<key>IsCharging</key>
<false/>
<key>Location</key>
<integer>0</integer>
<key>MaxCapacity</key>
<integer>0</integer>
<key>PostChargeWaitSeconds</key>
<integer>120</integer>
<key>PostDischargeWaitSeconds</key>
<integer>120</integer>
<key>TimeRemaining</key>
<integer>0</integer>
<key>UpdateTime</key>
<integer>1742049567</integer>
<key>Voltage</key>
<integer>0</integer>
<key>built-in</key>
<true/>
</dict>
</array>
</plist>
The library is creating a battery structure with all values at zero.
I guess we could check for the BatteryInstalled key?
I can propose a PR 👍🏻
When running this command on a M4 Mac mini:
ioreg -n AppleSmartBattery -r -ait's returning some information about the power supply, but with no battery attached:
The library is creating a battery structure with all values at zero.
I guess we could check for the
BatteryInstalledkey?I can propose a PR 👍🏻