@camstack/addon-provider-gree 0.1.8 → 0.1.9

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/dist/index.js CHANGED
@@ -1,22 +1,58 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_addon = require("./addon.js");
3
+ //#region src/gree-discovery.ts
4
+ /** Lowercase a MAC for stable keying (Gree echoes mixed-case MACs). */
5
+ function macKey(mac) {
6
+ return mac.toLowerCase();
7
+ }
8
+ /**
9
+ * Map Gree discovery rows to adoption candidates — one Thermostat-type candidate
10
+ * per AC. Every discovered AC is a valid candidate (there is no "unsupported"
11
+ * sub-kind — they are all air conditioners). Pure: no network I/O, no side
12
+ * effects. Mirrors `buildDreoCandidates`.
13
+ */
14
+ function buildGreeCandidates(input) {
15
+ const out = [];
16
+ for (const device of input.devices) {
17
+ const adoptedId = input.adopted.get(macKey(device.mac)) ?? null;
18
+ out.push({
19
+ childNativeId: macKey(device.mac),
20
+ name: device.name.length > 0 ? device.name : device.mac,
21
+ type: require_addon.DeviceType.Thermostat,
22
+ status: "online",
23
+ metadata: {
24
+ serialNumber: device.mac,
25
+ ...device.model !== void 0 ? { model: device.model } : {}
26
+ },
27
+ alreadyAdopted: adoptedId !== null,
28
+ adoptedDeviceId: adoptedId,
29
+ capabilities: ["climate-control", "fan-control"]
30
+ });
31
+ }
32
+ return out;
33
+ }
34
+ //#endregion
3
35
  exports.ADVERTISED_CAP_MODES = require_addon.ADVERTISED_CAP_MODES;
4
36
  exports.GREE_FAN_PERCENTAGE_STEP = require_addon.GREE_FAN_PERCENTAGE_STEP;
5
37
  exports.GreeProviderAddon = require_addon.GreeProviderAddon;
6
38
  exports.SUPPORTED_CAP_MODES = require_addon.SUPPORTED_CAP_MODES;
39
+ exports.bindOnce = require_addon.bindOnce;
7
40
  exports.boolToHorizontalSwing = require_addon.boolToHorizontalSwing;
8
41
  exports.boolToVerticalSwing = require_addon.boolToVerticalSwing;
9
42
  exports.buildConnectionFormSchema = require_addon.buildConnectionFormSchema;
10
- exports.buildGreeCandidates = require_addon.buildGreeCandidates;
43
+ exports.buildGreeCandidates = buildGreeCandidates;
11
44
  exports.capModeToLibMode = require_addon.capModeToLibMode;
12
45
  exports.fanSpeedToPercentage = require_addon.fanSpeedToPercentage;
13
- exports.greeAddonConfigSchema = require_addon.greeAddonConfigSchema;
46
+ exports.greeAcDeviceSchema = require_addon.greeAcDeviceSchema;
14
47
  exports.greeConfigSchema = require_addon.greeConfigSchema;
15
48
  exports.horizontalSwingToBool = require_addon.horizontalSwingToBool;
16
49
  exports.isAutoFan = require_addon.isAutoFan;
17
50
  exports.libModeToCapMode = require_addon.libModeToCapMode;
18
51
  exports.oscillatingToVerticalSwing = require_addon.oscillatingToVerticalSwing;
19
52
  exports.percentageToFanSpeed = require_addon.percentageToFanSpeed;
53
+ exports.resolveBroadcastTarget = require_addon.resolveBroadcastTarget;
54
+ exports.sameConnection = require_addon.sameConnection;
55
+ exports.settingsToGreeConfig = require_addon.settingsToGreeConfig;
20
56
  exports.swingToOscillating = require_addon.swingToOscillating;
21
57
  exports.toNodegreeOptions = require_addon.toNodegreeOptions;
22
58
  exports.verticalSwingToBool = require_addon.verticalSwingToBool;
