homebridge-hatch-baby-rest
Version:
Homebridge plugin for Hatch Rest/Restore WiFi sound machines
31 lines (30 loc) • 978 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Restore = void 0;
const operators_1 = require("rxjs/operators");
const iot_device_1 = require("./iot-device");
class Restore extends iot_device_1.IotDevice {
constructor() {
super(...arguments);
this.model = 'Restore';
this.onSomeContentPlaying = this.onState.pipe((0, operators_1.map)((state) => state.content.playing !== 'none'), (0, operators_1.distinctUntilChanged)());
this.onFirmwareVersion = this.onState.pipe((0, operators_1.map)((state) => state.deviceInfo.f));
}
setContent(playing, step) {
this.update({
content: {
playing,
paused: false,
offset: 0,
step,
},
});
}
turnOnRoutine(step = 1) {
this.setContent('routine', step);
}
turnOff() {
this.setContent('none', 0);
}
}
exports.Restore = Restore;