UNPKG

@constructorfleet/ultimate-govee

Version:

Library for interacting with Govee devices written in Typescript.

49 lines 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.decodeH5182 = exports.H5182 = void 0; const packed_structures_1 = require("./packed-structures"); const fourProbesMapping = { 1: [1, 2], 65: [1, 2], 129: [1, 2], 193: [1, 2], 2: [3, 4], 66: [3, 4], 130: [3, 4], 194: [3, 4], }; const unpackPacket = (manufacturerData) => { const packet = Buffer.from(manufacturerData).toString('hex').slice(20, 39); const [probe1Temp, probe1Max, _, probe2Temp, probe2Max] = (0, packed_structures_1.unpack_hhbhh)(Buffer.from(packet)); return { firstProbe: { current: probe1Temp, max: probe1Max, }, secondProbe: { current: probe2Temp, max: probe2Max, }, }; }; const getProbeMeasurement = (advertisement) => { return unpackPacket(Buffer.from(advertisement.manufacturerData)); }; exports.H5182 = { brand: 'Govee', model: 'H5182', modelName: 'WiFi Meat Thermometer', type: ['BBQ'], }; const decodeH5182 = (advertisement) => { const unpacked1and2 = getProbeMeasurement(advertisement); return { probes: { probe1: unpacked1and2?.firstProbe, probe2: unpacked1and2?.secondProbe, }, ...exports.H5182, }; }; exports.decodeH5182 = decodeH5182; //# sourceMappingURL=H5182.decoder.js.map