$descr .= ' (last ' . reformat_us_date($entry['upsBasicBatteryLastReplaceDate']) . ')';
        }
        discover_status($device, $oid, "upsAdvBatteryReplaceIndicator.{$index}", 'powernet-upsbatteryreplace-state', $descr, $entry['upsAdvBatteryReplaceIndicator'], array('entPhysicalClass' => 'other'));
    }
}
// State sensors
// PowerNet-MIB::upsAdvTestDiagnosticSchedule.0 = INTEGER: biweekly(2)
// PowerNet-MIB::upsAdvTestDiagnostics.0 = INTEGER: noTestDiagnostics(1)
// PowerNet-MIB::upsAdvTestDiagnosticsResults.0 = INTEGER: ok(1)
// PowerNet-MIB::upsAdvTestLastDiagnosticsDate.0 = STRING: "05/27/2015"
$cache['apc'] = snmp_get_multi($device, 'upsAdvTestDiagnosticSchedule.0 upsAdvTestDiagnosticsResults.0 upsAdvTestLastDiagnosticsDate.0', '-OQUs', 'PowerNet-MIB');
if (isset($cache['apc'][0]) && $cache['apc'][0]['upsAdvTestDiagnosticSchedule'] != 'never') {
    $oid = ".1.3.6.1.4.1.318.1.1.1.7.2.3.0";
    $descr = "Diagnostics Results";
    if ($cache['apc'][0]['upsAdvTestLastDiagnosticsDate']) {
        $descr .= ' (last ' . reformat_us_date($cache['apc'][0]['upsAdvTestLastDiagnosticsDate']) . ')';
    }
    discover_status($device, $oid, "upsAdvTestDiagnosticsResults.0", 'powernet-upstest-state', $descr, $cache['apc'][0]['upsAdvTestDiagnosticsResults'], array('entPhysicalClass' => 'other'));
}
// PowerNet-MIB::upsBasicOutputStatus.0 = INTEGER: onLine(2)
$value = snmp_get($device, "upsBasicOutputStatus.0", "-Oqv", "PowerNet-MIB");
if ($value !== '') {
    $oid = ".1.3.6.1.4.1.318.1.1.1.4.1.1.0";
    $descr = "Output Status";
    discover_sensor($valid['sensor'], 'state', $device, $oid, "upsBasicOutputStatus.0", 'powernet-upsbasicoutput-state', $descr, NULL, $value, array('entPhysicalClass' => 'power'));
}
#### ATS #############################################################################################
$inputs = snmp_get($device, "atsNumInputs.0", "-Ovq", "PowerNet-MIB");
$outputs = snmp_get($device, "atsNumOutputs.0", "-Ovq", "PowerNet-MIB");
// Check if we have values for these, if not, try other code paths below.
if ($inputs || $outputs) {
 /**
  * @dataProvider providerReformatUSDate
  * @group datetime
  */
 public function testReformatUSDate($value, $result)
 {
     $this->assertSame($result, reformat_us_date($value));
 }