zigbee2mqtt/lib/extension/extensionTemplate.js

58 lines
1.7 KiB
JavaScript
Raw Normal View History

Zigbee-herdsman (#1945) * Update zigbee-herdsman and zigbee-shepherd-converters. * Force Aqara S2 Lock endvices (#1764) * Start on zigbee-herdsman controller refactor. * More updates. * Cleanup zapp. * updates. * Propagate adapter disconnected event. * Updates. * Initial refactor to zigbee-herdsman. * Refactor deviceReceive to zigbee-herdsman. * Rename * Refactor deviceConfigure. * Finish bridge config. * Refactor availability. * Active homeassistant extension and more refactors. * Refactor groups. * Enable soft reset. * Activate group membership * Start on tests. * Enable reporting. * Add more controller tests. * Add more tests * Fix linting error. * Data en deviceReceive tests. * Move to zigbee-herdsman-converters. * More device publish tests. * Cleanup dependencies. * Bring device publish coverage to 100. * Bring home assistant test coverage to 100. * Device configure tests. * Attempt to fix tests. * Another attempt. * Another one. * Another one. * Another. * Add wait. * Longer wait. * Debug. * Update dependencies. * Another. * Begin on availability tests. * Improve availability tests. * Complete deviceAvailability tests. * Device bind tests. * More tests. * Begin networkmap refactors. * start on networkmap tests. * Network map tests. * Add utils tests. * Logger tests. * Settings and logger tests. * Ignore some stuff for coverage and add todos. * Add remaining missing tests. * Enforce 100% test coverage. * Start on groups test and refactor entityPublish to resolveEntity * Remove joinPathStorage, not used anymore as group information is stored into zigbee-herdsman database. * Fix linting issues. * Improve tests. * Add groups. * fix group membership. * Group: log names. * Convert MQTT message to string by default. * Fix group name. * Updates. * Revert configuration.yaml. * Add new line. * Fixes. * Updates. * Fix tests. * Ignore soft reset extension.
2019-09-09 10:48:09 -07:00
/* istanbul ignore file */
2018-11-16 12:23:11 -07:00
/**
* This extensions is for documentation purposes only.
* It describes all methods that are called by the controller.
*/
class ExtensionTemplate {
/**
* 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.
*/
onZigbeeStarted() {}
/**
* This method is called by the controller once connected to the MQTT server.
*/
onMQTTConnected() {}
/**
* 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)
*/
onZigbeeMessage(message, device, mappedDevice) {}
/**
* 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
*/
onMQTTMessage(topic, message) {
return false;
}
/**
* Is called once the extension has to stop
*/
stop() {}
}
module.exports = ExtensionTemplate;