Läuft erst mal , speichern in SQLite-DB
This commit is contained in:
14
davis.js
14
davis.js
@@ -172,20 +172,16 @@ function parseLOOP1(pkt) {
|
||||
return {
|
||||
time: new Date(),
|
||||
tempOut: temp(pkt.readInt16LE(12)),
|
||||
tempOutHigh: null,
|
||||
tempOutLow: null,
|
||||
tempIn: temp(pkt.readInt16LE(9)),
|
||||
humOut: hum(pkt[33]),
|
||||
humIn: hum(pkt[11]),
|
||||
windAvg: mph(pkt[14]),
|
||||
windHigh: null,
|
||||
windGust: null,
|
||||
windDir: degToDir(pkt.readUInt16LE(16)),
|
||||
windHighDir: null,
|
||||
forecast: pkt[89],
|
||||
pressure: press === 0 ? null : r1(press * 33.8639 / 1000),
|
||||
rain: +(pkt.readUInt16LE(50) * RAIN_CLICK).toFixed(1),
|
||||
rainRate: +(pkt.readUInt16LE(41) * RAIN_CLICK).toFixed(1),
|
||||
solarRad: (pkt.readInt16LE(44) === 32767 || pkt.readInt16LE(44) < 0)
|
||||
? null : pkt.readInt16LE(44),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -217,19 +213,15 @@ function parseRecord(buf) {
|
||||
return {
|
||||
time: parseDateTime(dateWord, timeWord),
|
||||
tempOut: fTenthToC(buf.readInt16LE(4)),
|
||||
tempOutHigh: fTenthToC(buf.readInt16LE(6)),
|
||||
tempOutLow: fTenthToC(buf.readInt16LE(8)),
|
||||
tempIn: fTenthToC(buf.readInt16LE(20)),
|
||||
humOut: buf[23] === 255 ? null : buf[23],
|
||||
humIn: buf[22] === 255 ? null : buf[22],
|
||||
windAvg: mphToKmh(buf[24]),
|
||||
windHigh: mphToKmh(buf[25]),
|
||||
windGust: mphToKmh(buf[25]),
|
||||
windDir: windDirStr(buf[27]),
|
||||
windHighDir: windDirStr(buf[26]),
|
||||
pressure: inHgToHPa(buf.readUInt16LE(14)),
|
||||
rain: +(buf.readUInt16LE(10) * RAIN_CLICK).toFixed(1),
|
||||
rainRate: +(buf.readUInt16LE(12) * RAIN_CLICK).toFixed(1),
|
||||
solarRad: buf.readUInt16LE(16) === 32767 ? null : buf.readUInt16LE(16),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user