Battery Health Attribute

bfrench
Contributor III

In 11.11 a new attribute for macOS was released - Battery Health.  However the only value I see reported for any of my computers over 14.4 is Unknown.  Is anyone seeing this work?  There is a note stating that this will work for iOS but not iPadOS - but nothing about it not working for macOS.

1 ACCEPTED SOLUTION

bfrench
Contributor III

This appears to be a Known Issue

 

PI122901 Eligible computers and mobile devices may incorrectly display "Unknown" as a Battery Health status.

View solution in original post

4 REPLIES 4

Shyamsundar
Contributor III

i'm experiencing the same issue; all our Mac Devices are displaying as unknown in the results.

bfrench
Contributor III

This appears to be a Known Issue

 

PI122901 Eligible computers and mobile devices may incorrectly display "Unknown" as a Battery Health status.

snowfox
Contributor III

Try this extension attribute as a work around:

Battery Health Status

#!/bin/sh

result=`ioreg -r -c "AppleSmartBattery" | grep "PermanentFailureStatus" | awk '{print $3}' | sed s/\"//g`

if [ "$result" == "1" ]; then
result="Failure"
elif [ "$result" == "0" ]; then
result="OK"
fi

echo "<result>$result</result>"

 

ScottEKendall
New Contributor III

this is another script that you could use as well:

#!/bin/sh
#Determine model

arch=$(/usr/bin/arch)
model=`system_profiler SPHardwareDataType | grep "Model Name:" | cut -d ' ' -f 9`

if [[ ! "$model" =~ "Book" ]]; then
    echo "<result>Not A Laptop</result>"
    return 0
fi

if [ "$arch" == "arm64" ]; then
    capacity=$(system_profiler SPPowerDataType | grep "Maximum Capacity:" | sed 's/.*Maximum Capacity: //')
    echo "<result>$(system_profiler SPPowerDataType | grep "Condition:" | sed 's/.*Condition: //') with $capacity capacity</result>"
elif [ "$arch" == "i386" ]; then
    echo "<result>$(system_profiler SPPowerDataType | grep "Condition:" | sed 's/.*Condition: //')</result>"
else
    echo "<result>Unknown Architecture</result>"
fi