const { EventEmitter } = require('events'); const BaseState = require('./states/BaseState'); class HCControlBase extends EventEmitter { /** * @param {Object} configuration * @param {BaseState} state */ constructor(configuration, state) { super(); if (!configuration.name) throw new Error("Device name is missing"); this._configuration = configuration; this._state = state; this._name = this._configuration.name; } get state() { return this._state.clone(); } get type() { return "none"; } get name() { return this._name; } /** * Updates the state by polling the controlled device * @returns A promise which resolves when the state has been pulled */ pullState() { return Promise.resolve(); } } module.exports = HCControlBase;