@texturehq/device 1.3.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.
Files changed (182) hide show
  1. package/README.md +110 -0
  2. package/dist/common/constants.d.ts +3 -0
  3. package/dist/common/constants.d.ts.map +1 -0
  4. package/dist/common/constants.js +6 -0
  5. package/dist/common/constants.js.map +1 -0
  6. package/dist/common/exceptions.d.ts +5 -0
  7. package/dist/common/exceptions.d.ts.map +1 -0
  8. package/dist/common/exceptions.js +13 -0
  9. package/dist/common/exceptions.js.map +1 -0
  10. package/dist/common/logger.d.ts +2 -0
  11. package/dist/common/logger.d.ts.map +1 -0
  12. package/dist/common/logger.js +6 -0
  13. package/dist/common/logger.js.map +1 -0
  14. package/dist/common/supportLevel.d.ts +6 -0
  15. package/dist/common/supportLevel.d.ts.map +1 -0
  16. package/dist/common/supportLevel.js +14 -0
  17. package/dist/common/supportLevel.js.map +1 -0
  18. package/dist/common/utils/index.d.ts +2 -0
  19. package/dist/common/utils/index.d.ts.map +1 -0
  20. package/dist/common/utils/index.js +8 -0
  21. package/dist/common/utils/index.js.map +1 -0
  22. package/dist/common/utils/retryAxios.d.ts +18 -0
  23. package/dist/common/utils/retryAxios.d.ts.map +1 -0
  24. package/dist/common/utils/retryAxios.js +32 -0
  25. package/dist/common/utils/retryAxios.js.map +1 -0
  26. package/dist/deviceModel/entities.d.ts +211 -0
  27. package/dist/deviceModel/entities.d.ts.map +1 -0
  28. package/dist/deviceModel/entities.js +41 -0
  29. package/dist/deviceModel/entities.js.map +1 -0
  30. package/dist/deviceModel/getDeviceModel/index.d.ts +29 -0
  31. package/dist/deviceModel/getDeviceModel/index.d.ts.map +1 -0
  32. package/dist/deviceModel/getDeviceModel/index.js +50 -0
  33. package/dist/deviceModel/getDeviceModel/index.js.map +1 -0
  34. package/dist/deviceModel/getDeviceModel/response.interfaces.d.ts +95 -0
  35. package/dist/deviceModel/getDeviceModel/response.interfaces.d.ts.map +1 -0
  36. package/dist/deviceModel/getDeviceModel/response.interfaces.js +252 -0
  37. package/dist/deviceModel/getDeviceModel/response.interfaces.js.map +1 -0
  38. package/dist/deviceModel/getDeviceModel/test.fail.d.ts +2 -0
  39. package/dist/deviceModel/getDeviceModel/test.fail.d.ts.map +1 -0
  40. package/dist/deviceModel/getDeviceModel/test.fail.js +8 -0
  41. package/dist/deviceModel/getDeviceModel/test.fail.js.map +1 -0
  42. package/dist/deviceModel/getDeviceModel/test.success.d.ts +2 -0
  43. package/dist/deviceModel/getDeviceModel/test.success.d.ts.map +1 -0
  44. package/dist/deviceModel/getDeviceModel/test.success.js +8 -0
  45. package/dist/deviceModel/getDeviceModel/test.success.js.map +1 -0
  46. package/dist/deviceModel/getDeviceModelByManufacturerSlug/index.d.ts +36 -0
  47. package/dist/deviceModel/getDeviceModelByManufacturerSlug/index.d.ts.map +1 -0
  48. package/dist/deviceModel/getDeviceModelByManufacturerSlug/index.js +59 -0
  49. package/dist/deviceModel/getDeviceModelByManufacturerSlug/index.js.map +1 -0
  50. package/dist/deviceModel/getDeviceModelByManufacturerSlug/response.interfaces.d.ts +53 -0
  51. package/dist/deviceModel/getDeviceModelByManufacturerSlug/response.interfaces.d.ts.map +1 -0
  52. package/dist/deviceModel/getDeviceModelByManufacturerSlug/response.interfaces.js +210 -0
  53. package/dist/deviceModel/getDeviceModelByManufacturerSlug/response.interfaces.js.map +1 -0
  54. package/dist/deviceModel/getDeviceModelByManufacturerSlug/test.fail.d.ts +2 -0
  55. package/dist/deviceModel/getDeviceModelByManufacturerSlug/test.fail.d.ts.map +1 -0
  56. package/dist/deviceModel/getDeviceModelByManufacturerSlug/test.fail.js +8 -0
  57. package/dist/deviceModel/getDeviceModelByManufacturerSlug/test.fail.js.map +1 -0
  58. package/dist/deviceModel/getDeviceModelByManufacturerSlug/test.success.d.ts +2 -0
  59. package/dist/deviceModel/getDeviceModelByManufacturerSlug/test.success.d.ts.map +1 -0
  60. package/dist/deviceModel/getDeviceModelByManufacturerSlug/test.success.js +8 -0
  61. package/dist/deviceModel/getDeviceModelByManufacturerSlug/test.success.js.map +1 -0
  62. package/dist/deviceModel/getDeviceModels/index.d.ts +50 -0
  63. package/dist/deviceModel/getDeviceModels/index.d.ts.map +1 -0
  64. package/dist/deviceModel/getDeviceModels/index.js +60 -0
  65. package/dist/deviceModel/getDeviceModels/index.js.map +1 -0
  66. package/dist/deviceModel/getDeviceModels/response.interfaces.d.ts +95 -0
  67. package/dist/deviceModel/getDeviceModels/response.interfaces.d.ts.map +1 -0
  68. package/dist/deviceModel/getDeviceModels/response.interfaces.js +252 -0
  69. package/dist/deviceModel/getDeviceModels/response.interfaces.js.map +1 -0
  70. package/dist/deviceModel/getDeviceModels/test.success.d.ts +2 -0
  71. package/dist/deviceModel/getDeviceModels/test.success.d.ts.map +1 -0
  72. package/dist/deviceModel/getDeviceModels/test.success.js +11 -0
  73. package/dist/deviceModel/getDeviceModels/test.success.js.map +1 -0
  74. package/dist/deviceModel/index.d.ts +5 -0
  75. package/dist/deviceModel/index.d.ts.map +1 -0
  76. package/dist/deviceModel/index.js +21 -0
  77. package/dist/deviceModel/index.js.map +1 -0
  78. package/dist/deviceState/battery.d.ts +132 -0
  79. package/dist/deviceState/battery.d.ts.map +1 -0
  80. package/dist/deviceState/battery.js +81 -0
  81. package/dist/deviceState/battery.js.map +1 -0
  82. package/dist/deviceState/charger.d.ts +44 -0
  83. package/dist/deviceState/charger.d.ts.map +1 -0
  84. package/dist/deviceState/charger.js +34 -0
  85. package/dist/deviceState/charger.js.map +1 -0
  86. package/dist/deviceState/common.d.ts +50 -0
  87. package/dist/deviceState/common.d.ts.map +1 -0
  88. package/dist/deviceState/common.js +75 -0
  89. package/dist/deviceState/common.js.map +1 -0
  90. package/dist/deviceState/index.d.ts +7 -0
  91. package/dist/deviceState/index.d.ts.map +1 -0
  92. package/dist/deviceState/index.js +23 -0
  93. package/dist/deviceState/index.js.map +1 -0
  94. package/dist/deviceState/inverter.d.ts +79 -0
  95. package/dist/deviceState/inverter.d.ts.map +1 -0
  96. package/dist/deviceState/inverter.js +30 -0
  97. package/dist/deviceState/inverter.js.map +1 -0
  98. package/dist/deviceState/thermostat.d.ts +58 -0
  99. package/dist/deviceState/thermostat.d.ts.map +1 -0
  100. package/dist/deviceState/thermostat.js +51 -0
  101. package/dist/deviceState/thermostat.js.map +1 -0
  102. package/dist/deviceState/vehicle.d.ts +88 -0
  103. package/dist/deviceState/vehicle.d.ts.map +1 -0
  104. package/dist/deviceState/vehicle.js +72 -0
  105. package/dist/deviceState/vehicle.js.map +1 -0
  106. package/dist/deviceType/entities.d.ts +6 -0
  107. package/dist/deviceType/entities.d.ts.map +1 -0
  108. package/dist/deviceType/entities.js +14 -0
  109. package/dist/deviceType/entities.js.map +1 -0
  110. package/dist/deviceType/index.d.ts +2 -0
  111. package/dist/deviceType/index.d.ts.map +1 -0
  112. package/dist/deviceType/index.js +18 -0
  113. package/dist/deviceType/index.js.map +1 -0
  114. package/dist/index.d.ts +9 -0
  115. package/dist/index.d.ts.map +1 -0
  116. package/dist/index.js +25 -0
  117. package/dist/index.js.map +1 -0
  118. package/dist/manufacturer/entities.d.ts +124 -0
  119. package/dist/manufacturer/entities.d.ts.map +1 -0
  120. package/dist/manufacturer/entities.js +28 -0
  121. package/dist/manufacturer/entities.js.map +1 -0
  122. package/dist/manufacturer/getManufacturer/index.d.ts +34 -0
  123. package/dist/manufacturer/getManufacturer/index.d.ts.map +1 -0
  124. package/dist/manufacturer/getManufacturer/index.js +47 -0
  125. package/dist/manufacturer/getManufacturer/index.js.map +1 -0
  126. package/dist/manufacturer/getManufacturer/response.interfaces.d.ts +77 -0
  127. package/dist/manufacturer/getManufacturer/response.interfaces.d.ts.map +1 -0
  128. package/dist/manufacturer/getManufacturer/response.interfaces.js +234 -0
  129. package/dist/manufacturer/getManufacturer/response.interfaces.js.map +1 -0
  130. package/dist/manufacturer/getManufacturer/test.fail.d.ts +2 -0
  131. package/dist/manufacturer/getManufacturer/test.fail.d.ts.map +1 -0
  132. package/dist/manufacturer/getManufacturer/test.fail.js +8 -0
  133. package/dist/manufacturer/getManufacturer/test.fail.js.map +1 -0
  134. package/dist/manufacturer/getManufacturer/test.success.d.ts +2 -0
  135. package/dist/manufacturer/getManufacturer/test.success.d.ts.map +1 -0
  136. package/dist/manufacturer/getManufacturer/test.success.js +8 -0
  137. package/dist/manufacturer/getManufacturer/test.success.js.map +1 -0
  138. package/dist/manufacturer/getManufacturers/index.d.ts +51 -0
  139. package/dist/manufacturer/getManufacturers/index.d.ts.map +1 -0
  140. package/dist/manufacturer/getManufacturers/index.js +46 -0
  141. package/dist/manufacturer/getManufacturers/index.js.map +1 -0
  142. package/dist/manufacturer/getManufacturers/response.interfaces.d.ts +77 -0
  143. package/dist/manufacturer/getManufacturers/response.interfaces.d.ts.map +1 -0
  144. package/dist/manufacturer/getManufacturers/response.interfaces.js +242 -0
  145. package/dist/manufacturer/getManufacturers/response.interfaces.js.map +1 -0
  146. package/dist/manufacturer/getManufacturers/test.success.d.ts +2 -0
  147. package/dist/manufacturer/getManufacturers/test.success.d.ts.map +1 -0
  148. package/dist/manufacturer/getManufacturers/test.success.js +8 -0
  149. package/dist/manufacturer/getManufacturers/test.success.js.map +1 -0
  150. package/dist/manufacturer/index.d.ts +5 -0
  151. package/dist/manufacturer/index.d.ts.map +1 -0
  152. package/dist/manufacturer/index.js +21 -0
  153. package/dist/manufacturer/index.js.map +1 -0
  154. package/dist/manufacturer/parseManufacturer/index.d.ts +4 -0
  155. package/dist/manufacturer/parseManufacturer/index.d.ts.map +1 -0
  156. package/dist/manufacturer/parseManufacturer/index.js +42 -0
  157. package/dist/manufacturer/parseManufacturer/index.js.map +1 -0
  158. package/dist/metrics/aggregations.d.ts +5 -0
  159. package/dist/metrics/aggregations.d.ts.map +1 -0
  160. package/dist/metrics/aggregations.js +7 -0
  161. package/dist/metrics/aggregations.js.map +1 -0
  162. package/dist/metrics/groupBy.d.ts +5 -0
  163. package/dist/metrics/groupBy.d.ts.map +1 -0
  164. package/dist/metrics/groupBy.js +7 -0
  165. package/dist/metrics/groupBy.js.map +1 -0
  166. package/dist/metrics/index.d.ts +6 -0
  167. package/dist/metrics/index.d.ts.map +1 -0
  168. package/dist/metrics/index.js +22 -0
  169. package/dist/metrics/index.js.map +1 -0
  170. package/dist/metrics/range.d.ts +28 -0
  171. package/dist/metrics/range.d.ts.map +1 -0
  172. package/dist/metrics/range.js +138 -0
  173. package/dist/metrics/range.js.map +1 -0
  174. package/dist/metrics/units.d.ts +5 -0
  175. package/dist/metrics/units.d.ts.map +1 -0
  176. package/dist/metrics/units.js +31 -0
  177. package/dist/metrics/units.js.map +1 -0
  178. package/dist/metrics/window.d.ts +17 -0
  179. package/dist/metrics/window.d.ts.map +1 -0
  180. package/dist/metrics/window.js +28 -0
  181. package/dist/metrics/window.js.map +1 -0
  182. package/package.json +37 -0
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * The grid status.
4
+ * Shared for the inverter and battery devices.
5
+ * @example "exporting"
6
+ */
7
+ export declare const GridStatuses: readonly ["exporting", "importing", "idle", "unknown"];
8
+ export declare const GridStatusEnum: z.ZodEnum<["exporting", "importing", "idle", "unknown"]>;
9
+ export type GridStatus = z.infer<typeof GridStatusEnum>;
10
+ /**
11
+ * The recent estimate of power output to/from the grid in Watts (W).
12
+ * Positive values indicate importing from the grid, negative values indicate exporting to the grid.
13
+ * @example 5000
14
+ */
15
+ export declare const GridPower: z.ZodNumber;
16
+ /**
17
+ * Estimated recent grid energy usage in Watt-hours (Wh).
18
+ * @example 5000
19
+ */
20
+ export declare const GridEnergy: z.ZodNumber;
21
+ /**
22
+ * The charging state.
23
+ * @example "charging"
24
+ */
25
+ export declare const BatteryChargingState: readonly ["charging", "discharging", "idle", "unknown"];
26
+ export declare const BatteryChargingStateEnum: z.ZodEnum<["charging", "discharging", "idle", "unknown"]>;
27
+ export type BatteryChargingState = z.infer<typeof BatteryChargingStateEnum>;
28
+ /**
29
+ * Battery strategies or modes.
30
+ *
31
+ * This may not be exhaustive and may vary by manufacturer.
32
+ * But below are some of the most common strategies and modes that batteries offer in some form.
33
+ */
34
+ export declare const BatteryStrategies: readonly ["unknown", "self_consumption", "time_of_use", "backup"];
35
+ export declare const BatteryStrategiesEnum: z.ZodDefault<z.ZodEnum<["unknown", "self_consumption", "time_of_use", "backup"]>>;
36
+ export type BatteryStrategy = z.infer<typeof BatteryStrategiesEnum>;
37
+ export declare const CoreGridStateSchema: z.ZodObject<{
38
+ gridStatus: z.ZodOptional<z.ZodEnum<["exporting", "importing", "idle", "unknown"]>>;
39
+ gridPower: z.ZodOptional<z.ZodNumber>;
40
+ gridEnergy: z.ZodOptional<z.ZodNumber>;
41
+ }, "strip", z.ZodTypeAny, {
42
+ gridStatus?: "idle" | "unknown" | "exporting" | "importing" | undefined;
43
+ gridPower?: number | undefined;
44
+ gridEnergy?: number | undefined;
45
+ }, {
46
+ gridStatus?: "idle" | "unknown" | "exporting" | "importing" | undefined;
47
+ gridPower?: number | undefined;
48
+ gridEnergy?: number | undefined;
49
+ }>;
50
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/deviceState/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,YAAY,wDAAyD,CAAC;AACnF,eAAO,MAAM,cAAc,0DAEkD,CAAC;AAC9E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,SAAS,aAKnB,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,UAAU,aAAsF,CAAC;AAE9G;;;GAGG;AACH,eAAO,MAAM,oBAAoB,yDAA0D,CAAC;AAC5F,eAAO,MAAM,wBAAwB,2DAIlC,CAAC;AACJ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,mEAWpB,CAAC;AACX,eAAO,MAAM,qBAAqB,mFAEsC,CAAC;AACzE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAiB9B,CAAC"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CoreGridStateSchema = exports.BatteryStrategiesEnum = exports.BatteryStrategies = exports.BatteryChargingStateEnum = exports.BatteryChargingState = exports.GridEnergy = exports.GridPower = exports.GridStatusEnum = exports.GridStatuses = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * The grid status.
7
+ * Shared for the inverter and battery devices.
8
+ * @example "exporting"
9
+ */
10
+ exports.GridStatuses = ["exporting", "importing", "idle", "unknown"];
11
+ exports.GridStatusEnum = zod_1.z
12
+ .enum(exports.GridStatuses)
13
+ .describe("The current grid status (importing, exporting, idle, unknown).");
14
+ /**
15
+ * The recent estimate of power output to/from the grid in Watts (W).
16
+ * Positive values indicate importing from the grid, negative values indicate exporting to the grid.
17
+ * @example 5000
18
+ */
19
+ exports.GridPower = zod_1.z
20
+ .number()
21
+ .int()
22
+ .describe("The recent estimate of power output to/from the grid in Watts (W). Positive values indicate importing from the grid, negative values indicate exporting to the grid.");
23
+ /**
24
+ * Estimated recent grid energy usage in Watt-hours (Wh).
25
+ * @example 5000
26
+ */
27
+ exports.GridEnergy = zod_1.z.number().int().describe("Estimated recent grid energy usage in Watt-hours (Wh).");
28
+ /**
29
+ * The charging state.
30
+ * @example "charging"
31
+ */
32
+ exports.BatteryChargingState = ["charging", "discharging", "idle", "unknown"];
33
+ exports.BatteryChargingStateEnum = zod_1.z
34
+ .enum(exports.BatteryChargingState)
35
+ .describe("Whether the battery is currently charging. The state could be unknown if not provided by the manufacturer.");
36
+ /**
37
+ * Battery strategies or modes.
38
+ *
39
+ * This may not be exhaustive and may vary by manufacturer.
40
+ * But below are some of the most common strategies and modes that batteries offer in some form.
41
+ */
42
+ exports.BatteryStrategies = [
43
+ // If the battery strategy is unknown or not provided. Also used as a default value.
44
+ "unknown",
45
+ // With this strategy, the main goal is to minimize the amount of energy drawn from the grid.
46
+ // Charging from excess solar and discharging to offset grid usage will be prioritized.
47
+ "self_consumption",
48
+ // With this strategy, the main goal is use grid energy when it is cheap and minimize or export energy when it is expensive.
49
+ // This is typically defined by a time-of-use rate schedule. Defining different prices for different times of the day.
50
+ "time_of_use",
51
+ // With this strategy, the main goal is to keep the battery charged to a certain level (typically 100%) to be prepared for a power outage.
52
+ "backup",
53
+ ];
54
+ exports.BatteryStrategiesEnum = zod_1.z.enum(exports.BatteryStrategies)
55
+ .default("unknown")
56
+ .describe("The current strategy or mode the battery is operating in.");
57
+ exports.CoreGridStateSchema = zod_1.z.object({
58
+ // /**
59
+ // * The current grid status (importing, exporting, idle, unknown).
60
+ // * @example "exporting"
61
+ // */
62
+ gridStatus: exports.GridStatusEnum.optional(),
63
+ // /**
64
+ // * The recent estimate of power output to/from the grid in Watts (W).
65
+ // * Positive values indicate importing from the grid, negative values indicate exporting to the grid.
66
+ // * @example 5000
67
+ // */
68
+ gridPower: exports.GridPower.optional(),
69
+ // /**
70
+ // * Estimated recent grid energy usage in Watt-hours (Wh).
71
+ // * @example 5000
72
+ // */
73
+ gridEnergy: exports.GridEnergy.optional(),
74
+ });
75
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/deviceState/common.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB;;;;GAIG;AACU,QAAA,YAAY,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AACtE,QAAA,cAAc,GAAG,OAAC;KAC5B,IAAI,CAAC,oBAAY,CAAC;KAClB,QAAQ,CAAC,gEAAgE,CAAC,CAAC;AAG9E;;;;GAIG;AACU,QAAA,SAAS,GAAG,OAAC;KACvB,MAAM,EAAE;KACR,GAAG,EAAE;KACL,QAAQ,CACP,sKAAsK,CACvK,CAAC;AAEJ;;;GAGG;AACU,QAAA,UAAU,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC,CAAC;AAE9G;;;GAGG;AACU,QAAA,oBAAoB,GAAG,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAC/E,QAAA,wBAAwB,GAAG,OAAC;KACtC,IAAI,CAAC,4BAAoB,CAAC;KAC1B,QAAQ,CACP,4GAA4G,CAC7G,CAAC;AAGJ;;;;;GAKG;AACU,QAAA,iBAAiB,GAAG;IAC/B,oFAAoF;IACpF,SAAS;IACT,6FAA6F;IAC7F,uFAAuF;IACvF,kBAAkB;IAClB,4HAA4H;IAC5H,sHAAsH;IACtH,aAAa;IACb,0IAA0I;IAC1I,QAAQ;CACA,CAAC;AACE,QAAA,qBAAqB,GAAG,OAAC,CAAC,IAAI,CAAC,yBAAiB,CAAC;KAC3D,OAAO,CAAC,SAAS,CAAC;KAClB,QAAQ,CAAC,2DAA2D,CAAC,CAAC;AAG5D,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,MAAM;IACN,oEAAoE;IACpE,0BAA0B;IAC1B,MAAM;IACN,UAAU,EAAE,sBAAc,CAAC,QAAQ,EAAE;IACrC,MAAM;IACN,wEAAwE;IACxE,uGAAuG;IACvG,mBAAmB;IACnB,MAAM;IACN,SAAS,EAAE,iBAAS,CAAC,QAAQ,EAAE;IAC/B,MAAM;IACN,4DAA4D;IAC5D,mBAAmB;IACnB,MAAM;IACN,UAAU,EAAE,kBAAU,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from "./battery";
2
+ export * from "./charger";
3
+ export * from "./common";
4
+ export * from "./inverter";
5
+ export * from "./thermostat";
6
+ export * from "./vehicle";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deviceState/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./battery"), exports);
18
+ __exportStar(require("./charger"), exports);
19
+ __exportStar(require("./common"), exports);
20
+ __exportStar(require("./inverter"), exports);
21
+ __exportStar(require("./thermostat"), exports);
22
+ __exportStar(require("./vehicle"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/deviceState/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,6CAA2B;AAC3B,+CAA6B;AAC7B,4CAA0B"}
@@ -0,0 +1,79 @@
1
+ import { z } from "zod";
2
+ export declare const InverterStateSchema: z.ZodObject<{
3
+ power: z.ZodNumber;
4
+ batteryState: z.ZodOptional<z.ZodObject<{
5
+ chargingState: z.ZodEnum<["charging", "discharging", "idle", "unknown"]>;
6
+ charge: z.ZodNumber;
7
+ chargePercentage: z.ZodNumber;
8
+ chargeRate: z.ZodOptional<z.ZodNumber>;
9
+ backupReserve: z.ZodOptional<z.ZodNumber>;
10
+ isStormModeActive: z.ZodOptional<z.ZodBoolean>;
11
+ isStormModeEnabled: z.ZodOptional<z.ZodBoolean>;
12
+ strategy: z.ZodOptional<z.ZodDefault<z.ZodEnum<["unknown", "self_consumption", "time_of_use", "backup"]>>>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ chargingState: "idle" | "unknown" | "charging" | "discharging";
15
+ charge: number;
16
+ chargePercentage: number;
17
+ chargeRate?: number | undefined;
18
+ backupReserve?: number | undefined;
19
+ isStormModeActive?: boolean | undefined;
20
+ isStormModeEnabled?: boolean | undefined;
21
+ strategy?: "unknown" | "self_consumption" | "time_of_use" | "backup" | undefined;
22
+ }, {
23
+ chargingState: "idle" | "unknown" | "charging" | "discharging";
24
+ charge: number;
25
+ chargePercentage: number;
26
+ chargeRate?: number | undefined;
27
+ backupReserve?: number | undefined;
28
+ isStormModeActive?: boolean | undefined;
29
+ isStormModeEnabled?: boolean | undefined;
30
+ strategy?: "unknown" | "self_consumption" | "time_of_use" | "backup" | undefined;
31
+ }>>;
32
+ gridStatus: z.ZodOptional<z.ZodEnum<["exporting", "importing", "idle", "unknown"]>>;
33
+ gridPower: z.ZodOptional<z.ZodNumber>;
34
+ gridEnergy: z.ZodOptional<z.ZodNumber>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ power: number;
37
+ batteryState?: {
38
+ chargingState: "idle" | "unknown" | "charging" | "discharging";
39
+ charge: number;
40
+ chargePercentage: number;
41
+ chargeRate?: number | undefined;
42
+ backupReserve?: number | undefined;
43
+ isStormModeActive?: boolean | undefined;
44
+ isStormModeEnabled?: boolean | undefined;
45
+ strategy?: "unknown" | "self_consumption" | "time_of_use" | "backup" | undefined;
46
+ } | undefined;
47
+ gridStatus?: "idle" | "unknown" | "exporting" | "importing" | undefined;
48
+ gridPower?: number | undefined;
49
+ gridEnergy?: number | undefined;
50
+ }, {
51
+ power: number;
52
+ batteryState?: {
53
+ chargingState: "idle" | "unknown" | "charging" | "discharging";
54
+ charge: number;
55
+ chargePercentage: number;
56
+ chargeRate?: number | undefined;
57
+ backupReserve?: number | undefined;
58
+ isStormModeActive?: boolean | undefined;
59
+ isStormModeEnabled?: boolean | undefined;
60
+ strategy?: "unknown" | "self_consumption" | "time_of_use" | "backup" | undefined;
61
+ } | undefined;
62
+ gridStatus?: "idle" | "unknown" | "exporting" | "importing" | undefined;
63
+ gridPower?: number | undefined;
64
+ gridEnergy?: number | undefined;
65
+ }>;
66
+ export type InverterState = z.infer<typeof InverterStateSchema>;
67
+ export declare const InverterStaticStateSchema: z.ZodObject<{
68
+ /**
69
+ * The maximum power output of the inverter in watts (W).
70
+ * @example 5000
71
+ */
72
+ power: z.ZodNumber;
73
+ }, "strip", z.ZodTypeAny, {
74
+ power: number;
75
+ }, {
76
+ power: number;
77
+ }>;
78
+ export type InverterStaticState = z.infer<typeof InverterStaticStateSchema>;
79
+ //# sourceMappingURL=inverter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inverter.d.ts","sourceRoot":"","sources":["../../src/deviceState/inverter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAeH,CAAC;AAC9B,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,yBAAyB;IACpC;;;OAGG;;;;;;EAEH,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InverterStaticStateSchema = exports.InverterStateSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const battery_1 = require("./battery");
6
+ const common_1 = require("./common");
7
+ exports.InverterStateSchema = zod_1.z
8
+ .object({
9
+ /**
10
+ * The power output of the inverter in watts (W).
11
+ * @example 5000
12
+ */
13
+ power: zod_1.z.number().min(0).max(10_000_000).describe("The power output of the inverter in watts (W)."),
14
+ /**
15
+ * The current state of the battery (mostly for hybrid inverters with battery backup support).
16
+ * @optional
17
+ * @example { charge: 43200, chargePercentage: 50, chargingState: "charging" }
18
+ */
19
+ batteryState: battery_1.CoreBatteryStateSchema.optional(),
20
+ })
21
+ // attach grid state to inverter state
22
+ .merge(common_1.CoreGridStateSchema);
23
+ exports.InverterStaticStateSchema = zod_1.z.object({
24
+ /**
25
+ * The maximum power output of the inverter in watts (W).
26
+ * @example 5000
27
+ */
28
+ power: zod_1.z.number().min(0).max(10_000_000).describe("The maximum power output of the inverter in watts (W)."),
29
+ });
30
+ //# sourceMappingURL=inverter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inverter.js","sourceRoot":"","sources":["../../src/deviceState/inverter.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,uCAAmD;AACnD,qCAA+C;AAElC,QAAA,mBAAmB,GAAG,OAAC;KACjC,MAAM,CAAC;IACN;;;OAGG;IACH,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,gDAAgD,CAAC;IACnG;;;;OAIG;IACH,YAAY,EAAE,gCAAsB,CAAC,QAAQ,EAAE;CAChD,CAAC;IACF,sCAAsC;KACrC,KAAK,CAAC,4BAAmB,CAAC,CAAC;AAGjB,QAAA,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD;;;OAGG;IACH,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,wDAAwD,CAAC;CAC5G,CAAC,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * A thermostat operating mode.
4
+ * @example "cool"
5
+ */
6
+ export declare const ThermostatOperatingMode: readonly ["heat", "cool", "auto", "eco", "off", "unknown"];
7
+ export declare const ThermostatOperatingModeEnum: z.ZodEnum<["heat", "cool", "auto", "eco", "off", "unknown"]>;
8
+ export type ThermostatOperatingMode = z.infer<typeof ThermostatOperatingModeEnum>;
9
+ /**
10
+ * A thermostat fan mode.
11
+ * @example "on"
12
+ */
13
+ export declare const ThermostatFanMode: readonly ["auto", "on", "off", "circulate", "unknown"];
14
+ export declare const ThermostatFanModeEnum: z.ZodEnum<["auto", "on", "off", "circulate", "unknown"]>;
15
+ export type ThermostatFanMode = z.infer<typeof ThermostatFanModeEnum>;
16
+ export declare const ThermostatStateSchema: z.ZodObject<{
17
+ /**
18
+ * The ambient temperature in degrees Fahrenheit.
19
+ * @example 72
20
+ */
21
+ ambientTemperature: z.ZodNumber;
22
+ /**
23
+ * The current operating mode of the thermostat.
24
+ * @example "heat"
25
+ */
26
+ operatingMode: z.ZodEnum<["heat", "cool", "auto", "eco", "off", "unknown"]>;
27
+ /**
28
+ * The current target temperature for the cooling function in degrees Fahrenheit.
29
+ * @example 74
30
+ */
31
+ coolTarget: z.ZodOptional<z.ZodNumber>;
32
+ /**
33
+ * The current target temperature for the heating function in degrees Fahrenheit.
34
+ * @example 70
35
+ */
36
+ heatTarget: z.ZodOptional<z.ZodNumber>;
37
+ /**
38
+ * The current fan mode of the thermostat.
39
+ * @example "auto"
40
+ **/
41
+ fanMode: z.ZodEnum<["auto", "on", "off", "circulate", "unknown"]>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ ambientTemperature: number;
44
+ operatingMode: "auto" | "off" | "unknown" | "heat" | "cool" | "eco";
45
+ fanMode: "auto" | "off" | "on" | "unknown" | "circulate";
46
+ coolTarget?: number | undefined;
47
+ heatTarget?: number | undefined;
48
+ }, {
49
+ ambientTemperature: number;
50
+ operatingMode: "auto" | "off" | "unknown" | "heat" | "cool" | "eco";
51
+ fanMode: "auto" | "off" | "on" | "unknown" | "circulate";
52
+ coolTarget?: number | undefined;
53
+ heatTarget?: number | undefined;
54
+ }>;
55
+ export type ThermostatState = z.infer<typeof ThermostatStateSchema>;
56
+ export declare const ThermostatStaticStateSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
57
+ export type ThermostatStaticState = z.infer<typeof ThermostatStaticStateSchema>;
58
+ //# sourceMappingURL=thermostat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thermostat.d.ts","sourceRoot":"","sources":["../../src/deviceState/thermostat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,uBAAuB,4DAA6D,CAAC;AAClG,eAAO,MAAM,2BAA2B,8DAAkC,CAAC;AAC3E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,wDAAyD,CAAC;AACxF,eAAO,MAAM,qBAAqB,0DAA4B,CAAC;AAC/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEtE,eAAO,MAAM,qBAAqB;IAChC;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAKH;;;OAGG;;IAKH;;;QAGI;;;;;;;;;;;;;;EAEJ,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,2BAA2B,gDAAe,CAAC;AACxD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThermostatStaticStateSchema = exports.ThermostatStateSchema = exports.ThermostatFanModeEnum = exports.ThermostatFanMode = exports.ThermostatOperatingModeEnum = exports.ThermostatOperatingMode = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * A thermostat operating mode.
7
+ * @example "cool"
8
+ */
9
+ exports.ThermostatOperatingMode = ["heat", "cool", "auto", "eco", "off", "unknown"];
10
+ exports.ThermostatOperatingModeEnum = zod_1.z.enum(exports.ThermostatOperatingMode);
11
+ /**
12
+ * A thermostat fan mode.
13
+ * @example "on"
14
+ */
15
+ exports.ThermostatFanMode = ["auto", "on", "off", "circulate", "unknown"];
16
+ exports.ThermostatFanModeEnum = zod_1.z.enum(exports.ThermostatFanMode);
17
+ exports.ThermostatStateSchema = zod_1.z.object({
18
+ /**
19
+ * The ambient temperature in degrees Fahrenheit.
20
+ * @example 72
21
+ */
22
+ ambientTemperature: zod_1.z.number().describe("The ambient temperature in degrees Fahrenheit."),
23
+ /**
24
+ * The current operating mode of the thermostat.
25
+ * @example "heat"
26
+ */
27
+ operatingMode: exports.ThermostatOperatingModeEnum,
28
+ /**
29
+ * The current target temperature for the cooling function in degrees Fahrenheit.
30
+ * @example 74
31
+ */
32
+ coolTarget: zod_1.z
33
+ .number()
34
+ .optional()
35
+ .describe("The current target temperature for the cooling function in degrees Fahrenheit."),
36
+ /**
37
+ * The current target temperature for the heating function in degrees Fahrenheit.
38
+ * @example 70
39
+ */
40
+ heatTarget: zod_1.z
41
+ .number()
42
+ .optional()
43
+ .describe("The current target temperature for the heating function in degrees Fahrenheit."),
44
+ /**
45
+ * The current fan mode of the thermostat.
46
+ * @example "auto"
47
+ **/
48
+ fanMode: exports.ThermostatFanModeEnum,
49
+ });
50
+ exports.ThermostatStaticStateSchema = zod_1.z.object({});
51
+ //# sourceMappingURL=thermostat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thermostat.js","sourceRoot":"","sources":["../../src/deviceState/thermostat.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB;;;GAGG;AACU,QAAA,uBAAuB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAU,CAAC;AACrF,QAAA,2BAA2B,GAAG,OAAC,CAAC,IAAI,CAAC,+BAAuB,CAAC,CAAC;AAG3E;;;GAGG;AACU,QAAA,iBAAiB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,CAAU,CAAC;AAC3E,QAAA,qBAAqB,GAAG,OAAC,CAAC,IAAI,CAAC,yBAAiB,CAAC,CAAC;AAGlD,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C;;;OAGG;IACH,kBAAkB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;IACzF;;;OAGG;IACH,aAAa,EAAE,mCAA2B;IAC1C;;;OAGG;IACH,UAAU,EAAE,OAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,gFAAgF,CAAC;IAC7F;;;OAGG;IACH,UAAU,EAAE,OAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,gFAAgF,CAAC;IAC7F;;;QAGI;IACJ,OAAO,EAAE,6BAAqB;CAC/B,CAAC,CAAC;AAGU,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC"}
@@ -0,0 +1,88 @@
1
+ import { z } from "zod";
2
+ export declare const VehicleStateSchema: z.ZodObject<{
3
+ /**
4
+ * Whether the vehicle is currently charging. The state could be unknown if not provided by the manufacturer.
5
+ * @example "charging"
6
+ */
7
+ chargingState: z.ZodEnum<["charging", "discharging", "idle", "unknown"]>;
8
+ /**
9
+ * The current charge of the vehicle as a percentage. Represented as a number between 0 and 100.
10
+ * @example 50
11
+ */
12
+ chargePercentage: z.ZodNumber;
13
+ /**
14
+ * The estimated date and time when the vehicle will be fully charged.
15
+ * @example "2020-01-01T00:00:00.000Z"
16
+ */
17
+ chargeCompletedAt: z.ZodOptional<z.ZodString>;
18
+ /**
19
+ * The current charge limit of the vehicle as a percentage.
20
+ * @example 50
21
+ */
22
+ chargeLimit: z.ZodOptional<z.ZodNumber>;
23
+ /**
24
+ * The current charge of the vehicle battery in watt-hours (Wh).
25
+ * @example 43200
26
+ */
27
+ charge: z.ZodOptional<z.ZodNumber>;
28
+ /**
29
+ * Whether the vehicle is plugged in.
30
+ * @example true
31
+ */
32
+ isPluggedIn: z.ZodOptional<z.ZodBoolean>;
33
+ /**
34
+ * The voltage of the charger in volts (V).
35
+ * @example 240
36
+ */
37
+ chargerVoltage: z.ZodOptional<z.ZodNumber>;
38
+ /**
39
+ * The current of the charger in amps (A).
40
+ * @example 40
41
+ */
42
+ chargerCurrent: z.ZodOptional<z.ZodNumber>;
43
+ /**
44
+ * The wattage of the charger in watts (W).
45
+ * @example 7200
46
+ */
47
+ chargerWattage: z.ZodOptional<z.ZodNumber>;
48
+ /**
49
+ * The current (estimated) range of the vehicle in miles (mi).
50
+ * @example 300
51
+ */
52
+ range: z.ZodNumber;
53
+ }, "strip", z.ZodTypeAny, {
54
+ chargingState: "idle" | "unknown" | "charging" | "discharging";
55
+ chargePercentage: number;
56
+ range: number;
57
+ chargeCompletedAt?: string | undefined;
58
+ chargeLimit?: number | undefined;
59
+ charge?: number | undefined;
60
+ isPluggedIn?: boolean | undefined;
61
+ chargerVoltage?: number | undefined;
62
+ chargerCurrent?: number | undefined;
63
+ chargerWattage?: number | undefined;
64
+ }, {
65
+ chargingState: "idle" | "unknown" | "charging" | "discharging";
66
+ chargePercentage: number;
67
+ range: number;
68
+ chargeCompletedAt?: string | undefined;
69
+ chargeLimit?: number | undefined;
70
+ charge?: number | undefined;
71
+ isPluggedIn?: boolean | undefined;
72
+ chargerVoltage?: number | undefined;
73
+ chargerCurrent?: number | undefined;
74
+ chargerWattage?: number | undefined;
75
+ }>;
76
+ export type VehicleState = z.infer<typeof VehicleStateSchema>;
77
+ export declare const VehicleStaticStateSchema: z.ZodObject<{
78
+ /**
79
+ * The rated maximum capacity of the vehicle battery in watt-hours (Wh).
80
+ */
81
+ capacity: z.ZodNumber;
82
+ }, "strip", z.ZodTypeAny, {
83
+ capacity: number;
84
+ }, {
85
+ capacity: number;
86
+ }>;
87
+ export type VehicleStaticState = z.infer<typeof VehicleStaticStateSchema>;
88
+ //# sourceMappingURL=vehicle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vehicle.d.ts","sourceRoot":"","sources":["../../src/deviceState/vehicle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,kBAAkB;IAC7B;;;OAGG;;IAIH;;;OAGG;;IAMH;;;OAGG;;IAMH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,wBAAwB;IACnC;;OAEG;;;;;;EAEH,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VehicleStaticStateSchema = exports.VehicleStateSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("./common");
6
+ exports.VehicleStateSchema = zod_1.z.object({
7
+ /**
8
+ * Whether the vehicle is currently charging. The state could be unknown if not provided by the manufacturer.
9
+ * @example "charging"
10
+ */
11
+ chargingState: common_1.BatteryChargingStateEnum.describe("Whether the vehicle is currently charging. The state could be unknown if not provided by the manufacturer."),
12
+ /**
13
+ * The current charge of the vehicle as a percentage. Represented as a number between 0 and 100.
14
+ * @example 50
15
+ */
16
+ chargePercentage: zod_1.z
17
+ .number()
18
+ .min(0)
19
+ .max(100)
20
+ .describe("The current charge of the vehicle as a percentage. Represented as a number between 0 and 100."),
21
+ /**
22
+ * The estimated date and time when the vehicle will be fully charged.
23
+ * @example "2020-01-01T00:00:00.000Z"
24
+ */
25
+ chargeCompletedAt: zod_1.z
26
+ .string()
27
+ .datetime()
28
+ .optional()
29
+ .describe("The estimated date and time when the vehicle will be fully charged."),
30
+ /**
31
+ * The current charge limit of the vehicle as a percentage.
32
+ * @example 50
33
+ */
34
+ chargeLimit: zod_1.z.number().optional().describe("The current charge limit of the vehicle as a percentage."),
35
+ /**
36
+ * The current charge of the vehicle battery in watt-hours (Wh).
37
+ * @example 43200
38
+ */
39
+ charge: zod_1.z.number().min(0).optional().describe("The current charge of the vehicle battery in watt-hours (Wh)."),
40
+ /**
41
+ * Whether the vehicle is plugged in.
42
+ * @example true
43
+ */
44
+ isPluggedIn: zod_1.z.boolean().optional().describe("Whether the vehicle is plugged in."),
45
+ /**
46
+ * The voltage of the charger in volts (V).
47
+ * @example 240
48
+ */
49
+ chargerVoltage: zod_1.z.number().min(0).max(1_000).optional().describe("The voltage of the charger in volts (V)."),
50
+ /**
51
+ * The current of the charger in amps (A).
52
+ * @example 40
53
+ */
54
+ chargerCurrent: zod_1.z.number().min(0).max(1_000).optional().describe("The current of the charger in amps (A)."),
55
+ /**
56
+ * The wattage of the charger in watts (W).
57
+ * @example 7200
58
+ */
59
+ chargerWattage: zod_1.z.number().min(0).max(100_000).optional().describe("The wattage of the charger in watts (W)."),
60
+ /**
61
+ * The current (estimated) range of the vehicle in miles (mi).
62
+ * @example 300
63
+ */
64
+ range: zod_1.z.number().min(0).max(10_000).describe("The current (estimated) range of the vehicle in miles (mi)."),
65
+ });
66
+ exports.VehicleStaticStateSchema = zod_1.z.object({
67
+ /**
68
+ * The rated maximum capacity of the vehicle battery in watt-hours (Wh).
69
+ */
70
+ capacity: zod_1.z.number().describe("The rated maximum capacity of the vehicle battery in watt-hours (Wh)."),
71
+ });
72
+ //# sourceMappingURL=vehicle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vehicle.js","sourceRoot":"","sources":["../../src/deviceState/vehicle.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,qCAAoD;AAEvC,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC;;;OAGG;IACH,aAAa,EAAE,iCAAwB,CAAC,QAAQ,CAC9C,4GAA4G,CAC7G;IACD;;;OAGG;IACH,gBAAgB,EAAE,OAAC;SAChB,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CAAC,+FAA+F,CAAC;IAC5G;;;OAGG;IACH,iBAAiB,EAAE,OAAC;SACjB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CAAC,qEAAqE,CAAC;IAClF;;;OAGG;IACH,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;IACvG;;;OAGG;IACH,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;IAC9G;;;OAGG;IACH,WAAW,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IAClF;;;OAGG;IACH,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;IAC5G;;;OAGG;IACH,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IAC3G;;;OAGG;IACH,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;IAC9G;;;OAGG;IACH,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,6DAA6D,CAAC;CAC7G,CAAC,CAAC;AAGU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C;;OAEG;IACH,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uEAAuE,CAAC;CACvG,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const DeviceTypes: readonly ["battery", "charger", "inverter", "thermostat", "vehicle"];
3
+ export type DeviceType = (typeof DeviceTypes)[number];
4
+ export declare const DeviceTypeEnum: z.ZodEnum<["battery", "charger", "inverter", "thermostat", "vehicle"]>;
5
+ export declare const DeviceTypeLabelMap: Record<DeviceType, string>;
6
+ //# sourceMappingURL=entities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/deviceType/entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,WAAW,sEAAuE,CAAC;AAChG,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,eAAO,MAAM,cAAc,wEAAsB,CAAC;AAElD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAMzD,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeviceTypeLabelMap = exports.DeviceTypeEnum = exports.DeviceTypes = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.DeviceTypes = ["battery", "charger", "inverter", "thermostat", "vehicle"];
6
+ exports.DeviceTypeEnum = zod_1.z.enum(exports.DeviceTypes);
7
+ exports.DeviceTypeLabelMap = {
8
+ battery: "Battery",
9
+ charger: "Charger",
10
+ inverter: "Inverter",
11
+ thermostat: "Thermostat",
12
+ vehicle: "Vehicle",
13
+ };
14
+ //# sourceMappingURL=entities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../src/deviceType/entities.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,WAAW,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,CAAU,CAAC;AAEnF,QAAA,cAAc,GAAG,OAAC,CAAC,IAAI,CAAC,mBAAW,CAAC,CAAC;AAErC,QAAA,kBAAkB,GAA+B;IAC5D,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;CACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./entities";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deviceType/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./entities"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/deviceType/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B"}