AshMartian / homebridge-carwings

9 stars 9 forks source link

Incorrect charging status #9

Open joeshaw opened 6 years ago

joeshaw commented 6 years ago

The getCharging function determines if the car by calling indexOf("CHARGING") but this matches "NOT_CHARGING" as well, resulting in a false positive.

🍃 api BatteryStatusRecordsRequest 👍
{ status: 200,
  VoltLabel: { HighVolt: '240', LowVolt: '120' },
  BatteryStatusRecords:
   { OperationResult: 'START',
     OperationDateAndTime: '2017/10/30 23:55',
     BatteryStatus:
      { BatteryChargingStatus: 'NOT_CHARGING',
        BatteryCapacity: '240',
        BatteryRemainingAmount: '140',
        BatteryRemainingAmountWH: '14320',
        BatteryRemainingAmountkWH: '',
        SOC: [Object] },
     PluginState: 'CONNECTED',
     CruisingRangeAcOn: '97000',
     CruisingRangeAcOff: '103000',
     NotificationDateAndTime: '2017/10/30 23:56',
     TargetDate: '2017/10/30 23:55' } }