irtxrx 0.1.0 → 0.1.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.
@@ -39,6 +39,8 @@ export declare const CoolixCommand: {
39
39
  readonly CmdFan: 11714532;
40
40
  };
41
41
  export interface CoolixState {
42
+ /** When false, encodes as CoolixCommand.Off instead of a state frame. */
43
+ power?: boolean;
42
44
  /** Temperature in °C (17–30). Omit for Fan mode. */
43
45
  temp?: number;
44
46
  mode?: CoolixModeValue;
@@ -49,6 +51,7 @@ export interface CoolixState {
49
51
  }
50
52
  /**
51
53
  * Build a raw 24-bit Coolix code from a state object.
54
+ * When `power` is explicitly `false`, returns the Off command code.
52
55
  */
53
56
  export declare function buildCoolixRaw(state: CoolixState): number;
54
57
  /**
@@ -114,8 +114,11 @@ const COOLIX_TEMP_MIN = 17;
114
114
  const COOLIX_TEMP_MAX = 30;
115
115
  /**
116
116
  * Build a raw 24-bit Coolix code from a state object.
117
+ * When `power` is explicitly `false`, returns the Off command code.
117
118
  */
118
119
  function buildCoolixRaw(state) {
120
+ if (state.power === false)
121
+ return exports.CoolixCommand.Off;
119
122
  let raw = COOLIX_DEFAULT_STATE;
120
123
  // Fixed upper nibble 0xB (bits 20-23)
121
124
  raw = (raw & ~(0xF << 20)) | (0xB << 20);
@@ -39,6 +39,8 @@ export declare const CoolixCommand: {
39
39
  readonly CmdFan: 11714532;
40
40
  };
41
41
  export interface CoolixState {
42
+ /** When false, encodes as CoolixCommand.Off instead of a state frame. */
43
+ power?: boolean;
42
44
  /** Temperature in °C (17–30). Omit for Fan mode. */
43
45
  temp?: number;
44
46
  mode?: CoolixModeValue;
@@ -49,6 +51,7 @@ export interface CoolixState {
49
51
  }
50
52
  /**
51
53
  * Build a raw 24-bit Coolix code from a state object.
54
+ * When `power` is explicitly `false`, returns the Off command code.
52
55
  */
53
56
  export declare function buildCoolixRaw(state: CoolixState): number;
54
57
  /**
@@ -105,8 +105,11 @@ const COOLIX_TEMP_MIN = 17;
105
105
  const COOLIX_TEMP_MAX = 30;
106
106
  /**
107
107
  * Build a raw 24-bit Coolix code from a state object.
108
+ * When `power` is explicitly `false`, returns the Off command code.
108
109
  */
109
110
  export function buildCoolixRaw(state) {
111
+ if (state.power === false)
112
+ return CoolixCommand.Off;
110
113
  let raw = COOLIX_DEFAULT_STATE;
111
114
  // Fixed upper nibble 0xB (bits 20-23)
112
115
  raw = (raw & ~(0xF << 20)) | (0xB << 20);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "irtxrx",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "TypeScript library for encoding and decoding raw IR remote control frames",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",