homebridge-melcloud-control 3.3.31 → 3.3.32-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/mqtt.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const AsyncMqtt = require("async-mqtt");
3
- const EventEmitter = require('events');
2
+ import { connectAsync } from "async-mqtt";
3
+ import EventEmitter from 'events';
4
4
 
5
5
  class Mqtt extends EventEmitter {
6
6
  constructor(config) {
@@ -16,7 +16,7 @@ class Mqtt extends EventEmitter {
16
16
  this.on('connect', async () => {
17
17
  try {
18
18
  //connect
19
- this.mqttClient = await AsyncMqtt.connectAsync(url, options);
19
+ this.mqttClient = await connectAsync(url, options);
20
20
  this.emit('connected', 'MQTT Connected.');
21
21
 
22
22
  //subscribe
@@ -52,4 +52,4 @@ class Mqtt extends EventEmitter {
52
52
  this.emit('connect');
53
53
  };
54
54
  };
55
- module.exports = Mqtt;
55
+ export default Mqtt;
package/src/restful.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const express = require('express');
3
- const EventEmitter = require('events');
2
+ import express, { json } from 'express';
3
+ import EventEmitter from 'events';
4
4
 
5
5
  class RestFul extends EventEmitter {
6
6
  constructor(config) {
@@ -20,7 +20,7 @@ class RestFul extends EventEmitter {
20
20
  try {
21
21
  const restFul = express();
22
22
  restFul.set('json spaces', 2);
23
- restFul.use(express.json());
23
+ restFul.use(json());
24
24
  restFul.get('/info', (req, res) => { res.json(this.restFulData.info) });
25
25
  restFul.get('/state', (req, res) => { res.json(this.restFulData.state) });
26
26
 
@@ -62,4 +62,4 @@ class RestFul extends EventEmitter {
62
62
  const emitDebug = this.restFulDebug ? this.emit('debug', `RESTFul update path: ${path}, data: ${data}`) : false;
63
63
  };
64
64
  };
65
- module.exports = RestFul;
65
+ export default RestFul;