mirror of
https://github.com/bourquep/mysa-js-sdk.git
synced 2026-02-04 09:41:07 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d007c2d745 | ||
|
|
5d9981f9e0 | ||
|
|
2f2cdef0ee | ||
|
|
193f67226b | ||
|
|
ef8d787e05 | ||
|
|
0c71ed95ce | ||
|
|
d861a50136 |
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
@@ -8,7 +8,7 @@ updates:
|
|||||||
- package-ecosystem: 'npm' # See documentation for possible values
|
- package-ecosystem: 'npm' # See documentation for possible values
|
||||||
directory: '/' # Location of package manifests
|
directory: '/' # Location of package manifests
|
||||||
schedule:
|
schedule:
|
||||||
interval: 'daily'
|
interval: 'weekly'
|
||||||
labels:
|
labels:
|
||||||
- 'dependencies'
|
- 'dependencies'
|
||||||
commit-message:
|
commit-message:
|
||||||
|
|||||||
@@ -65,9 +65,10 @@ async function main() {
|
|||||||
client.emitter.on('statusChanged', (status) => {
|
client.emitter.on('statusChanged', (status) => {
|
||||||
try {
|
try {
|
||||||
const device = devices.DevicesObj[status.deviceId];
|
const device = devices.DevicesObj[status.deviceId];
|
||||||
const watts = status.current !== undefined ? status.current * device.Voltage : undefined;
|
const watts =
|
||||||
|
status.current !== undefined && device.Voltage !== undefined ? status.current * device.Voltage : undefined;
|
||||||
rootLogger.info(
|
rootLogger.info(
|
||||||
`[${status.deviceId}] '${device.Name}' status changed: ${status.temperature}°C, ${status.humidity}%, ${watts ?? 'na'}W`
|
`[${status.deviceId}] '${device.Name ?? 'Unknown'}' status changed: ${status.temperature}°C, ${status.humidity}%, ${watts ?? 'na'}W`
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
rootLogger.error(error, `Error processing status update for device '${status.deviceId}'`);
|
rootLogger.error(error, `Error processing status update for device '${status.deviceId}'`);
|
||||||
@@ -77,7 +78,9 @@ async function main() {
|
|||||||
client.emitter.on('setPointChanged', (change) => {
|
client.emitter.on('setPointChanged', (change) => {
|
||||||
try {
|
try {
|
||||||
const device = devices.DevicesObj[change.deviceId];
|
const device = devices.DevicesObj[change.deviceId];
|
||||||
rootLogger.info(`'${device.Name}' setpoint changed from ${change.previousSetPoint} to ${change.newSetPoint}`);
|
rootLogger.info(
|
||||||
|
`'${device.Name ?? 'Unknown'}' setpoint changed from ${change.previousSetPoint} to ${change.newSetPoint}`
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
rootLogger.error(error, `Error processing setpoint update for device '${change.deviceId}'`);
|
rootLogger.error(error, `Error processing setpoint update for device '${change.deviceId}'`);
|
||||||
}
|
}
|
||||||
@@ -86,7 +89,7 @@ async function main() {
|
|||||||
client.emitter.on('stateChanged', (change) => {
|
client.emitter.on('stateChanged', (change) => {
|
||||||
try {
|
try {
|
||||||
const device = devices.DevicesObj[change.deviceId];
|
const device = devices.DevicesObj[change.deviceId];
|
||||||
rootLogger.info(change, `'${device.Name}' state changed.`);
|
rootLogger.info(change, `'${device.Name ?? 'Unknown'}' state changed.`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
rootLogger.error(error, `Error processing state update for device '${change.deviceId}'`);
|
rootLogger.error(error, `Error processing state update for device '${change.deviceId}'`);
|
||||||
}
|
}
|
||||||
@@ -96,7 +99,7 @@ async function main() {
|
|||||||
await Promise.all(
|
await Promise.all(
|
||||||
Object.entries(devices.DevicesObj).map(async ([deviceId, device]) => {
|
Object.entries(devices.DevicesObj).map(async ([deviceId, device]) => {
|
||||||
const serial = await client.getDeviceSerialNumber(deviceId);
|
const serial = await client.getDeviceSerialNumber(deviceId);
|
||||||
rootLogger.info(`Serial number for device '${deviceId}' (${device.Name}): ${serial}`);
|
rootLogger.info(`Serial number for device '${deviceId}' (${device.Name ?? 'Unknown'}): ${serial}`);
|
||||||
|
|
||||||
await client.startRealtimeUpdates(deviceId);
|
await client.startRealtimeUpdates(deviceId);
|
||||||
})
|
})
|
||||||
|
|||||||
1167
package-lock.json
generated
1167
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -51,7 +51,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-iot": "3.920.0",
|
"@aws-sdk/client-iot": "3.920.0",
|
||||||
"@aws-sdk/credential-providers": "3.901.0",
|
"@aws-sdk/credential-providers": "3.922.0",
|
||||||
"amazon-cognito-identity-js": "6.3.15",
|
"amazon-cognito-identity-js": "6.3.15",
|
||||||
"aws-iot-device-sdk-v2": "1.22.0",
|
"aws-iot-device-sdk-v2": "1.22.0",
|
||||||
"dayjs": "1.11.18",
|
"dayjs": "1.11.18",
|
||||||
@@ -61,10 +61,10 @@
|
|||||||
"@eslint/js": "9.38.0",
|
"@eslint/js": "9.38.0",
|
||||||
"@semantic-release/npm": "13.1.1",
|
"@semantic-release/npm": "13.1.1",
|
||||||
"@types/lodash": "4.17.20",
|
"@types/lodash": "4.17.20",
|
||||||
"@types/node": "24.9.2",
|
"@types/node": "24.10.0",
|
||||||
"conventional-changelog-conventionalcommits": "9.1.0",
|
"conventional-changelog-conventionalcommits": "9.1.0",
|
||||||
"dotenv": "17.2.3",
|
"dotenv": "17.2.3",
|
||||||
"eslint": "9.38.0",
|
"eslint": "9.39.0",
|
||||||
"eslint-plugin-jsdoc": "61.1.11",
|
"eslint-plugin-jsdoc": "61.1.11",
|
||||||
"eslint-plugin-tsdoc": "0.4.0",
|
"eslint-plugin-tsdoc": "0.4.0",
|
||||||
"pino": "9.13.0",
|
"pino": "9.13.0",
|
||||||
@@ -75,9 +75,9 @@
|
|||||||
"semantic-release": "25.0.1",
|
"semantic-release": "25.0.1",
|
||||||
"tsup": "8.5.0",
|
"tsup": "8.5.0",
|
||||||
"tsx": "4.20.6",
|
"tsx": "4.20.6",
|
||||||
"typedoc": "0.28.13",
|
"typedoc": "0.28.14",
|
||||||
"typedoc-material-theme": "1.4.0",
|
"typedoc-material-theme": "1.4.1",
|
||||||
"typescript": "5.9.3",
|
"typescript": "5.9.3",
|
||||||
"typescript-eslint": "8.41.0"
|
"typescript-eslint": "8.46.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ export interface BrandInfo {
|
|||||||
/** Unique identifier for the brand */
|
/** Unique identifier for the brand */
|
||||||
Id: number;
|
Id: number;
|
||||||
/** Remote control model number for the AC device */
|
/** Remote control model number for the AC device */
|
||||||
remoteModelNumber: string;
|
remoteModelNumber?: string;
|
||||||
/** Original Equipment Manufacturer brand name */
|
/** Original Equipment Manufacturer brand name */
|
||||||
OEMBrand: string;
|
OEMBrand?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,55 +56,55 @@ export interface ModeObj {
|
|||||||
*/
|
*/
|
||||||
export interface DeviceBase {
|
export interface DeviceBase {
|
||||||
/** Button digital input configuration value */
|
/** Button digital input configuration value */
|
||||||
ButtonDI: number;
|
ButtonDI?: number;
|
||||||
/** Maximum current rating as a string value */
|
/** Maximum current rating as a string value */
|
||||||
MaxCurrent: string;
|
MaxCurrent?: string;
|
||||||
/** Device model identifier string */
|
/** Device model identifier string */
|
||||||
Model: string;
|
Model: string;
|
||||||
/** Button average value configuration */
|
/** Button average value configuration */
|
||||||
ButtonAVE: number;
|
ButtonAVE?: number;
|
||||||
/** Operating voltage of the device */
|
/** Operating voltage of the device */
|
||||||
Voltage: number;
|
Voltage?: number;
|
||||||
/** Button polling interval configuration */
|
/** Button polling interval configuration */
|
||||||
ButtonPolling: number;
|
ButtonPolling?: number;
|
||||||
/** Minimum brightness level (0-100) */
|
/** Minimum brightness level (0-100) */
|
||||||
MinBrightness: number;
|
MinBrightness?: number;
|
||||||
/** User-assigned device name */
|
/** User-assigned device name */
|
||||||
Name: string;
|
Name?: string;
|
||||||
/** Button low power mode configuration */
|
/** Button low power mode configuration */
|
||||||
ButtonLowPower: number;
|
ButtonLowPower?: number;
|
||||||
/** Type of heater controlled by the device */
|
/** Type of heater controlled by the device */
|
||||||
HeaterType: string;
|
HeaterType?: string;
|
||||||
/** Button repeat delay configuration in milliseconds */
|
/** Button repeat delay configuration in milliseconds */
|
||||||
ButtonRepeatDelay: number;
|
ButtonRepeatDelay?: number;
|
||||||
/** Button repeat start delay configuration in milliseconds */
|
/** Button repeat start delay configuration in milliseconds */
|
||||||
ButtonRepeatStart: number;
|
ButtonRepeatStart?: number;
|
||||||
/** Display animation style setting */
|
/** Display animation style setting */
|
||||||
Animation: string;
|
Animation?: string;
|
||||||
/** Maximum brightness level (0-100) */
|
/** Maximum brightness level (0-100) */
|
||||||
MaxBrightness: number;
|
MaxBrightness?: number;
|
||||||
/** Array of user IDs allowed to control this device */
|
/** Array of user IDs allowed to control this device */
|
||||||
AllowedUsers: string[];
|
AllowedUsers?: string[];
|
||||||
/** Current button state indicator */
|
/** Current button state indicator */
|
||||||
ButtonState: string;
|
ButtonState?: string;
|
||||||
/** Home identifier that this device belongs to */
|
/** Home identifier that this device belongs to */
|
||||||
Home: string;
|
Home?: string;
|
||||||
/** Button sensitivity threshold configuration */
|
/** Button sensitivity threshold configuration */
|
||||||
ButtonThreshold: number;
|
ButtonThreshold?: number;
|
||||||
/** Data format version used by the device */
|
/** Data format version used by the device */
|
||||||
Format: string;
|
Format?: string;
|
||||||
/** Time zone setting for the device */
|
/** Time zone setting for the device */
|
||||||
TimeZone: string;
|
TimeZone?: string;
|
||||||
/** Unix timestamp of when device was last paired */
|
/** Unix timestamp of when device was last paired */
|
||||||
LastPaired: number;
|
LastPaired?: number;
|
||||||
/** Minimum temperature setpoint allowed */
|
/** Minimum temperature setpoint allowed */
|
||||||
MinSetpoint: number;
|
MinSetpoint?: number;
|
||||||
/** Current operating mode of the device */
|
/** Current operating mode of the device */
|
||||||
Mode: ModeObj;
|
Mode?: ModeObj;
|
||||||
/** User ID of the device owner */
|
/** User ID of the device owner */
|
||||||
Owner: string;
|
Owner?: string;
|
||||||
/** Maximum temperature setpoint allowed */
|
/** Maximum temperature setpoint allowed */
|
||||||
MaxSetpoint: number;
|
MaxSetpoint?: number;
|
||||||
/** Unique device identifier */
|
/** Unique device identifier */
|
||||||
Id: string;
|
Id: string;
|
||||||
/** Optional zone assignment for the device */
|
/** Optional zone assignment for the device */
|
||||||
|
|||||||
@@ -13,43 +13,43 @@ export interface DeviceState {
|
|||||||
/** Overall timestamp for the device state */
|
/** Overall timestamp for the device state */
|
||||||
Timestamp: number;
|
Timestamp: number;
|
||||||
/** Time the device has been on */
|
/** Time the device has been on */
|
||||||
OnTime: TimestampedValue<number>;
|
OnTime?: TimestampedValue<number>;
|
||||||
/** Temperature set point */
|
/** Temperature set point */
|
||||||
SetPoint: TimestampedValue<number>;
|
SetPoint?: TimestampedValue<number>;
|
||||||
/** Display brightness level */
|
/** Display brightness level */
|
||||||
Brightness: TimestampedValue<number>;
|
Brightness?: TimestampedValue<number>;
|
||||||
/** Schedule mode setting */
|
/** Schedule mode setting */
|
||||||
ScheduleMode: TimestampedValue<number>;
|
ScheduleMode?: TimestampedValue<number>;
|
||||||
/** Hold time setting */
|
/** Hold time setting */
|
||||||
HoldTime: TimestampedValue<number>;
|
HoldTime?: TimestampedValue<number>;
|
||||||
/** Wi-Fi signal strength */
|
/** Wi-Fi signal strength */
|
||||||
Rssi: TimestampedValue<number>;
|
Rssi?: TimestampedValue<number>;
|
||||||
/** Thermostat mode */
|
/** Thermostat mode */
|
||||||
TstatMode: TimestampedValue<number>;
|
TstatMode?: TimestampedValue<number>;
|
||||||
/** Available heap memory */
|
/** Available heap memory */
|
||||||
FreeHeap: TimestampedValue<number>;
|
FreeHeap?: TimestampedValue<number>;
|
||||||
/** Sensor temperature reading */
|
/** Sensor temperature reading */
|
||||||
SensorTemp: TimestampedValue<number>;
|
SensorTemp?: TimestampedValue<number>;
|
||||||
/** Current mode */
|
/** Current mode */
|
||||||
Mode: TimestampedValue<number>;
|
Mode?: TimestampedValue<number>;
|
||||||
/** Voltage measurement */
|
/** Voltage measurement */
|
||||||
Voltage: TimestampedValue<number>;
|
Voltage?: TimestampedValue<number>;
|
||||||
/** Temperature corrected for calibration */
|
/** Temperature corrected for calibration */
|
||||||
CorrectedTemp: TimestampedValue<number>;
|
CorrectedTemp?: TimestampedValue<number>;
|
||||||
/** Duty cycle percentage */
|
/** Duty cycle percentage */
|
||||||
Duty: TimestampedValue<number>;
|
Duty?: TimestampedValue<number>;
|
||||||
/** Heat sink temperature */
|
/** Heat sink temperature */
|
||||||
HeatSink: TimestampedValue<number>;
|
HeatSink?: TimestampedValue<number>;
|
||||||
/** Time the device has been off */
|
/** Time the device has been off */
|
||||||
OffTime: TimestampedValue<number>;
|
OffTime?: TimestampedValue<number>;
|
||||||
/** Connection status */
|
/** Connection status */
|
||||||
Connected: TimestampedValue<boolean>;
|
Connected?: TimestampedValue<boolean>;
|
||||||
/** Current consumption */
|
/** Current consumption */
|
||||||
Current: TimestampedValue<number>;
|
Current?: TimestampedValue<number>;
|
||||||
/** Humidity reading */
|
/** Humidity reading */
|
||||||
Humidity: TimestampedValue<number>;
|
Humidity?: TimestampedValue<number>;
|
||||||
/** Lock status */
|
/** Lock status */
|
||||||
Lock: TimestampedValue<number>;
|
Lock?: TimestampedValue<number>;
|
||||||
/** Fan speed */
|
/** Fan speed */
|
||||||
FanSpeed?: TimestampedValue<number>;
|
FanSpeed?: TimestampedValue<number>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user