zigbee2mqtt/lib/extension/baseExtension.js

50 lines
1.5 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.
2018-11-16 12:23:11 -07:00
*/
constructor(zigbee, mqtt, state, publishEntityState) {
2018-11-16 12:23:11 -07:00
this.zigbee = zigbee;
this.mqtt = mqtt;
this.state = state;
this.publishEntityState = publishEntityState;
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 {Object?} message The received message (can be null)
* @param {Object?} device The device of the message (can be null)
* @param {Object?} mappedDevice The mapped device (can be null)
*/
2019-09-17 09:32:16 -07:00
// onZigbeeMessage(message, device, mappedDevice) {}
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;