homebridge-cct-dim-motor
Version:
Plugin for controlling Zigbee CCT DIM light and motor lift in HomeKit.
22 lines (15 loc) • 440 B
JavaScript
const mqtt = require('mqtt');
function mqttClient(brokerUrl, log) {
const client = mqtt.connect(brokerUrl);
client.on('connect', () => {
log('MQTT connected to ' + brokerUrl);
});
client.on('error', (err) => {
log('MQTT error: ' + err);
});
client.on('message', (topic, message) => {
log(`Received message from ${topic}: ${message}`);
});
return client;
}
module.exports = mqttClient;