diff --git a/src/measurement.js b/src/measurement.js index d526d586..65229876 100644 --- a/src/measurement.js +++ b/src/measurement.js @@ -41,9 +41,13 @@ class Measurement { case 'Volts': return 'V'; case 'l': - return 'lit'; + return 'L'; case 'L': - return 'lit'; + return 'L'; + //case 'l': + //return 'lit'; + //case 'L': + // return 'lit'; // these are states case 'Stat': case 'N/A': @@ -79,8 +83,11 @@ class Measurement { // km/L = (1.609344 / 3.785411784) * MPG value = _.round(value / (1.609344 / 3.785411784), 1); break; - case 'lit': + case 'L': value = _.round(value / 3.785411784, 1); + //case 'lit': + // value = _.round(value / 3.785411784, 1); + break; } return value; @@ -103,7 +110,7 @@ class Measurement { return 'mpg(e)'; case 'km/l': return 'mpg'; - case 'lit': + case 'L': return 'gal'; default: return unit; diff --git a/src/mqtt.js b/src/mqtt.js index 2ede50e4..fc29f955 100644 --- a/src/mqtt.js +++ b/src/mqtt.js @@ -239,13 +239,30 @@ class MQTT { case 'PRIORITY CHARGE INDICATOR': // FALSE/TRUE case 'PRIORITY CHARGE STATUS': // NOT_ACTIVE/ACTIVE return this.mapBinarySensorConfigPayload(diag, diagEl); - // no device class, camel case name + // new device class, camel case name + case 'GAS RANGE': + case 'GAS RANGE MI': case 'EV RANGE': + case 'EV RANGE MI': case 'ODOMETER': + case 'ODOMETER MI': case 'LAST TRIP TOTAL DISTANCE': + case 'LAST TRIP TOTAL DISTANCE MI': + return this.mapSensorConfigPayload(diag, diagEl, 'distance'); + case 'LIFETIME FUEL USED': + case 'LIFETIME FUEL USED GAL': + return this.mapSensorConfigPayload(diag, diagEl, 'volume'); + case 'FUEL AMOUNT': + case 'FUEL AMOUNT GAL': + case 'FUEL CAPACITY': + case 'FUEL CAPACITY GAL': + case 'FUEL LEVEL IN GAL': + case 'FUEL LEVEL IN GAL GAL': + return this.mapSensorConfigPayload(diag, diagEl, 'volume_storage'); + // no device class, camel case name case 'LAST TRIP ELECTRIC ECON': - case 'LIFETIME MPGE': - case 'CHARGER POWER LEVEL': + case 'LIFETIME MPGE': + case 'CHARGER POWER LEVEL': default: return this.mapSensorConfigPayload(diag, diagEl); }