@pietrolubini/homebridge-ecoflow
Version:
Homebridge plugin for EcoFlow devices
34 lines • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SmartPlugSimulator = void 0;
const smartPlugMqttApiContracts_1 = require("@ecoflow/accessories/smartplug/interfaces/smartPlugMqttApiContracts");
const simulator_1 = require("@ecoflow/apis/simulations/simulator");
class SmartPlugSimulator extends simulator_1.SimulatorTyped {
generateQuota() {
const quota = {
cmdFunc: smartPlugMqttApiContracts_1.SmartPlugMqttMessageFuncType.Func2,
cmdId: smartPlugMqttApiContracts_1.SmartPlugMqttMessageType.Heartbeat,
param: {
brightness: Math.floor(this.getRandomNumber(0, 1023)),
current: this.getRandomNumber(0, 100000),
volt: this.getRandomNumber(180, 240),
switchSta: this.getRandomBoolean(),
temp: this.getRandomNumber(10, 40),
watts: this.getRandomNumber(0, 2500),
},
};
return quota;
}
generateSetReplyTyped(message) {
const reply = {
id: message.id,
version: message.version,
data: {
ack: false,
},
};
return reply;
}
}
exports.SmartPlugSimulator = SmartPlugSimulator;
//# sourceMappingURL=smartPlugSimulator.js.map