UNPKG

homebridge-hatch-baby-rest

Version:
24 lines (23 loc) 721 B
import { distinctUntilChanged, map } from 'rxjs/operators'; import { IotDevice } from "./iot-device.js"; export class Restore extends IotDevice { model = 'Restore'; onSomeContentPlaying = this.onState.pipe(map((state) => state.content.playing !== 'none'), distinctUntilChanged()); onFirmwareVersion = this.onState.pipe(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); } }