zigbee2mqtt/lib/extension/baseExtension.js

53 lines
1.6 KiB
JavaScript
Raw Normal View History

2019-09-17 09:32:16 -07:00
class BaseExtension {
2018-11-16 12:23:11 -07:00
/**
* Besides intializing variables, the constructor should do nothing!
*
* @param {Zigbee} zigbee Zigbee controller
* @param {MQTT} mqtt MQTT controller
* @param {State} state State controller
* @param {Function} publishEntityState Method to publish device state to MQTT.
* @param {EventBus} eventBus The event bus
2018-11-16 12:23:11 -07:00
*/
constructor(zigbee, mqtt, state, publishEntityState, eventBus) {
2018-11-16 12:23:11 -07:00
this.zigbee = zigbee;
this.mqtt = mqtt;
this.state = state;
this.publishEntityState = publishEntityState;
this.eventBus = eventBus;
2018-11-16 12:23:11 -07:00
}
/**
* This method is called by the controller once Zigbee has been started.
*/
2019-09-17 09:32:16 -07:00
// onZigbeeStarted() {}
2018-11-16 12:23:11 -07:00
/**
* This method is called by the controller once connected to the MQTT server.
*/
2019-09-17 09:32:16 -07:00
// onMQTTConnected() {}
2018-11-16 12:23:11 -07:00
/**
* Is called when a Zigbee message from a device is received.
* @param {string} type Type of the message
* @param {Object} data Data of the message
* @param {Object?} mappedDevice The mapped device
* @param {Object?} settingsDevice Device settings
2018-11-16 12:23:11 -07:00
*/
// onZigbeeEvent(type, data, mappedDevice, settingsDevice) {}
2018-11-16 12:23:11 -07:00
/**
* Is called when a MQTT message is received
* @param {string} topic Topic on which the message was received
* @param {Object} message The received message
* @return {boolean} if the message was handled
*/
2019-09-17 09:32:16 -07:00
// onMQTTMessage(topic, message) {}
2018-11-16 12:23:11 -07:00
/**
* Is called once the extension has to stop
*/
2019-09-17 09:32:16 -07:00
// stop() {}
2018-11-16 12:23:11 -07:00
}
2019-09-17 09:32:16 -07:00
module.exports = BaseExtension;