UNPKG

@constructorfleet/ultimate-govee

Version:

Library for interacting with Govee devices written in Typescript.

40 lines 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IceMakerNuggetSizeState = exports.NuggetSizeStateName = void 0; const _ultimate_govee_common_1 = require("../../../../../common"); const states_1 = require("../../../states"); const types_1 = require("./types"); exports.NuggetSizeStateName = 'nuggetSize'; class IceMakerNuggetSizeState extends states_1.DeviceOpState { constructor(device) { super({ opType: _ultimate_govee_common_1.OpType.REPORT, identifier: [5], }, device, exports.NuggetSizeStateName, undefined); this.stateToCommand = (nextState) => { if (nextState === undefined) { this.logger.warn('Nugget size is undefined, ignoring command'); return undefined; } return { command: { data: { command: [ (0, _ultimate_govee_common_1.asOpCode)(_ultimate_govee_common_1.OpType.COMMAND, this.identifier, types_1.nuggetSizeMap[nextState.toString()]), ], }, }, status: { op: { command: [[types_1.nuggetSizeMap[nextState.toString()]]], }, }, }; }; } parseOpCommand(opCommand) { this.stateValue.next(types_1.NuggetSize[Object.entries(types_1.nuggetSizeMap).find(([_, num]) => num === opCommand[0])?.[0] ?? 'SMALL']); } } exports.IceMakerNuggetSizeState = IceMakerNuggetSizeState; //# sourceMappingURL=ice-maker.nugget-size.js.map