Skip to content

Commit a8b4283

Browse files
authored
fix check of up to date data; fix null values
1 parent 85701b6 commit a8b4283

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

modules/integrations/abrp/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ const submitData = (akey) => {
7575
const now = parseInt(new Date() / 1000);
7676

7777
if (!err && dbRes && (data = dbRes[0])) {
78-
const socUpToDate = now < data.last_soc + 30;
79-
const locationUpToDate = now < data.last_location + 30;
78+
const socUpToDate = now < data.last_soc + 300;
79+
const locationUpToDate = now < data.last_location + 300;
8080

8181
if (data.abrp && cars[data.car] && (data.soc_display || data.soc_bms) && socUpToDate) {
8282
const abrpData = {
8383
utc: new Date() / 1000,
8484
soc: data.soc_display || data.soc_bms,
85-
speed: locationUpToDate ? data.gps_speed * 3.6 || null : null,
86-
lat: locationUpToDate ? data.latitude : null,
87-
lon: locationUpToDate ? data.longitude : null,
85+
speed: locationUpToDate ? data.gps_speed * 3.6 || 0 : 0,
86+
lat: locationUpToDate ? data.latitude : 0,
87+
lon: locationUpToDate ? data.longitude : 0,
8888
is_charging: data.charging,
8989
car_model: cars[data.car],
9090
power: data.dc_battery_power,

0 commit comments

Comments
 (0)