-
Notifications
You must be signed in to change notification settings - Fork 9
/
status.php
42 lines (34 loc) · 1.83 KB
/
status.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php require_once("init.inc.php") ?>
<?php $title = 'LEAF Status'; include("header.inc.php") ?>
<?php
$option = isset($_GET['cached']) ? NissanConnect::STATUS_QUERY_OPTION_CACHED : NissanConnect::STATUS_QUERY_OPTION_NONE;
try {
$result = $nissanConnect->getStatus($option);
} catch (Exception $ex) {
die($ex->getMessage());
}
?>
Battery: <?php echo "$result->BatteryRemainingAmount/$result->BatteryCapacity (" . round($result->BatteryRemainingAmount*100.0/$result->BatteryCapacity) . "%)" ?><br/>
<hr/>
Plugged in: <?php echo ($result->PluggedIn ? '<span class="on">YES</span>' : '<span class="off">NO</span>') ?><br/>
Charging: <?php echo ($result->Charging ? '<span class="on">YES</span>' : '<span class="off">NO</span>') ?><br/>
Charge Time:<br/>
<?php if (!empty($result->TimeRequiredToFull->Formatted)): ?>
<span class="charge_trickle">Trickle (120v): <?php echo $result->TimeRequiredToFull->Formatted ?><br/></span>
<?php endif; ?>
<?php if (!empty($result->TimeRequiredToFull200->Formatted)): ?>
<span class="charge_220">Normal (240v) 3.6 kW: <?php echo $result->TimeRequiredToFull200->Formatted ?><br/></span>
<?php endif; ?>
<?php if (!empty($result->TimeRequiredToFull200_6kW->Formatted)): ?>
<span class="charge_220_66">Normal (240v) 6.6 kW: <?php echo $result->TimeRequiredToFull200_6kW->Formatted ?><br/></span>
<?php endif; ?>
<hr/>
Climate control: <?php echo ($result->RemoteACRunning ? '<span class="on">ON</span>' : '<span class="off">OFF</span>') ?><br/>
<hr/>
Range:
<?php echo round($result->CruisingRangeAcOff) . ' ' . $result->CruisingRangeUnit ?><br/>
<span class="range_wclimate">(-<?php echo round($result->CruisingRangeAcOff - $result->CruisingRangeAcOn) . ' ' . $result->CruisingRangeUnit ?> w/climate control)<br/>
<hr/>
Last Updated: <?php echo $result->LastUpdated ?><br/>
<hr/>
<?php include("footer.inc.php") ?>