const HCControlBase = require('./ControlBase'); const SwitchState = require('./states/SwitchState'); class HCSwitchBase extends HCControlBase { constructor(config) { super(config, new SwitchState()); } get type() { return "switch"; } turnOn() { return Promise.reject(new Error("Not implemented")); } turnOff() { return Promise.reject(new Error("Not implemented")); } togglePower() { if(this.state.on) { return this.turnOff(); } else { return this.turnOn(); } } } module.exports = HCSwitchBase;