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

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/CHANGELOG.md CHANGED
@@ -16,6 +16,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
16
  - do not configure it manually, always using Config UI X
17
17
  - required Homebridge v2.0.0 and above
18
18
 
19
+ ## [3.3.21] - (29.11.2024)
20
+
21
+ ## Changes
22
+
23
+ - move from commonJS to esm module, fixing [#180](https://github.com/grzegorz914/homebridge-melcloud-control/issues/180)
24
+
19
25
  ## [3.3.20] - (25.09.2024)
20
26
 
21
27
  ## Changes
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- const { HomebridgePluginUiServer, RequestError } = require('@homebridge/plugin-ui-utils');
4
- const MelCloud = require('../src/melcloud.js')
3
+ import { HomebridgePluginUiServer, RequestError } from '@homebridge/plugin-ui-utils';
4
+ import MelCloud from '../src/melcloud.js';
5
5
 
6
6
  class PluginUiServer extends HomebridgePluginUiServer {
7
7
  constructor() {
package/index.js CHANGED
@@ -1,27 +1,27 @@
1
1
  'use strict';
2
- const path = require('path');
3
- const fs = require('fs');
4
- const MelCloud = require('./src/melcloud.js')
5
- const DeviceAta = require('./src/deviceata.js')
6
- const DeviceAtw = require('./src/deviceatw.js')
7
- const DeviceErv = require('./src/deviceerv.js')
8
- const CONSTANTS = require('./src/constants.json');
2
+ import { join } from 'path';
3
+ import { mkdirSync } from 'fs';
4
+ import MelCloud from './src/melcloud.js';
5
+ import DeviceAta from './src/deviceata.js';
6
+ import DeviceAtw from './src/deviceatw.js';
7
+ import DeviceErv from './src/deviceerv.js';
8
+ import { PluginName, PlatformName } from './src/constants.json';
9
9
 
10
10
  class MelCloudPlatform {
11
11
  constructor(log, config, api) {
12
12
  // only load if configured
13
13
  if (!config || !Array.isArray(config.accounts)) {
14
- log.warn(`No configuration found for ${CONSTANTS.PluginName}`);
14
+ log.warn(`No configuration found for ${PluginName}`);
15
15
  return;
16
16
  }
17
17
  this.accessories = [];
18
18
  const accountsName = [];
19
19
 
20
20
  //create directory if it doesn't exist
21
- const prefDir = path.join(api.user.storagePath(), 'melcloud');
21
+ const prefDir = join(api.user.storagePath(), 'melcloud');
22
22
  try {
23
23
  //create directory if it doesn't exist
24
- fs.mkdirSync(prefDir, { recursive: true });
24
+ mkdirSync(prefDir, { recursive: true });
25
25
  } catch (error) {
26
26
  log.error(`Prepare directory error: ${error}`);
27
27
  return;
@@ -121,7 +121,7 @@ class MelCloudPlatform {
121
121
  airConditioner.on('publishAccessory', (accessory) => {
122
122
 
123
123
  //publish device
124
- api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
124
+ api.publishExternalAccessories(PluginName, [accessory]);
125
125
  log.success(`${accountName}, ${deviceTypeText} ${deviceName}, published as external accessory.`);
126
126
  })
127
127
  .on('devInfo', (devInfo) => {
@@ -166,7 +166,7 @@ class MelCloudPlatform {
166
166
  heatPump.on('publishAccessory', (accessory) => {
167
167
 
168
168
  //publish device
169
- api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
169
+ api.publishExternalAccessories(PluginName, [accessory]);
170
170
  log.success(`${accountName}, ${deviceTypeText} ${deviceName}, published as external accessory.`);
171
171
  })
172
172
  .on('devInfo', (devInfo) => {
@@ -211,7 +211,7 @@ class MelCloudPlatform {
211
211
  energyRecoveryVentilation.on('publishAccessory', (accessory) => {
212
212
 
213
213
  //publish device
214
- api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
214
+ api.publishExternalAccessories(PluginName, [accessory]);
215
215
  log.success(`${accountName}, ${deviceTypeText} ${deviceName}, published as external accessory.`);
216
216
  })
217
217
  .on('devInfo', (devInfo) => {
@@ -250,6 +250,6 @@ class MelCloudPlatform {
250
250
  };
251
251
  };
252
252
 
253
- module.exports = (api) => {
254
- api.registerPlatform(CONSTANTS.PluginName, CONSTANTS.PlatformName, MelCloudPlatform, true);
253
+ export default (api) => {
254
+ api.registerPlatform(PluginName, PlatformName, MelCloudPlatform, true);
255
255
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.3.31",
4
+ "version": "3.3.32-beta.0",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",