mysa-js-sdk 2.1.2 → 3.1.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 +49 -0
- package/README.md +18 -34
- package/dist/index.cjs +380 -143
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +177 -55
- package/dist/index.d.ts +177 -55
- package/dist/index.js +379 -152
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
/** Error thrown when attempting to access the Mysa API without proper authentication. */
|
|
2
2
|
declare class UnauthenticatedError extends Error {
|
|
3
|
+
/**
|
|
4
|
+
* The underlying failure that prevented authentication.
|
|
5
|
+
*
|
|
6
|
+
* Callers need it to tell a credential rejection apart from a transport or service failure, since both surface as
|
|
7
|
+
* this error. Declared explicitly rather than passed to `super` so the SDK keeps compiling against its current lib,
|
|
8
|
+
* which predates the two-argument `Error` constructor.
|
|
9
|
+
*/
|
|
10
|
+
readonly cause?: unknown;
|
|
3
11
|
/**
|
|
4
12
|
* Creates a new UnauthenticatedError instance.
|
|
5
13
|
*
|
|
6
14
|
* @param message - The error message
|
|
15
|
+
* @param cause - The underlying failure that prevented authentication, if any.
|
|
7
16
|
*/
|
|
8
|
-
constructor(message: string);
|
|
17
|
+
constructor(message: string, cause?: unknown);
|
|
9
18
|
}
|
|
10
19
|
/** Error thrown when a Mysa API request fails. */
|
|
11
20
|
declare class MysaApiError extends Error {
|
|
@@ -20,6 +29,30 @@ declare class MysaApiError extends Error {
|
|
|
20
29
|
*/
|
|
21
30
|
constructor(apiResponse: Response);
|
|
22
31
|
}
|
|
32
|
+
/** Error thrown when a device id does not match any device on the account. */
|
|
33
|
+
declare class UnknownDeviceError extends Error {
|
|
34
|
+
readonly deviceId: string;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new UnknownDeviceError instance.
|
|
37
|
+
*
|
|
38
|
+
* @param deviceId - The device id that could not be resolved
|
|
39
|
+
*/
|
|
40
|
+
constructor(deviceId: string);
|
|
41
|
+
}
|
|
42
|
+
/** Error thrown when a requested fan speed is not supported by the target device. */
|
|
43
|
+
declare class UnsupportedFanSpeedError extends Error {
|
|
44
|
+
readonly deviceId: string;
|
|
45
|
+
readonly fanSpeed: string;
|
|
46
|
+
readonly supportedFanSpeeds: string[];
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new UnsupportedFanSpeedError instance.
|
|
49
|
+
*
|
|
50
|
+
* @param deviceId - The id of the device the command was aimed at.
|
|
51
|
+
* @param fanSpeed - The requested fan speed that the device does not support.
|
|
52
|
+
* @param supportedFanSpeeds - The fan speeds the device does support.
|
|
53
|
+
*/
|
|
54
|
+
constructor(deviceId: string, fanSpeed: string, supportedFanSpeeds: string[]);
|
|
55
|
+
}
|
|
23
56
|
/** Error thrown when an MQTT publish ultimately fails after retry attempts. */
|
|
24
57
|
declare class MqttPublishError extends Error {
|
|
25
58
|
attempts: number;
|
|
@@ -99,8 +132,10 @@ interface Status {
|
|
|
99
132
|
setPoint: number;
|
|
100
133
|
/** Optional electrical current draw measurement in amperes */
|
|
101
134
|
current?: number;
|
|
102
|
-
/** Optional heating element duty cycle as a
|
|
135
|
+
/** Optional heating element duty cycle, as a fraction between 0.0 and 1.0 */
|
|
103
136
|
dutyCycle?: number;
|
|
137
|
+
/** Optional floor-probe temperature reading, reported only by in-floor heating thermostats (INF-V1-0) */
|
|
138
|
+
floorTemperature?: number;
|
|
104
139
|
}
|
|
105
140
|
|
|
106
141
|
/** Interface for logging operations at different severity levels */
|
|
@@ -123,20 +158,16 @@ declare class VoidLogger implements Logger {
|
|
|
123
158
|
}
|
|
124
159
|
|
|
125
160
|
/**
|
|
126
|
-
* Interface representing
|
|
161
|
+
* Interface representing the credentials of a Mysa account.
|
|
127
162
|
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
163
|
+
* The client authenticates with these credentials on demand, and re-authenticates with them whenever its session can no
|
|
164
|
+
* longer be refreshed. They are held for the lifetime of the client.
|
|
130
165
|
*/
|
|
131
|
-
interface
|
|
132
|
-
/** The
|
|
166
|
+
interface MysaCredentials {
|
|
167
|
+
/** The email address of the Mysa account. */
|
|
133
168
|
username: string;
|
|
134
|
-
/**
|
|
135
|
-
|
|
136
|
-
/** JWT access token used for authorizing API requests */
|
|
137
|
-
accessToken: string;
|
|
138
|
-
/** JWT refresh token used to obtain new access tokens when they expire */
|
|
139
|
-
refreshToken: string;
|
|
169
|
+
/** The password of the Mysa account. */
|
|
170
|
+
password: string;
|
|
140
171
|
}
|
|
141
172
|
|
|
142
173
|
/**
|
|
@@ -200,6 +231,12 @@ interface SupportedCaps {
|
|
|
200
231
|
version: string;
|
|
201
232
|
/** Array of supported remote control key codes */
|
|
202
233
|
keys: number[];
|
|
234
|
+
/**
|
|
235
|
+
* Optional device-specific fan-speed `fn` values, ordered by canonical fan speed (`[auto, low, medium, high, max]`).
|
|
236
|
+
* E.g. `[1, 2, 4, 6]` for CodeNum=1117 devices means auto=1, low=2, medium=4, high=6. When absent, a legacy universal
|
|
237
|
+
* mapping is assumed.
|
|
238
|
+
*/
|
|
239
|
+
fanSpeeds?: number[];
|
|
203
240
|
}
|
|
204
241
|
/**
|
|
205
242
|
* Device operating mode information.
|
|
@@ -553,12 +590,29 @@ interface DeviceV2Status extends MsgPayload<OutMessageType.DEVICE_V2_STATUS> {
|
|
|
553
590
|
body: {
|
|
554
591
|
/** Ambient temperature reading from the device sensor */
|
|
555
592
|
ambTemp: number;
|
|
556
|
-
/**
|
|
557
|
-
|
|
593
|
+
/**
|
|
594
|
+
* Current duty cycle of the heating element, as a fraction between 0.0 and 1.0. Reported by baseboard V2 devices;
|
|
595
|
+
* absent on in-floor heating thermostats (INF-V1-0), which report {@link heatStat} instead.
|
|
596
|
+
*/
|
|
597
|
+
dtyCycle?: number;
|
|
558
598
|
/** Relative humidity percentage reading from the device sensor */
|
|
559
599
|
hum: number;
|
|
560
600
|
/** Current temperature setpoint setting */
|
|
561
601
|
stpt: number;
|
|
602
|
+
/**
|
|
603
|
+
* Binary heating-relay state (0 = off, 1 = energized) reported by in-floor heating thermostats (INF-V1-0) in place
|
|
604
|
+
* of {@link dtyCycle}. Absent on baseboard V2 devices.
|
|
605
|
+
*/
|
|
606
|
+
heatStat?: number;
|
|
607
|
+
/** Floor-probe temperature reading (°C) from in-floor heating thermostats. Absent on baseboard V2 devices. */
|
|
608
|
+
flrSnsrTemp?: number;
|
|
609
|
+
/**
|
|
610
|
+
* Which sensor the in-floor thermostat regulates against (3 = floor probe, 5 = ambient air). Absent on baseboard V2
|
|
611
|
+
* devices.
|
|
612
|
+
*/
|
|
613
|
+
trackedSnsr?: number;
|
|
614
|
+
/** Line voltage (V) reported by in-floor heating thermostats. Absent on baseboard V2 devices. */
|
|
615
|
+
lineVtg?: number;
|
|
562
616
|
};
|
|
563
617
|
}
|
|
564
618
|
|
|
@@ -682,14 +736,6 @@ type OutPayload = MsgTypeOutPayload | MsgOutPayload;
|
|
|
682
736
|
* emission in the Mysa API client's event system.
|
|
683
737
|
*/
|
|
684
738
|
type MysaApiClientEventTypes = {
|
|
685
|
-
/**
|
|
686
|
-
* Event emitted when the session changes.
|
|
687
|
-
*
|
|
688
|
-
* @remarks
|
|
689
|
-
* You should subscribe to this event and persist the session object whenever it changes.
|
|
690
|
-
* @param session - The new session object or undefined if session was cleared.
|
|
691
|
-
*/
|
|
692
|
-
sessionChanged: [session: MysaSession | undefined];
|
|
693
739
|
/**
|
|
694
740
|
* Event emitted when a device's status information is updated.
|
|
695
741
|
*
|
|
@@ -761,9 +807,9 @@ interface MqttPublishOptions {
|
|
|
761
807
|
* @example
|
|
762
808
|
*
|
|
763
809
|
* ```typescript
|
|
764
|
-
* const client = new MysaApiClient();
|
|
810
|
+
* const client = new MysaApiClient({ username: 'user@example.com', password: 'password' });
|
|
765
811
|
*
|
|
766
|
-
* await client.login(
|
|
812
|
+
* await client.login();
|
|
767
813
|
* const devices = await client.getDevices();
|
|
768
814
|
*
|
|
769
815
|
* client.emitter.on('statusChanged', (status) => {
|
|
@@ -776,10 +822,14 @@ interface MqttPublishOptions {
|
|
|
776
822
|
* ```
|
|
777
823
|
*/
|
|
778
824
|
declare class MysaApiClient {
|
|
825
|
+
/** The credentials of the Mysa account this client authenticates as. */
|
|
826
|
+
private _credentials;
|
|
779
827
|
/** The current session object, if any. */
|
|
780
828
|
private _cognitoUserSession?;
|
|
781
829
|
/** The current user object, if any. */
|
|
782
830
|
private _cognitoUser?;
|
|
831
|
+
/** The in-flight session acquisition, if any, so that concurrent callers share a single refresh or login. */
|
|
832
|
+
private _freshSessionPromise?;
|
|
783
833
|
/** The logger instance used by the client. */
|
|
784
834
|
private _logger;
|
|
785
835
|
/** The fetcher function used by the client. */
|
|
@@ -794,8 +844,21 @@ declare class MysaApiClient {
|
|
|
794
844
|
private _mqttInterrupts;
|
|
795
845
|
/** Whether a forced MQTT reset is currently in progress (guards against re-entrancy). */
|
|
796
846
|
private _mqttResetInProgress;
|
|
847
|
+
/** Monotonic id of the current MQTT connection; used to ignore events from discarded connections. */
|
|
848
|
+
private _mqttGeneration;
|
|
849
|
+
/** Consecutive forced resets without an intervening stable period; drives reset backoff. */
|
|
850
|
+
private _mqttConsecutiveResets;
|
|
851
|
+
/** Timestamp (ms) of the most recent successful MQTT (re)connect, for interrupt dwell-time diagnostics. */
|
|
852
|
+
private _mqttLastConnectionSuccessAt?;
|
|
853
|
+
/** Timer that clears the consecutive-reset counter once a connection stays healthy. */
|
|
854
|
+
private _mqttStabilityTimer?;
|
|
797
855
|
/** The device IDs that are currently being updated in real-time, mapped to their respective timeouts. */
|
|
798
856
|
private _realtimeDeviceIds;
|
|
857
|
+
/**
|
|
858
|
+
* Raw topic filters registered via {@link startRawTopicCapture}, mapped to their message handlers. Re-subscribed on
|
|
859
|
+
* every reconnect so a debug capture survives connection resets.
|
|
860
|
+
*/
|
|
861
|
+
private _rawTopicCaptures;
|
|
799
862
|
/** The cached devices object, if any. */
|
|
800
863
|
private _cachedDevices?;
|
|
801
864
|
/**
|
|
@@ -804,47 +867,41 @@ declare class MysaApiClient {
|
|
|
804
867
|
* @see {@link MysaApiClientEventTypes} for the possible events and their payloads.
|
|
805
868
|
*/
|
|
806
869
|
readonly emitter: EventEmitter<MysaApiClientEventTypes>;
|
|
807
|
-
/**
|
|
808
|
-
* Gets the persistable session object.
|
|
809
|
-
*
|
|
810
|
-
* @returns The current persistable session object, if any.
|
|
811
|
-
*/
|
|
812
|
-
get session(): MysaSession | undefined;
|
|
813
|
-
/**
|
|
814
|
-
* Returns whether the client currently has an active session.
|
|
815
|
-
*
|
|
816
|
-
* @returns True if the client has an active session, false otherwise.
|
|
817
|
-
*/
|
|
818
|
-
get isAuthenticated(): boolean;
|
|
819
870
|
/**
|
|
820
871
|
* Constructs a new instance of the MysaApiClient.
|
|
821
872
|
*
|
|
822
|
-
* @param
|
|
873
|
+
* @param credentials - The credentials of the Mysa account to authenticate as.
|
|
823
874
|
* @param options - The options for the client.
|
|
824
875
|
*/
|
|
825
|
-
constructor(
|
|
876
|
+
constructor(credentials: MysaCredentials, options?: MysaApiClientOptions);
|
|
826
877
|
/**
|
|
827
|
-
*
|
|
878
|
+
* Ensures the client has a usable session, logging in with the credentials it was constructed with if needed.
|
|
828
879
|
*
|
|
829
|
-
*
|
|
830
|
-
*
|
|
880
|
+
* Calling this method is optional: the client authenticates on demand before its first API call, and re-authenticates
|
|
881
|
+
* on its own whenever its session can no longer be refreshed. Call it explicitly at startup to fail fast on invalid
|
|
882
|
+
* credentials instead of on the first API call. It is a no-op when the current session is still usable.
|
|
831
883
|
*
|
|
832
884
|
* @example
|
|
833
885
|
*
|
|
834
886
|
* ```typescript
|
|
835
887
|
* try {
|
|
836
|
-
* await client.login(
|
|
888
|
+
* await client.login();
|
|
837
889
|
* console.log('Login successful!');
|
|
838
890
|
* } catch (error) {
|
|
839
891
|
* console.error('Login failed:', error.message);
|
|
840
892
|
* }
|
|
841
893
|
* ```
|
|
842
894
|
*
|
|
843
|
-
* @
|
|
844
|
-
|
|
895
|
+
* @throws {@link UnauthenticatedError} When authentication fails due to invalid credentials or network issues.
|
|
896
|
+
*/
|
|
897
|
+
login(): Promise<void>;
|
|
898
|
+
/**
|
|
899
|
+
* Authenticates with Mysa's Cognito user pool and replaces the current session, if any.
|
|
900
|
+
*
|
|
901
|
+
* @returns A promise that resolves to the newly established session.
|
|
845
902
|
* @throws {@link Error} When authentication fails due to invalid credentials or network issues.
|
|
846
903
|
*/
|
|
847
|
-
|
|
904
|
+
private _login;
|
|
848
905
|
/**
|
|
849
906
|
* Retrieves the list of devices associated with the user.
|
|
850
907
|
*
|
|
@@ -862,7 +919,7 @@ declare class MysaApiClient {
|
|
|
862
919
|
*
|
|
863
920
|
* @returns A promise that resolves to the list of devices.
|
|
864
921
|
* @throws {@link MysaApiError} When the API request fails.
|
|
865
|
-
* @throws {@link UnauthenticatedError} When the
|
|
922
|
+
* @throws {@link UnauthenticatedError} When the client cannot authenticate with its credentials.
|
|
866
923
|
*/
|
|
867
924
|
getDevices(): Promise<Devices>;
|
|
868
925
|
/**
|
|
@@ -884,7 +941,7 @@ declare class MysaApiClient {
|
|
|
884
941
|
*
|
|
885
942
|
* @param deviceId - The ID of the device to get the serial number for.
|
|
886
943
|
* @returns A promise that resolves to the serial number, or undefined if not found.
|
|
887
|
-
* @throws {@link UnauthenticatedError} When the
|
|
944
|
+
* @throws {@link UnauthenticatedError} When the client cannot authenticate with its credentials.
|
|
888
945
|
*/
|
|
889
946
|
getDeviceSerialNumber(deviceId: string): Promise<string | undefined>;
|
|
890
947
|
/**
|
|
@@ -892,7 +949,7 @@ declare class MysaApiClient {
|
|
|
892
949
|
*
|
|
893
950
|
* @returns A promise that resolves to the firmware information for all devices.
|
|
894
951
|
* @throws {@link MysaApiError} When the API request fails.
|
|
895
|
-
* @throws {@link UnauthenticatedError} When the
|
|
952
|
+
* @throws {@link UnauthenticatedError} When the client cannot authenticate with its credentials.
|
|
896
953
|
*/
|
|
897
954
|
getDeviceFirmwares(): Promise<Firmwares>;
|
|
898
955
|
/**
|
|
@@ -900,7 +957,7 @@ declare class MysaApiClient {
|
|
|
900
957
|
*
|
|
901
958
|
* @returns A promise that resolves to the current state of all devices.
|
|
902
959
|
* @throws {@link MysaApiError} When the API request fails.
|
|
903
|
-
* @throws {@link UnauthenticatedError} When the
|
|
960
|
+
* @throws {@link UnauthenticatedError} When the client cannot authenticate with its credentials.
|
|
904
961
|
*/
|
|
905
962
|
getDeviceStates(): Promise<DeviceStates>;
|
|
906
963
|
/**
|
|
@@ -908,7 +965,7 @@ declare class MysaApiClient {
|
|
|
908
965
|
*
|
|
909
966
|
* @returns A promise that resolves to the homes information.
|
|
910
967
|
* @throws {@link MysaApiError} When the API request fails.
|
|
911
|
-
* @throws {@link UnauthenticatedError} When the
|
|
968
|
+
* @throws {@link UnauthenticatedError} When the client cannot authenticate with its credentials.
|
|
912
969
|
*/
|
|
913
970
|
getHomes(): Promise<Homes>;
|
|
914
971
|
/**
|
|
@@ -938,7 +995,9 @@ declare class MysaApiClient {
|
|
|
938
995
|
* @param mode - The operating mode to set (one of MysaDeviceMode values, or undefined to leave unchanged).
|
|
939
996
|
* @param fanSpeed - The fan speed mode to set ('low', 'medium', 'high', 'max', 'auto', or undefined to leave
|
|
940
997
|
* unchanged).
|
|
941
|
-
* @throws {@link UnauthenticatedError} When the
|
|
998
|
+
* @throws {@link UnauthenticatedError} When the client cannot authenticate with its credentials.
|
|
999
|
+
* @throws {@link UnknownDeviceError} When the device id does not match any device on the account.
|
|
1000
|
+
* @throws {@link UnsupportedFanSpeedError} When the requested fan speed is not supported by the device.
|
|
942
1001
|
* @throws {@link Error} When MQTT connection or command sending fails.
|
|
943
1002
|
*/
|
|
944
1003
|
setDeviceState(deviceId: string, setPoint?: number, mode?: MysaDeviceMode, fanSpeed?: MysaFanSpeedMode): Promise<void>;
|
|
@@ -974,16 +1033,49 @@ declare class MysaApiClient {
|
|
|
974
1033
|
* @throws {@link Error} When MQTT unsubscription fails.
|
|
975
1034
|
*/
|
|
976
1035
|
stopRealtimeUpdates(deviceId: string): Promise<void>;
|
|
1036
|
+
/**
|
|
1037
|
+
* Subscribes to raw MQTT topic filters and relays every message verbatim.
|
|
1038
|
+
*
|
|
1039
|
+
* Unlike {@link startRealtimeUpdates}, this performs no parsing, emits no typed events and sends no "start publishing"
|
|
1040
|
+
* request to the device — it simply forwards the full message topic and the decoded UTF-8 payload of everything that
|
|
1041
|
+
* arrives on the given filters. It exists to reverse-engineer device families the SDK does not model yet, most
|
|
1042
|
+
* notably the AWS IoT Device Shadow protocol used by the central-HVAC ST-V1 thermostats, where both the topic (which
|
|
1043
|
+
* shadow, and `accepted`/`rejected`/`delta`/`documents`) and the raw JSON body carry the information a new
|
|
1044
|
+
* implementation needs.
|
|
1045
|
+
*
|
|
1046
|
+
* The capture is passive: the device only publishes to its shadow topics when something drives a change (the Mysa
|
|
1047
|
+
* mobile app, a schedule, or the device itself), so exercise the thermostat while a capture is running.
|
|
1048
|
+
*
|
|
1049
|
+
* Registered filters are re-subscribed automatically after a reconnect.
|
|
1050
|
+
*
|
|
1051
|
+
* @param topicFilters - MQTT topic filters to subscribe to. Wildcards (`+`, `#`) are allowed, subject to the AWS IoT
|
|
1052
|
+
* policy attached to the account's Cognito identity — a filter the policy forbids resolves with a non-zero
|
|
1053
|
+
* `error_code`, which is logged rather than thrown so the remaining filters still subscribe.
|
|
1054
|
+
* @param handler - Invoked with the full message topic and the decoded UTF-8 payload for every message received.
|
|
1055
|
+
* @throws {@link Error} When the MQTT connection cannot be established.
|
|
1056
|
+
*/
|
|
1057
|
+
startRawTopicCapture(topicFilters: string[], handler: (topic: string, payload: string) => void): Promise<void>;
|
|
977
1058
|
/**
|
|
978
1059
|
* Ensures a valid, non-expired session is available.
|
|
979
1060
|
*
|
|
980
1061
|
* This method checks if the current session is valid and not expired. If the session is expired, it automatically
|
|
981
|
-
* refreshes it using the refresh token.
|
|
1062
|
+
* refreshes it using the refresh token. If there is no session yet, or if the refresh token has itself expired or
|
|
1063
|
+
* been revoked, the client logs back in with its credentials.
|
|
1064
|
+
*
|
|
1065
|
+
* Concurrent callers share a single in-flight acquisition, so a burst of API calls never triggers more than one
|
|
1066
|
+
* refresh or login.
|
|
982
1067
|
*
|
|
983
1068
|
* @returns A promise that resolves to a valid CognitoUserSession.
|
|
984
|
-
* @throws {@link UnauthenticatedError} When
|
|
1069
|
+
* @throws {@link UnauthenticatedError} When neither refreshing nor logging back in succeeds.
|
|
985
1070
|
*/
|
|
986
1071
|
private _getFreshSession;
|
|
1072
|
+
/**
|
|
1073
|
+
* Refreshes the current session, falling back to a full login when it cannot be refreshed.
|
|
1074
|
+
*
|
|
1075
|
+
* @returns A promise that resolves to a valid CognitoUserSession.
|
|
1076
|
+
* @throws {@link UnauthenticatedError} When logging back in fails.
|
|
1077
|
+
*/
|
|
1078
|
+
private _acquireFreshSession;
|
|
987
1079
|
/**
|
|
988
1080
|
* Establishes and returns an MQTT connection for real-time communication.
|
|
989
1081
|
*
|
|
@@ -1036,6 +1128,36 @@ declare class MysaApiClient {
|
|
|
1036
1128
|
* @throws {@link Error} When connection establishment fails.
|
|
1037
1129
|
*/
|
|
1038
1130
|
private _createMqttConnection;
|
|
1131
|
+
/**
|
|
1132
|
+
* Re-subscribes every device currently receiving real-time updates on the given connection.
|
|
1133
|
+
*
|
|
1134
|
+
* Safe to call on every (re)connect: aws-crt replaces the per-topic callback on a duplicate subscribe, so this never
|
|
1135
|
+
* registers a message handler more than once.
|
|
1136
|
+
*
|
|
1137
|
+
* @param connection - The connection to (re-)establish subscriptions on.
|
|
1138
|
+
*/
|
|
1139
|
+
private _resubscribeAll;
|
|
1140
|
+
/**
|
|
1141
|
+
* Arms (or re-arms) the stability timer. When a connection stays interrupt-free for {@link MqttStabilityWindow}, the
|
|
1142
|
+
* consecutive-reset backoff counter is cleared so a future isolated storm still gets a fast first reset.
|
|
1143
|
+
*
|
|
1144
|
+
* @param generation - The connection generation that armed the timer; the callback is a no-op if the connection has
|
|
1145
|
+
* since been replaced.
|
|
1146
|
+
*/
|
|
1147
|
+
private _armMqttStabilityTimer;
|
|
1148
|
+
/** Clears the stability timer, if armed. */
|
|
1149
|
+
private _clearMqttStabilityTimer;
|
|
1150
|
+
/**
|
|
1151
|
+
* Forcefully tears down the current MQTT connection and rebuilds it with a fresh client id and fresh credentials,
|
|
1152
|
+
* escaping interrupt storms that a plain native reconnect cannot.
|
|
1153
|
+
*
|
|
1154
|
+
* Repeatable and self-contained: only one reset runs at a time, consecutive resets without an intervening stable
|
|
1155
|
+
* period back off exponentially (up to {@link MqttResetMaxDelay}), and it never rejects — so it is safe to invoke
|
|
1156
|
+
* fire-and-forget from an event handler.
|
|
1157
|
+
*
|
|
1158
|
+
* @param reason - Human-readable reason for the reset, used in logs.
|
|
1159
|
+
*/
|
|
1160
|
+
private _resetMqttConnection;
|
|
1039
1161
|
/**
|
|
1040
1162
|
* Processes incoming MQTT messages and emits appropriate events.
|
|
1041
1163
|
*
|
|
@@ -1158,4 +1280,4 @@ type MsgTypeInPayload = CheckDeviceSettings | StartPublishingDeviceStatus;
|
|
|
1158
1280
|
*/
|
|
1159
1281
|
type InPayload = MsgTypeInPayload | MsgInPayload;
|
|
1160
1282
|
|
|
1161
|
-
export { type BrandInfo, type ChangeDeviceState, type CheckDeviceSettings, type DeviceAcStatus, type DeviceBase, type DeviceLog, type DevicePostBoot, type DeviceSetpointChange, type DeviceState, type DeviceStateChange, type DeviceStates, type DeviceStatesObj, type DeviceV1Status, type DeviceV2Status, type Devices, type DevicesObj, type FirmwareDevice, type Firmwares, type HomeBase, type Homes, InMessageType, type InPayload, type Logger, type ModeObj, MqttPublishError, type MqttPublishOptions, type MsgBasePayload, type MsgInPayload, type MsgOutPayload, type MsgPayload, type MsgTypeBasePayload, type MsgTypeInPayload, type MsgTypeOutPayload, type MsgTypePayload, MysaApiClient, type MysaApiClientEventTypes, type MysaApiClientOptions, MysaApiError, type
|
|
1283
|
+
export { type BrandInfo, type ChangeDeviceState, type CheckDeviceSettings, type DeviceAcStatus, type DeviceBase, type DeviceLog, type DevicePostBoot, type DeviceSetpointChange, type DeviceState, type DeviceStateChange, type DeviceStates, type DeviceStatesObj, type DeviceV1Status, type DeviceV2Status, type Devices, type DevicesObj, type FirmwareDevice, type Firmwares, type HomeBase, type Homes, InMessageType, type InPayload, type Logger, type ModeObj, MqttPublishError, type MqttPublishOptions, type MsgBasePayload, type MsgInPayload, type MsgOutPayload, type MsgPayload, type MsgTypeBasePayload, type MsgTypeInPayload, type MsgTypeOutPayload, type MsgTypePayload, MysaApiClient, type MysaApiClientEventTypes, type MysaApiClientOptions, MysaApiError, type MysaCredentials, type MysaDeviceMode, type MysaFanSpeedMode, OutMessageType, type OutPayload, type SetPointChange, type StartPublishingDeviceStatus, type StateChange, type Status, type SupportedCaps, type TimestampedValue, UnauthenticatedError, UnknownDeviceError, UnsupportedFanSpeedError, VoidLogger };
|