package/dist/index.mjs CHANGED
@@ -1,2 +1,34 @@
1
- import { GreeProviderAddon, _ as greeAddonConfigSchema, a as boolToVerticalSwing, c as horizontalSwingToBool, d as oscillatingToVerticalSwing, f as percentageToFanSpeed, g as buildConnectionFormSchema, h as buildGreeCandidates, i as boolToHorizontalSwing, l as isAutoFan, m as verticalSwingToBool, n as GREE_FAN_PERCENTAGE_STEP, o as capModeToLibMode, p as swingToOscillating, r as SUPPORTED_CAP_MODES, s as fanSpeedToPercentage, t as ADVERTISED_CAP_MODES, u as libModeToCapMode, v as greeConfigSchema, y as toNodegreeOptions } from "./addon.mjs";
2
- export { ADVERTISED_CAP_MODES, GREE_FAN_PERCENTAGE_STEP, GreeProviderAddon, SUPPORTED_CAP_MODES, boolToHorizontalSwing, boolToVerticalSwing, buildConnectionFormSchema, buildGreeCandidates, capModeToLibMode, fanSpeedToPercentage, greeAddonConfigSchema, greeConfigSchema, horizontalSwingToBool, isAutoFan, libModeToCapMode, oscillatingToVerticalSwing, percentageToFanSpeed, swingToOscillating, toNodegreeOptions, verticalSwingToBool };
1
+ import { C as DeviceType, GreeProviderAddon, S as toNodegreeOptions, _ as sameConnection, a as boolToVerticalSwing, b as greeConfigSchema, c as horizontalSwingToBool, d as oscillatingToVerticalSwing, f as percentageToFanSpeed, g as resolveBroadcastTarget, h as bindOnce, i as boolToHorizontalSwing, l as isAutoFan, m as verticalSwingToBool, n as GREE_FAN_PERCENTAGE_STEP, o as capModeToLibMode, p as swingToOscillating, r as SUPPORTED_CAP_MODES, s as fanSpeedToPercentage, t as ADVERTISED_CAP_MODES, u as libModeToCapMode, v as buildConnectionFormSchema, x as settingsToGreeConfig, y as greeAcDeviceSchema } from "./addon.mjs";
2
+ //#region src/gree-discovery.ts
3
+ /** Lowercase a MAC for stable keying (Gree echoes mixed-case MACs). */
4
+ function macKey(mac) {
5
+ return mac.toLowerCase();
6
+ }
7
+ /**
8
+ * Map Gree discovery rows to adoption candidates — one Thermostat-type candidate
9
+ * per AC. Every discovered AC is a valid candidate (there is no "unsupported"
10
+ * sub-kind — they are all air conditioners). Pure: no network I/O, no side
11
+ * effects. Mirrors `buildDreoCandidates`.
12
+ */
13
+ function buildGreeCandidates(input) {
14
+ const out = [];
15
+ for (const device of input.devices) {
16
+ const adoptedId = input.adopted.get(macKey(device.mac)) ?? null;
17
+ out.push({
18
+ childNativeId: macKey(device.mac),
19
+ name: device.name.length > 0 ? device.name : device.mac,
20
+ type: DeviceType.Thermostat,
21
+ status: "online",
22
+ metadata: {
23
+ serialNumber: device.mac,
24
+ ...device.model !== void 0 ? { model: device.model } : {}
25
+ },
26
+ alreadyAdopted: adoptedId !== null,
27
+ adoptedDeviceId: adoptedId,
28
+ capabilities: ["climate-control", "fan-control"]
29
+ });
30
+ }
31
+ return out;
32
+ }
33
+ //#endregion
34
+ export { ADVERTISED_CAP_MODES, GREE_FAN_PERCENTAGE_STEP, GreeProviderAddon, SUPPORTED_CAP_MODES, bindOnce, boolToHorizontalSwing, boolToVerticalSwing, buildConnectionFormSchema, buildGreeCandidates, capModeToLibMode, fanSpeedToPercentage, greeAcDeviceSchema, greeConfigSchema, horizontalSwingToBool, isAutoFan, libModeToCapMode, oscillatingToVerticalSwing, percentageToFanSpeed, resolveBroadcastTarget, sameConnection, settingsToGreeConfig, swingToOscillating, toNodegreeOptions, verticalSwingToBool };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-gree",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Gree air-conditioner device-provider addon for CamStack — wraps the @apocaliss92/nodegree local-UDP client (LAN discovery + AES control), exposing climate-control and fan-control",
5
5
  "keywords": [
6
6
  "camstack",
@@ -42,19 +42,13 @@
42
42
  "icon": "assets/icon.svg",
43
43
  "color": "#0a7cff",
44
44
  "instanceMode": "multiple",
45
- "brokerKind": "gree",
45
+ "mode": "standalone",
46
46
  "execution": {
47
47
  "placement": "hub-only"
48
48
  },
49
49
  "capabilities": [
50
50
  {
51
51
  "name": "device-provider"
52
- },
53
- {
54
- "name": "broker"
55
- },
56
- {
57
- "name": "device-adoption"
58
52
  }
59
53
  ]
60
54
  }