@texturehq/device 1.8.0 → 1.10.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/dist/deviceModel/entities.d.ts +3 -3
- package/dist/deviceState/battery.d.ts +48 -6
- package/dist/deviceState/battery.d.ts.map +1 -1
- package/dist/deviceState/inverter.d.ts +15 -5
- package/dist/deviceState/inverter.d.ts.map +1 -1
- package/dist/deviceState/vehicle.d.ts +4 -4
- package/dist/deviceType/entities.d.ts +2 -2
- package/dist/deviceType/entities.d.ts.map +1 -1
- package/dist/deviceType/entities.js +3 -1
- package/dist/deviceType/entities.js.map +1 -1
- package/package.json +6 -5
|
@@ -27,7 +27,7 @@ export declare const DeviceModelSchema: z.ZodObject<{
|
|
|
27
27
|
* The type of the device.
|
|
28
28
|
* @example "inverter"
|
|
29
29
|
*/
|
|
30
|
-
type: z.ZodEnum<["battery", "charger", "inverter", "thermostat", "vehicle"]>;
|
|
30
|
+
type: z.ZodEnum<["battery", "charger", "inverter", "thermostat", "vehicle", "other", "unknown"]>;
|
|
31
31
|
/**
|
|
32
32
|
* The manufacturer of the device.
|
|
33
33
|
*/
|
|
@@ -146,7 +146,7 @@ export declare const DeviceModelSchema: z.ZodObject<{
|
|
|
146
146
|
}>, "many">;
|
|
147
147
|
}, "strip", z.ZodTypeAny, {
|
|
148
148
|
name: string;
|
|
149
|
-
type: "battery" | "charger" | "inverter" | "thermostat" | "vehicle";
|
|
149
|
+
type: "unknown" | "other" | "battery" | "charger" | "inverter" | "thermostat" | "vehicle";
|
|
150
150
|
slug: string;
|
|
151
151
|
manufacturer: {
|
|
152
152
|
name: string;
|
|
@@ -177,7 +177,7 @@ export declare const DeviceModelSchema: z.ZodObject<{
|
|
|
177
177
|
}[];
|
|
178
178
|
}, {
|
|
179
179
|
name: string;
|
|
180
|
-
type: "battery" | "charger" | "inverter" | "thermostat" | "vehicle";
|
|
180
|
+
type: "unknown" | "other" | "battery" | "charger" | "inverter" | "thermostat" | "vehicle";
|
|
181
181
|
slug: string;
|
|
182
182
|
manufacturer: {
|
|
183
183
|
name: string;
|
|
@@ -69,14 +69,56 @@ export declare const CoreBatteryStateSchema: z.ZodObject<{
|
|
|
69
69
|
strategy?: "unknown" | "self_consumption" | "time_of_use" | "backup" | undefined;
|
|
70
70
|
}>;
|
|
71
71
|
export declare const BatteryStateSchema: z.ZodObject<{
|
|
72
|
+
/**
|
|
73
|
+
* Whether the battery is currently charging. The state could be unknown if not provided by the manufacturer.
|
|
74
|
+
* @example "charging"
|
|
75
|
+
*/
|
|
72
76
|
chargingState: z.ZodEnum<["charging", "discharging", "idle", "unknown"]>;
|
|
77
|
+
/**
|
|
78
|
+
* The current charge of the battery in watt-hours (Wh).
|
|
79
|
+
* @example 43200
|
|
80
|
+
*/
|
|
73
81
|
charge: z.ZodNumber;
|
|
82
|
+
/**
|
|
83
|
+
* The current charge of the battery as a percentage. Represented as a number between 0 and 100.
|
|
84
|
+
* @example 50
|
|
85
|
+
*/
|
|
74
86
|
chargePercentage: z.ZodNumber;
|
|
87
|
+
/**
|
|
88
|
+
* The current charge rate of the battery in watts (W).
|
|
89
|
+
*
|
|
90
|
+
* If negative, the battery is charging (consuming power).
|
|
91
|
+
* If positive, the battery is discharging (supplying power).
|
|
92
|
+
* If 0 then the battery is idle.
|
|
93
|
+
*
|
|
94
|
+
* @example 1000
|
|
95
|
+
* @optional
|
|
96
|
+
*/
|
|
75
97
|
chargeRate: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
/**
|
|
99
|
+
* The current charge percentage that should be reserved for backup power. Represented as a number between 0 and 100.
|
|
100
|
+
* @example 90
|
|
101
|
+
* @optional
|
|
102
|
+
*/
|
|
76
103
|
backupReserve: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the battery has an active storm mode alert.
|
|
106
|
+
* @example true
|
|
107
|
+
* @optional
|
|
108
|
+
*/
|
|
77
109
|
isStormModeActive: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
/**
|
|
111
|
+
* Whether the battery has an active storm mode enabled.
|
|
112
|
+
* @example true
|
|
113
|
+
* @optional
|
|
114
|
+
*/
|
|
78
115
|
isStormModeEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
/**
|
|
117
|
+
* The current strategy or mode the battery is operating in.
|
|
118
|
+
* @example "self-consumption"
|
|
119
|
+
*/
|
|
79
120
|
strategy: z.ZodOptional<z.ZodDefault<z.ZodEnum<["unknown", "self_consumption", "time_of_use", "backup"]>>>;
|
|
121
|
+
} & {
|
|
80
122
|
gridStatus: z.ZodOptional<z.ZodEnum<["exporting", "importing", "idle", "unknown"]>>;
|
|
81
123
|
gridPower: z.ZodOptional<z.ZodNumber>;
|
|
82
124
|
gridEnergy: z.ZodOptional<z.ZodNumber>;
|
|
@@ -84,26 +126,26 @@ export declare const BatteryStateSchema: z.ZodObject<{
|
|
|
84
126
|
chargingState: "idle" | "unknown" | "charging" | "discharging";
|
|
85
127
|
charge: number;
|
|
86
128
|
chargePercentage: number;
|
|
129
|
+
gridStatus?: "idle" | "unknown" | "exporting" | "importing" | undefined;
|
|
130
|
+
gridPower?: number | undefined;
|
|
131
|
+
gridEnergy?: number | undefined;
|
|
87
132
|
chargeRate?: number | undefined;
|
|
88
133
|
backupReserve?: number | undefined;
|
|
89
134
|
isStormModeActive?: boolean | undefined;
|
|
90
135
|
isStormModeEnabled?: boolean | undefined;
|
|
91
136
|
strategy?: "unknown" | "self_consumption" | "time_of_use" | "backup" | undefined;
|
|
92
|
-
gridStatus?: "idle" | "unknown" | "exporting" | "importing" | undefined;
|
|
93
|
-
gridPower?: number | undefined;
|
|
94
|
-
gridEnergy?: number | undefined;
|
|
95
137
|
}, {
|
|
96
138
|
chargingState: "idle" | "unknown" | "charging" | "discharging";
|
|
97
139
|
charge: number;
|
|
98
140
|
chargePercentage: number;
|
|
141
|
+
gridStatus?: "idle" | "unknown" | "exporting" | "importing" | undefined;
|
|
142
|
+
gridPower?: number | undefined;
|
|
143
|
+
gridEnergy?: number | undefined;
|
|
99
144
|
chargeRate?: number | undefined;
|
|
100
145
|
backupReserve?: number | undefined;
|
|
101
146
|
isStormModeActive?: boolean | undefined;
|
|
102
147
|
isStormModeEnabled?: boolean | undefined;
|
|
103
148
|
strategy?: "unknown" | "self_consumption" | "time_of_use" | "backup" | undefined;
|
|
104
|
-
gridStatus?: "idle" | "unknown" | "exporting" | "importing" | undefined;
|
|
105
|
-
gridPower?: number | undefined;
|
|
106
|
-
gridEnergy?: number | undefined;
|
|
107
149
|
}>;
|
|
108
150
|
export type BatteryState = z.infer<typeof BatteryStateSchema>;
|
|
109
151
|
export declare const BatteryStaticStateSchema: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"battery.d.ts","sourceRoot":"","sources":["../../src/deviceState/battery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,sBAAsB;IACjC;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAMH;;;;;;;;;OASG;;IAEH;;;;OAIG;;IASH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"battery.d.ts","sourceRoot":"","sources":["../../src/deviceState/battery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,sBAAsB;IACjC;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAMH;;;;;;;;;OASG;;IAEH;;;;OAIG;;IASH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,eAAO,MAAM,kBAAkB;IA9D7B;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAMH;;;;;;;;;OASG;;IAEH;;;;OAIG;;IASH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI8E,CAAC;AACpF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,wBAAwB;IACnC;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;EAEH,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const InverterStateSchema: z.ZodObject<{
|
|
3
|
+
/**
|
|
4
|
+
* The power output of the inverter in watts (W).
|
|
5
|
+
* @example 5000
|
|
6
|
+
*/
|
|
3
7
|
power: z.ZodNumber;
|
|
8
|
+
/**
|
|
9
|
+
* The current state of the battery (mostly for hybrid inverters with battery backup support).
|
|
10
|
+
* @optional
|
|
11
|
+
* @example { charge: 43200, chargePercentage: 50, chargingState: "charging" }
|
|
12
|
+
*/
|
|
4
13
|
batteryState: z.ZodOptional<z.ZodObject<{
|
|
5
14
|
chargingState: z.ZodEnum<["charging", "discharging", "idle", "unknown"]>;
|
|
6
15
|
charge: z.ZodNumber;
|
|
@@ -29,11 +38,15 @@ export declare const InverterStateSchema: z.ZodObject<{
|
|
|
29
38
|
isStormModeEnabled?: boolean | undefined;
|
|
30
39
|
strategy?: "unknown" | "self_consumption" | "time_of_use" | "backup" | undefined;
|
|
31
40
|
}>>;
|
|
41
|
+
} & {
|
|
32
42
|
gridStatus: z.ZodOptional<z.ZodEnum<["exporting", "importing", "idle", "unknown"]>>;
|
|
33
43
|
gridPower: z.ZodOptional<z.ZodNumber>;
|
|
34
44
|
gridEnergy: z.ZodOptional<z.ZodNumber>;
|
|
35
45
|
}, "strip", z.ZodTypeAny, {
|
|
36
46
|
power: number;
|
|
47
|
+
gridStatus?: "idle" | "unknown" | "exporting" | "importing" | undefined;
|
|
48
|
+
gridPower?: number | undefined;
|
|
49
|
+
gridEnergy?: number | undefined;
|
|
37
50
|
batteryState?: {
|
|
38
51
|
chargingState: "idle" | "unknown" | "charging" | "discharging";
|
|
39
52
|
charge: number;
|
|
@@ -44,11 +57,11 @@ export declare const InverterStateSchema: z.ZodObject<{
|
|
|
44
57
|
isStormModeEnabled?: boolean | undefined;
|
|
45
58
|
strategy?: "unknown" | "self_consumption" | "time_of_use" | "backup" | undefined;
|
|
46
59
|
} | undefined;
|
|
60
|
+
}, {
|
|
61
|
+
power: number;
|
|
47
62
|
gridStatus?: "idle" | "unknown" | "exporting" | "importing" | undefined;
|
|
48
63
|
gridPower?: number | undefined;
|
|
49
64
|
gridEnergy?: number | undefined;
|
|
50
|
-
}, {
|
|
51
|
-
power: number;
|
|
52
65
|
batteryState?: {
|
|
53
66
|
chargingState: "idle" | "unknown" | "charging" | "discharging";
|
|
54
67
|
charge: number;
|
|
@@ -59,9 +72,6 @@ export declare const InverterStateSchema: z.ZodObject<{
|
|
|
59
72
|
isStormModeEnabled?: boolean | undefined;
|
|
60
73
|
strategy?: "unknown" | "self_consumption" | "time_of_use" | "backup" | undefined;
|
|
61
74
|
} | undefined;
|
|
62
|
-
gridStatus?: "idle" | "unknown" | "exporting" | "importing" | undefined;
|
|
63
|
-
gridPower?: number | undefined;
|
|
64
|
-
gridEnergy?: number | undefined;
|
|
65
75
|
}>;
|
|
66
76
|
export type InverterState = z.infer<typeof InverterStateSchema>;
|
|
67
77
|
export declare const InverterStaticStateSchema: z.ZodObject<{
|
|
@@ -1 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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;IAE5B;;;OAGG;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIsB,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"}
|
|
@@ -54,24 +54,24 @@ export declare const VehicleStateSchema: z.ZodObject<{
|
|
|
54
54
|
chargingState: "idle" | "unknown" | "charging" | "discharging";
|
|
55
55
|
chargePercentage: number;
|
|
56
56
|
range: number;
|
|
57
|
-
chargeCompletedAt?: string | undefined;
|
|
58
|
-
chargeLimit?: number | undefined;
|
|
59
57
|
charge?: number | undefined;
|
|
60
58
|
isPluggedIn?: boolean | undefined;
|
|
61
59
|
chargerVoltage?: number | undefined;
|
|
62
60
|
chargerCurrent?: number | undefined;
|
|
63
61
|
chargerWattage?: number | undefined;
|
|
62
|
+
chargeCompletedAt?: string | undefined;
|
|
63
|
+
chargeLimit?: number | undefined;
|
|
64
64
|
}, {
|
|
65
65
|
chargingState: "idle" | "unknown" | "charging" | "discharging";
|
|
66
66
|
chargePercentage: number;
|
|
67
67
|
range: number;
|
|
68
|
-
chargeCompletedAt?: string | undefined;
|
|
69
|
-
chargeLimit?: number | undefined;
|
|
70
68
|
charge?: number | undefined;
|
|
71
69
|
isPluggedIn?: boolean | undefined;
|
|
72
70
|
chargerVoltage?: number | undefined;
|
|
73
71
|
chargerCurrent?: number | undefined;
|
|
74
72
|
chargerWattage?: number | undefined;
|
|
73
|
+
chargeCompletedAt?: string | undefined;
|
|
74
|
+
chargeLimit?: number | undefined;
|
|
75
75
|
}>;
|
|
76
76
|
export type VehicleState = z.infer<typeof VehicleStateSchema>;
|
|
77
77
|
export declare const VehicleStaticStateSchema: z.ZodObject<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const DeviceTypes: readonly ["battery", "charger", "inverter", "thermostat", "vehicle"];
|
|
2
|
+
export declare const DeviceTypes: readonly ["battery", "charger", "inverter", "thermostat", "vehicle", "other", "unknown"];
|
|
3
3
|
export type DeviceType = (typeof DeviceTypes)[number];
|
|
4
|
-
export declare const DeviceTypeEnum: z.ZodEnum<["battery", "charger", "inverter", "thermostat", "vehicle"]>;
|
|
4
|
+
export declare const DeviceTypeEnum: z.ZodEnum<["battery", "charger", "inverter", "thermostat", "vehicle", "other", "unknown"]>;
|
|
5
5
|
export declare const DeviceTypeLabelMap: Record<DeviceType, string>;
|
|
6
6
|
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -1 +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,
|
|
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,0FAA2F,CAAC;AACpH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,eAAO,MAAM,cAAc,4FAAsB,CAAC;AAElD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAQzD,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeviceTypeLabelMap = exports.DeviceTypeEnum = exports.DeviceTypes = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
exports.DeviceTypes = ["battery", "charger", "inverter", "thermostat", "vehicle"];
|
|
5
|
+
exports.DeviceTypes = ["battery", "charger", "inverter", "thermostat", "vehicle", "other", "unknown"];
|
|
6
6
|
exports.DeviceTypeEnum = zod_1.z.enum(exports.DeviceTypes);
|
|
7
7
|
exports.DeviceTypeLabelMap = {
|
|
8
8
|
battery: "Battery",
|
|
@@ -10,5 +10,7 @@ exports.DeviceTypeLabelMap = {
|
|
|
10
10
|
inverter: "Inverter",
|
|
11
11
|
thermostat: "Thermostat",
|
|
12
12
|
vehicle: "Vehicle",
|
|
13
|
+
other: "Other",
|
|
14
|
+
unknown: "Unknown",
|
|
13
15
|
};
|
|
14
16
|
//# sourceMappingURL=entities.js.map
|
|
@@ -1 +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;
|
|
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,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAEvG,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;IAClB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@texturehq/device",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"author": "Will Laeri <will@texture.energy>",
|
|
5
5
|
"description": "A type-safe client for validating device data",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,16 +26,17 @@
|
|
|
26
26
|
"quicktype": "^23.0.106",
|
|
27
27
|
"ts-jest": "^29.1.2",
|
|
28
28
|
"ts-node": "^10.9.2",
|
|
29
|
-
"typescript": "~5.7.3"
|
|
29
|
+
"typescript": "~5.7.3",
|
|
30
|
+
"zod": "^3.25"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"axios": "^1.6.7",
|
|
33
34
|
"axios-cache-interceptor": "^1.8.0",
|
|
34
|
-
"axios-retry": "^4.5.0"
|
|
35
|
-
"zod": "^3.22.4"
|
|
35
|
+
"axios-retry": "^4.5.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@texturehq/logger": "^2.0.0"
|
|
38
|
+
"@texturehq/logger": "^2.0.0",
|
|
39
|
+
"zod": "^3.25"
|
|
39
40
|
},
|
|
40
41
|
"peerDependenciesMeta": {
|
|
41
42
|
"@texturehq/logger": {
|