Battery items show up as null (demo script)

So I’ve modified the sample:

But only to output to boxcar rather than email. But at this point I’m just posting to the log.

I found my mail battery item was posting a null for name and state. I’ve added a couple of other items to the g_battery group and they report a value correctly. But I can’t see any differences in the Items defintion that would cause it (apart from the non working one being an mqtt binding.).

Here’s the one that doesn’t show up
Number bm1_battery "Battery [%.1f%%]" <battery> (g_bm,g_bm1,g_battery) {mqtt="<[mosquitto:e08586c94ef4/battery:state:default]"}

Here are the two that do:
Number apc1000_battery “Battery [%.1f%%]” (g_ups,g_apc1000,g_battery) {networkupstools=“apc1000:battery.charge”}
Number apc600_battery “Battery [%.1f%%]” (g_ups,g_apc600,g_battery) {networkupstools=“apc600:battery.charge”}

Here is the result of the script:
2016-12-19 09:59:23.921 [INFO ] [o.model.script.Battery Monitor] - Report produced: Battery levels:

apc600_battery: 100%
apc1000_battery: 100%

Here’s the output part of the script:
logInfo("Battery Monitor","Received Command")
if (! g_battery.allMembers.filter([state < lowBatteryThreshold]).empty)

logInfo(“Battery Monitor”,“Found some item(s) under threshold”)
val report = g_battery.allMembers.filter([state instanceof DecimalType]).sortBy([state]).map[
name + “: " + state.format(”%d%%")
val message = “Battery levels:\n\n” + report + “\n\nRegards,\n\nopenHab”`
logInfo(“Battery Monitor”,"Report produced: " + message)

//executeCommandLine("/etc/openhab/configurations/scripts/ " + message)