diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 17d37a6..66c17a7 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -5,10 +5,9 @@ module.exports = { 'plugin:@typescript-eslint/recommended', 'prettier', 'plugin:import/errors', - 'plugin:jsdoc/recommended', ], parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], + plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc', 'jsdoc'], root: true, env: { es6: true, @@ -35,5 +34,17 @@ module.exports = { ], 'import/no-unresolved': ['error'], 'no-undef': ['error'], + 'tsdoc/syntax': 'error', + 'require-jsdoc': 'error', + /// TODO: https://github.com/microsoft/tsdoc/issues/209 + 'jsdoc/require-param': 'error', + 'jsdoc/require-param-description': 'error', + 'jsdoc/require-description': 'error', + 'jsdoc/require-param-name': 'error', + 'jsdoc/require-throws': 'error', + 'jsdoc/no-bad-blocks': 'error', + 'jsdoc/empty-tags': 'error', + 'jsdoc/require-jsdoc': 'error', + 'jsdoc/check-syntax': 1, }, }; diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index 26683e1..acfffbd 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -29,7 +29,7 @@ jobs: - name: Install run: yarn install - name: Build - run: npx typedoc --plugin typedoc-plugin-missing-exports + run: yarn docs - name: Setup Pages uses: actions/configure-pages@v3 - name: Upload artifact diff --git a/.husky/pre-commit b/.husky/pre-commit index 5a182ef..65d14a6 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -yarn lint-staged +yarn lint-staged -- diff --git a/.lintstagedrc.cjs b/.lintstagedrc.cjs index 7572326..5834148 100644 --- a/.lintstagedrc.cjs +++ b/.lintstagedrc.cjs @@ -1,4 +1,4 @@ module.exports = { - '*.{cjs,js,ts,json,md}': 'yarn format', - '!*.{cjs,md}': 'yarn lint', + '*.{cjs,js,ts,json,md}': ['yarn format'], + '*.{cjs,md}': [() => 'yarn lint'], }; diff --git a/package.json b/package.json index 6d26d90..877d5fa 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "prepack": "pinst --disable", "postpack": "pinst --enable", "build": "rm -rf ./dist && tsc", + "docs": "typedoc", "test": "jest", "format": "yarn prettier . --write", "lint": "eslint . --fix" @@ -34,7 +35,8 @@ "eslint": "8.49.0", "eslint-config-prettier": "9.0.0", "eslint-plugin-import": "2.28.1", - "eslint-plugin-jsdoc": "46.8.0", + "eslint-plugin-jsdoc": "^46.8.1", + "eslint-plugin-tsdoc": "0.2.17", "husky": "8.0.3", "jest": "29.7.0", "lint-staged": "14.0.1", @@ -42,7 +44,6 @@ "prettier": "3.0.3", "ts-jest": "29.1.1", "typedoc": "0.25.1", - "typedoc-plugin-missing-exports": "2.1.0", "typescript": "5.2.2" }, "dependencies": { diff --git a/src/client.ts b/src/client.ts index a75c055..5c5819f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,37 +1,39 @@ import axios, { isAxiosError } from 'axios'; -import { CLIENT_ERROR } from './errors'; -import { Accesses } from './systems/accesses'; -import { Actions } from './systems/actions'; -import { AirConditioners } from './systems/airConditioners'; -import { AlarmSystems } from './systems/alarmSystems'; -import { Analyses } from './systems/analyses'; +import { CLIENT_ERROR_MESSAGES, ClientError } from './errors'; +import { + Accesses, + Actions, + AirConditioners, + AlarmSystems, + Analyses, + Blinds, + Cameras, + Clocks, + ControlCircuits, + EnergyCosts, + EnergyManagers, + GekkoInfo, + GlobalAlarm, + HeatingCircuits, + HeatingSystems, + HotWaterCirculations, + HotWaterSystems, + Lights, + Loads, + Logics, + MultiRooms, + Pools, + RoomTemperatures, + Saunas, + SmsEmails, + Stoves, + Vents, + WallBoxes, + Weather, +} from './systems'; import { SystemType } from './systems/base/types'; -import { Blinds } from './systems/blinds'; -import { Cameras } from './systems/cameras'; -import { Clocks } from './systems/clocks'; -import { ControlCircuits } from './systems/controlCircuits'; -import { EnergyCosts } from './systems/energyCosts'; -import { EnergyManagers } from './systems/energyManagers'; -import { GekkoInfo } from './systems/gekkoInfo'; -import { GlobalAlarm } from './systems/globalAlarm'; -import { HeatingCircuits } from './systems/heatingCircuit'; -import { HeatingSystems } from './systems/heatingSystem'; -import { HotWaterCirculations } from './systems/hotWaterCirculation'; -import { HotWaterSystems } from './systems/hotWaterSystems'; -import { Lights } from './systems/lights'; -import { Loads } from './systems/loads'; -import { Logics } from './systems/logics'; -import { MultiRooms } from './systems/multiRoom'; -import { Pools } from './systems/pools'; -import { RoomTemperatures } from './systems/roomTemperatures'; -import { Saunas } from './systems/saunas'; -import { SmsEmails } from './systems/smsEmail'; -import { Stoves } from './systems/stoves/stoves'; -import { Vents } from './systems/vents'; -import { WallBoxes } from './systems/wallBoxes'; -import { Weather } from './systems/weather'; -import { throwErrorIfTrendIsNotEnabled } from './utils/errorUtils'; +import { throwErrorIfTrendIsNotEnabled } from './utils/errors/errorUtils'; /** The client configuration */ type ClientConfig = { @@ -41,7 +43,10 @@ type ClientConfig = { authQuery: string; }; -/** The remote client configuration */ +/** + * The remote client configuration. + * @group Client + */ export type RemoteClientConfig = { /** The myGEKKO account username */ username: string; @@ -51,7 +56,10 @@ export type RemoteClientConfig = { apiKey: string; }; -/** The local client configuration */ +/** + * The local client configuration. + * @group Client + */ export type LocalClientConfig = { /** The myGEKKO device ip */ ip: string; @@ -61,20 +69,35 @@ export type LocalClientConfig = { password: string; }; -/** The system Configuration of myGEKKO device. */ +/** + * The system Configuration of myGEKKO device. + * @group Client + */ export type SystemConfig = string | { [key in SystemType]: SystemConfig }; -/** The system status response. */ +/** + * The system status response. + * @group Client + */ export type SystemStatusResponse = { [itemId: string]: ItemStatusResponse }; -/** The system item status response. */ +/** + * The system item status response. + * @group Client + */ export type ItemStatusResponse = { + /** + * + */ sumstate: { value: string; }; }; -/** The trend item */ +/** + * The trend item. + * @group Client + */ export type TrendItemResponse = { /** The return value */ returnValue: number | null; @@ -109,16 +132,14 @@ export abstract class Client { private _trendConfig: SystemConfig = ''; /** - * The myGEKKO device system configuration - * @returns {SystemConfig} the myGEKKO device system configuration + * The myGEKKO device system configuration. */ public get systemConfig(): SystemConfig { return this._systemConfig; } /** - * The myGEKKO device trend configuration - * @returns {SystemConfig} the myGEKKO device trend configuration + * The myGEKKO device trend configuration. */ public get trendConfig(): SystemConfig { return this._trendConfig; @@ -184,49 +205,54 @@ export abstract class Client { public readonly weather: Weather = new Weather(this); /** - * The constructor of Client - * @param {SystemConfig} config myGEKKO device configuration + * The constructor of Client. + * @param config - MyGEKKO device configuration. */ protected constructor(config: ClientConfig) { this.baseUrl = config.baseUrl; this.authQueryString = config.authQuery; } - /** Initialize the client and load the system and trend configurations */ + /** + * Initialize the client and load the system and trend configurations. + * @throws {@link ClientError} + */ public async initialize(): Promise { if (this.systemConfig) { - throw Error(CLIENT_ERROR.ALREADY_INITIALIZED); + throw Error(CLIENT_ERROR_MESSAGES.ALREADY_INITIALIZED); } this._systemConfig = await this.internalRequest('/var?'); this._trendConfig = await this.internalRequest('/trend?'); } - /** Rescan the myGEKKO device system and trend configurations */ + /** + * Rescan the myGEKKO device system and trend configurations. + * @throws {@link ClientError} + */ public async rescan(): Promise { if (!this.systemConfig) { - throw Error(CLIENT_ERROR.SYSTEM_NOT_INITIALIZED); + throw Error(CLIENT_ERROR_MESSAGES.SYSTEM_NOT_INITIALIZED); } this._systemConfig = await this.internalRequest('/var?'); this._trendConfig = await this.internalRequest('/trend?'); } /** - * Makes a http request - * @param {string} endpoint the myGEKKO device API endpoint - * @returns {string} the response + * Makes a http request. + * @param endpoint - The myGEKKO device API endpoint. + * @throws {@link ClientError} */ public async request(endpoint: string): Promise { if (!this.systemConfig) { - throw Error(CLIENT_ERROR.SYSTEM_NOT_INITIALIZED); + throw Error(CLIENT_ERROR_MESSAGES.SYSTEM_NOT_INITIALIZED); } return await this.internalRequest(endpoint); } /** - * internal http request wrapper. - * @param {string} endpoint the myGEKKO device API endpoint - * @returns {string} the response - * @throws {Error} + * Internal http request wrapper. + * @param endpoint - The myGEKKO device API endpoint. + * @throws {@link ClientError} */ private async internalRequest(endpoint: string): Promise { try { @@ -236,96 +262,108 @@ export abstract class Client { if (isAxiosError(error) && error.response) { switch (error.response.status) { case 400: - throw new Error(CLIENT_ERROR.BAD_REQUEST); + throw new ClientError(CLIENT_ERROR_MESSAGES.BAD_REQUEST); case 403: - throw new Error(CLIENT_ERROR.BAD_LOGIN); + throw new ClientError(CLIENT_ERROR_MESSAGES.BAD_LOGIN); case 404: - throw new Error(CLIENT_ERROR.RESOURCE_NOT_FOUND); + throw new ClientError(CLIENT_ERROR_MESSAGES.RESOURCE_NOT_FOUND); case 405: - throw new Error(CLIENT_ERROR.PERMISSION_DENIED); + throw new ClientError(CLIENT_ERROR_MESSAGES.PERMISSION_DENIED); case 410: - throw new Error(CLIENT_ERROR.GEKKO_OFFLINE); + throw new ClientError(CLIENT_ERROR_MESSAGES.GEKKO_OFFLINE); case 429: - throw new Error(CLIENT_ERROR.TO_MANY_REQUEST); + throw new ClientError(CLIENT_ERROR_MESSAGES.TO_MANY_REQUEST); case 444: - throw new Error(CLIENT_ERROR.NOT_EXECUTED); + throw new ClientError(CLIENT_ERROR_MESSAGES.NOT_EXECUTED); case 500: - throw new Error(CLIENT_ERROR.INTERNAL_SERVER_ERROR); + throw new ClientError(CLIENT_ERROR_MESSAGES.INTERNAL_SERVER_ERROR); case 503: - throw new Error(CLIENT_ERROR.SERVICE_NOT_AVAILABLE); + throw new ClientError(CLIENT_ERROR_MESSAGES.SERVICE_NOT_AVAILABLE); default: - throw Error(`${CLIENT_ERROR.SERVICE_NOT_AVAILABLE}: ${error.response.status}`); + throw new Error( + `${CLIENT_ERROR_MESSAGES.SERVICE_NOT_AVAILABLE}: ${error.response.status}` + ); } } else if (isAxiosError(error) && error.request) { throw new Error(error.message); } else if (error instanceof Error) { throw new Error(error.message); } else { - throw new Error(CLIENT_ERROR.UNKNOWN_ERROR); + throw new ClientError(CLIENT_ERROR_MESSAGES.UNKNOWN_ERROR); } } } /** * Makes system status http request to the myGEKKO device API. - * @param {SystemType} res the myGEKKO device API endpoint - * @returns {string} the response + * @param systemType - The myGEKKO device API endpoint. + * @throws {@link ClientError} */ - public async systemStatusRequest(res: SystemType): Promise { - return await this.request(`/var/${res}/status?`); + public async systemStatusRequest(systemType: SystemType): Promise { + return await this.request(`/var/${systemType}/status?`); } /** * Makes system status http request to the myGEKKO device API for a single item. - * @param {SystemType} res the myGEKKO device API endpoint - * @param {string} itemId the item id - * @returns {string} the response + * @param systemType - The myGEKKO device API endpoint. + * @param itemId - The item id. + * @throws {@link ClientError} */ - public async itemStatusRequest(res: SystemType, itemId: string): Promise { - return await this.request(`/var/${res}/${itemId}/status?`); + public async itemStatusRequest( + systemType: SystemType, + itemId: string + ): Promise { + return await this.request(`/var/${systemType}/${itemId}/status?`); } /** * Makes update request to the myGEKKO device API. - * @param {SystemType} res the myGEKKO device API endpoint - * @param {string} itemId the item id - * @param {string} query the query params - * @returns {string} the response + * @param systemType - The myGEKKO device API endpoint. + * @param itemId - The item id. + * @param query - The query params. + * @throws {@link ClientError} */ - public async changeRequest(res: SystemType, itemId: string, query: string): Promise { - return await this.request(`/var/${res}/${itemId}/scmd/set?value=${query}&`); + public async changeRequest( + systemType: SystemType, + itemId: string, + query: string + ): Promise { + return await this.request(`/var/${systemType}/${itemId}/scmd/set?value=${query}&`); } /** * Makes status request to the myGEKKO device API to get a single item trend by system. - * @param {SystemType} res the myGEKKO device API endpoint - * @param {string} itemId the item id - * @param {string} trendId the item trend id - * @param {string} startDate the start date as valid date string - * @param {string} endDate the end date as valid date string - * @param {number} count the data count - * @returns {string} the response + * @param systemType - The myGEKKO device API endpoint. + * @param itemId - The item id. + * @param trendId - The item trend id. + * @param startDate - The start date as valid date string. + * @param endDate - The end date as valid date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( - res: SystemType, + systemType: SystemType, itemId: string, trendId: string, startDate: string, endDate: string, count: number ): Promise { - throwErrorIfTrendIsNotEnabled(this.systemConfig, res); + throwErrorIfTrendIsNotEnabled(this.systemConfig, systemType); return await this.request( - `/trend/${res}/${itemId}/${trendId}/status?tstart=${startDate}&tend=${endDate}&datacount=${count}&` + `/trend/${systemType}/${itemId}/${trendId}/status?tstart=${startDate}&tend=${endDate}&datacount=${count}&` ); } } -/** The remote client class. */ +/** + * The remote client class. + * @group Client + */ export class RemoteClient extends Client { /** * The local client constructor. - * @param {SystemConfig} config the local client configuration. + * @param config - The local client configuration. */ public constructor(config: RemoteClientConfig) { super({ @@ -335,11 +373,14 @@ export class RemoteClient extends Client { } } -/** The local client class. */ +/** + * The local client class. + * @group Client + */ export class LocalClient extends Client { /** * The local client constructor. - * @param {SystemConfig} config the remote client configuration. + * @param config - The remote client configuration. */ public constructor(config: LocalClientConfig) { super({ diff --git a/src/errors.ts b/src/errors.ts index d73e1ca..b8afb37 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -1,21 +1,45 @@ /** - * A list of all possible errors + * A list of all possible errors. + * @group Client */ -export const CLIENT_ERROR = { - BAD_LOGIN: 'auth/bad-login', - PERMISSION_DENIED: 'auth/permission-denied', - GEKKO_OFFLINE: 'auth/gekko-offline', - RESOURCE_NOT_FOUND: 'request/bad-request', - BAD_REQUEST: 'request/bad-request', - TO_MANY_REQUEST: 'request/tom-many-request', - NOT_EXECUTED: 'request/not-executed', - INTERNAL_SERVER_ERROR: 'request/internal-server-error', - SERVICE_NOT_AVAILABLE: 'request/service-not-available', - SYSTEM_NOT_INITIALIZED: 'client/client-not-initialized', - ALREADY_INITIALIZED: 'client/client-already-initialized', - SYSTEM_NOT_SUPPORTED: 'client/system-not-supported', - TREND_NOT_SUPPORTED: 'client/trend-not-supported', - CANNOT_PARSE_STATUS: 'client/cannot-parse-status', - ITEM_ID_NOT_FOUND: 'client/item-id-not-found', - UNKNOWN_ERROR: 'client/unknown-error', -}; +export enum CLIENT_ERROR_MESSAGES { + /** Status code 403 */ + BAD_LOGIN = 'auth/bad-login', + /** Status code 405 */ + PERMISSION_DENIED = 'auth/permission-denied', + /** Status code 410 */ + GEKKO_OFFLINE = 'auth/gekko-offline', + /** Status code 404 */ + RESOURCE_NOT_FOUND = 'request/resource-not-found', + /** Status code 400 */ + BAD_REQUEST = 'request/bad-request', + /** Status code 429 */ + TO_MANY_REQUEST = 'request/tom-many-request', + /** Status code 444 */ + NOT_EXECUTED = 'request/not-executed', + /** Status code 500 */ + INTERNAL_SERVER_ERROR = 'request/internal-server-error', + /** Status code 503 */ + SERVICE_NOT_AVAILABLE = 'request/service-not-available', + SYSTEM_NOT_INITIALIZED = 'client/client-not-initialized', + ALREADY_INITIALIZED = 'client/client-already-initialized', + SYSTEM_NOT_SUPPORTED = 'client/system-not-supported', + TREND_NOT_SUPPORTED = 'client/trend-not-supported', + CANNOT_PARSE_STATUS = 'client/cannot-parse-status', + ITEM_ID_NOT_FOUND = 'client/item-id-not-found', + UNKNOWN_ERROR = 'client/unknown-error', +} + +/** + * The client error class. + * @group Client + */ +export class ClientError extends Error { + /** + * The client error constructor. + * @param message - The error message. + */ + public constructor(message: CLIENT_ERROR_MESSAGES) { + super(message); + } +} diff --git a/src/index.ts b/src/index.ts index 46ab3d3..2de12cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,18 +1,324 @@ import { + ItemStatusResponse, LocalClient, LocalClientConfig, RemoteClient, RemoteClientConfig, SystemConfig, + SystemStatusResponse, + TrendItemResponse, } from './client'; -import * as systemTypes from './systems/types'; -import * as colorUtils from './utils/colorUtils'; +import { CLIENT_ERROR_MESSAGES, ClientError } from './errors'; +import { + Accesses, + Actions, + AirConditioners, + AlarmSystems, + Analyses, + Blinds, + Cameras, + Clocks, + ControlCircuits, + EnergyCosts, + EnergyManagers, + GekkoInfo, + GlobalAlarm, + HeatingCircuits, + HeatingSystems, + HotWaterCirculations, + HotWaterSystems, + Lights, + Loads, + Logics, + MultiRooms, + Pools, + RoomTemperatures, + Saunas, + SmsEmails, + Stoves, + Vents, + WallBoxes, + Weather, +} from './systems'; +import { + Access, + AccessStartConditionState, + AccessState, + AccessType, + Action, + ActionStartConditionState, + ActionState, + AirConditioner, + AirConditionerExhaustState, + AirConditionerState, + AirConditionerSupplyState, + AirConditionerWorkingMode, + AlarmDevice, + AlarmSystem, + AlarmSystemDeviceModel, + AlarmSystemDeviceSharpState, + AlarmSystemDeviceState, + AlarmSystemState, + Analysis, + AnalysisState, + AnalysisType, + AnalysisVariable, + BaseSystemType, + BatteryState, + BatteryType, + Blind, + BlindRotationRange, + BlindState, + Camera, + Clock, + ClockStartConditionState, + ClockState, + ControlCircuit, + ControlCircuitSensorType, + EMSEnabledState, + EMSState, + EnergyCost, + EnergyCostsCounterDirection, + EnergyManager, + GekkoInfoItem, + GekkoLanguage, + GlobalAlarmItem, + GlobalAlarmState, + HeatingCircuit, + HeatingCircuitCoolingMode, + HeatingCircuitDeviceModel, + HeatingCircuitState, + HeatingSystem, + HeatingSystemCoolingState, + HeatingSystemDeviceModel, + HeatingSystemState, + HotWaterCirculation, + HotWaterCirculationPumpType, + HotWaterCirculationState, + HotWaterSystem, + HotWaterSystemCoolingModeState, + HotWaterSystemDeviceModel, + HotWaterSystemState, + Light, + LightState, + Load, + LoadSheddingState, + LoadState, + Logic, + MultiRoom, + MultiRoomPlayList, + MultiRoomState, + NetState, + Pool, + PoolBackWashState, + PoolFilteringState, + PoolWorkingMode, + RoomTemperature, + RoomTemperatureCoolingState, + RoomTemperatureDeviceModel, + RoomTemperatureWorkingModeKnx, + RoomTemperatureWorkingModeStandard, + Sauna, + SaunaErrorState, + SaunaState, + SaunaWorkingMode, + SmsEmail, + SmsEmailState, + SolarState, + Stove, + StovesState, + StoveWorkingState, + SumState, + SystemType, + Trend, + TrendItem, + Vent, + VentBypassState, + VentCoolingModeState, + VentDehumidificationState, + VentDeviceModel, + VentLevel, + VentSubWorkingMode, + VentSubWorkingModeProxxon, + VentWorkingModeIndividual, + VentWorkingModePluggit, + VentWorkingModeProxxonV1, + VentWorkingModeProxxonV2, + VentWorkingModeStiebelTecalor, + VentWorkingModeWestaflex, + WallBox, + WallBoxChargeRequestState, + WallBoxChargeState, + WallBoxPluggedState, + WallBoxUser, + WeatherItem, +} from './systems/types'; +import { + decimalToHexColor, + hexToDecimal, + rgbToDecimal, + rgbToHex, + tunableWhiteToHex, +} from './utils'; /** The different clients. */ -export { LocalClient, RemoteClient, LocalClientConfig, RemoteClientConfig, SystemConfig }; +export { + LocalClient, + RemoteClient, + LocalClientConfig, + RemoteClientConfig, + SystemConfig, + SystemStatusResponse, + TrendItemResponse, + ItemStatusResponse, +}; + +export { + Access, + AccessState, + AccessStartConditionState, + AccessType, + Action, + ActionState, + ActionStartConditionState, + SystemType, + Trend, + BaseSystemType, + SumState, + TrendItem, + AirConditioner, + AirConditionerWorkingMode, + AirConditionerState, + AirConditionerSupplyState, + AirConditionerExhaustState, + AlarmSystem, + AlarmSystemState, + AlarmDevice, + AlarmSystemDeviceState, + AlarmSystemDeviceModel, + AlarmSystemDeviceSharpState, + Blind, + BlindState, + BlindRotationRange, + Camera, + Clock, + ClockState, + ClockStartConditionState, + ControlCircuit, + ControlCircuitSensorType, + EnergyCost, + EnergyCostsCounterDirection, + EnergyManager, + EMSState, + EMSEnabledState, + SolarState, + BatteryState, + BatteryType, + LoadSheddingState, + NetState, + GekkoInfoItem, + GekkoLanguage, + GlobalAlarmItem, + GlobalAlarmState, + HeatingCircuit, + HeatingCircuitState, + HeatingCircuitCoolingMode, + HeatingCircuitDeviceModel, + HeatingSystem, + HeatingSystemState, + HeatingSystemCoolingState, + HeatingSystemDeviceModel, + HotWaterCirculation, + HotWaterCirculationState, + HotWaterCirculationPumpType, + HotWaterSystem, + HotWaterSystemState, + HotWaterSystemCoolingModeState, + HotWaterSystemDeviceModel, + Light, + LightState, + Load, + LoadState, + Logic, + MultiRoom, + MultiRoomState, + MultiRoomPlayList, + Pool, + PoolWorkingMode, + PoolFilteringState, + PoolBackWashState, + RoomTemperature, + RoomTemperatureWorkingModeKnx, + RoomTemperatureWorkingModeStandard, + RoomTemperatureCoolingState, + RoomTemperatureDeviceModel, + Sauna, + SaunaState, + SaunaErrorState, + SaunaWorkingMode, + SmsEmailState, + SmsEmail, + Stove, + StovesState, + StoveWorkingState, + Analysis, + AnalysisType, + AnalysisState, + AnalysisVariable, + Vent, + VentLevel, + VentWorkingModeProxxonV1, + VentWorkingModePluggit, + VentWorkingModeWestaflex, + VentBypassState, + VentWorkingModeStiebelTecalor, + VentWorkingModeIndividual, + VentWorkingModeProxxonV2, + VentDeviceModel, + VentCoolingModeState, + VentDehumidificationState, + VentSubWorkingModeProxxon, + VentSubWorkingMode, + WallBox, + WallBoxUser, + WallBoxChargeState, + WallBoxPluggedState, + WallBoxChargeRequestState, + WeatherItem, +}; + +export { + Accesses, + Actions, + AirConditioners, + AlarmSystems, + Blinds, + Cameras, + Clocks, + ControlCircuits, + EnergyCosts, + EnergyManagers, + GekkoInfo, + GlobalAlarm, + HeatingCircuits, + HeatingSystems, + HotWaterCirculations, + HotWaterSystems, + Lights, + Loads, + Logics, + MultiRooms, + Pools, + RoomTemperatures, + Saunas, + SmsEmails, + Stoves, + Analyses, + Vents, + WallBoxes, + Weather, +}; -/** The myGEKKO systems. */ -export { systemTypes }; +export { tunableWhiteToHex, rgbToHex, rgbToDecimal, hexToDecimal, decimalToHexColor }; -/** The color utils. */ -export { colorUtils }; +export { ClientError, CLIENT_ERROR_MESSAGES }; diff --git a/src/systems/accesses/index.ts b/src/systems/accesses/index.ts index d6e8445..6b6e138 100644 --- a/src/systems/accesses/index.ts +++ b/src/systems/accesses/index.ts @@ -1,19 +1,20 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { Access, AccessState } from './types'; -const res = SystemType.accesses; - +const systemType = SystemType.accesses; +/** + * @group Systems + */ export class Accesses extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Access} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Access { const values = valuesToStringList(status); @@ -32,47 +33,42 @@ export class Accesses extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -80,14 +76,14 @@ export class Accesses extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the state. - * @param {string} itemId the item id - * @param {AccessState} state the new state - * @throws {Error} + * @param itemId - The item id. + * @param state - The new state. + * @throws {@link ClientError} */ public async setOpenState(itemId: string, state: AccessState): Promise { let value = -1; @@ -102,6 +98,6 @@ export class Accesses extends BaseSystem { value = 2; break; } - await this.client.changeRequest(res, itemId, `${value}`); + await this.client.changeRequest(systemType, itemId, `${value}`); } } diff --git a/src/systems/accesses/types.ts b/src/systems/accesses/types.ts index e34d77b..2d27f4a 100644 --- a/src/systems/accesses/types.ts +++ b/src/systems/accesses/types.ts @@ -1,5 +1,9 @@ import { BaseSystemType } from '../base/types'; +/** + * @group Systems + */ +/** @group Systems */ export type Access = BaseSystemType & { /** The current state */ currentState: AccessState | null; @@ -11,20 +15,29 @@ export type Access = BaseSystemType & { accessType: AccessType | null; }; -/** The access states */ +/** + * The access states. + * @group Systems + */ export enum AccessState { 'close' = 0, 'open' = 1, 'keepOpen' = 2, } -/** The access start condition states */ +/** + * The access start condition states. + * @group Systems + */ export enum AccessStartConditionState { 'off' = 0, 'on' = 1, } -/** The access types */ +/** + * The access types. + * @group Systems + */ export enum AccessType { 'door' = 0, 'gate' = 1, diff --git a/src/systems/actions/index.ts b/src/systems/actions/index.ts index 683dd2a..eef6531 100644 --- a/src/systems/actions/index.ts +++ b/src/systems/actions/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { Action, ActionState } from './types'; -const res = SystemType.actions; +const systemType = SystemType.actions; +/** + * @group Systems + */ export class Actions extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Action} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Action { const values = valuesToStringList(status); @@ -30,47 +32,43 @@ export class Actions extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -78,16 +76,16 @@ export class Actions extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the state. - * @param {string} itemId the item id - * @param {ActionState} state the new state - * @throws {Error} + * @param itemId - The item id. + * @param state - The new state. + * @throws {@link ClientError} */ public async setState(itemId: string, state: ActionState): Promise { - await this.client.changeRequest(res, itemId, `${state}`); + await this.client.changeRequest(systemType, itemId, `${state}`); } } diff --git a/src/systems/actions/types.ts b/src/systems/actions/types.ts index 5478043..f0bb1cf 100644 --- a/src/systems/actions/types.ts +++ b/src/systems/actions/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Action = BaseSystemType & { /** The current state */ currentState: ActionState | null; @@ -7,14 +8,20 @@ export type Action = BaseSystemType & { startCondition: ActionStartConditionState | null; }; -/** The action states */ +/** + * The action states. + * @group Systems + */ export enum ActionState { 'locked' = 0, 'open' = 1, 'keepOpen' = 2, } -/** The action start condition states */ +/** + * The action start condition states. + * @group Systems + */ export enum ActionStartConditionState { 'off' = 0, 'on' = 1, diff --git a/src/systems/airConditioners/index.ts b/src/systems/airConditioners/index.ts index 319915f..9cac835 100644 --- a/src/systems/airConditioners/index.ts +++ b/src/systems/airConditioners/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { AirConditioner, AirConditionerState, AirConditionerWorkingMode } from './types'; -const res = SystemType.airConditioner; +const systemType = SystemType.airConditioner; +/** + * @group Systems + */ export class AirConditioners extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {AirConditioner} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem( config: SystemConfig, @@ -57,96 +59,93 @@ export class AirConditioners extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Sets the state. - * @param {string} itemId the item id - * @param {AirConditionerState} state the new state - * @throws {Error} + * @param itemId - The item id. + * @param state - The new state. + * @throws {@link ClientError} */ public async setState(itemId: string, state: AirConditionerState): Promise { - await this.client.changeRequest(res, itemId, `${state}`); + await this.client.changeRequest(systemType, itemId, `${state}`); } /** * Sets the mode. - * @param {string} itemId the item id - * @param {AirConditionerWorkingMode} mode the new mode - * @throws {Error} + * @param itemId - The item id. + * @param mode - The new mode. + * @throws {@link ClientError} */ public async setMode(itemId: string, mode: AirConditionerWorkingMode): Promise { - await this.client.changeRequest(res, itemId, `M${mode}`); + await this.client.changeRequest(systemType, itemId, `M${mode}`); } /** * Sets the power. - * @param {string} itemId the item id - * @param {number} power the new power - * @throws {Error} + * @param itemId - The item id. + * @param power - The new power. + * @throws {@link ClientError} */ public async setPower(itemId: string, power: number): Promise { - await this.client.changeRequest(res, itemId, `P${power}`); + await this.client.changeRequest(systemType, itemId, `P${power}`); } /** * Sets the min flap. - * @param {string} itemId the item id - * @param {number} flaps the new min flaps - * @throws {Error} + * @param itemId - The item id. + * @param flaps - The new min flaps. + * @throws {@link ClientError} */ public async setMinFlap(itemId: string, flaps: number): Promise { - await this.client.changeRequest(res, itemId, `F${flaps}`); + await this.client.changeRequest(systemType, itemId, `F${flaps}`); } /** * Sets the air quality. - * @param {string} itemId the item id - * @param {number} airQuality the new air quality - * @throws {Error} + * @param itemId - The item id. + * @param airQuality - The new air quality. + * @throws {@link ClientError} */ public async setAirQuality(itemId: string, airQuality: number): Promise { - await this.client.changeRequest(res, itemId, `Q${airQuality}`); + await this.client.changeRequest(systemType, itemId, `Q${airQuality}`); } /** * Sets the humidity. - * @param {string} itemId the item id - * @param {number} humidity the new humidity - * @throws {Error} + * @param itemId - The item id. + * @param humidity - The new humidity. + * @throws {@link ClientError} */ public async setHumidity(itemId: string, humidity: number): Promise { - await this.client.changeRequest(res, itemId, `H${humidity}`); + await this.client.changeRequest(systemType, itemId, `H${humidity}`); } } diff --git a/src/systems/airConditioners/types.ts b/src/systems/airConditioners/types.ts index a8c0077..a2eb2ae 100644 --- a/src/systems/airConditioners/types.ts +++ b/src/systems/airConditioners/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type AirConditioner = BaseSystemType & { /** The supply air temperature -100-100 as C° */ supplyAirTemperature: number | null; @@ -25,13 +26,13 @@ export type AirConditioner = BaseSystemType & { airQualityLevel: number | null; /** The air quality 0-100 as % */ airQualitySetPointLevel: number | null; - /** The supply pressure 0-... as Pa */ + /** The supply pressure 0-... As Pa */ supplyPressure: number | null; - /** The supply pressure set point 0-... as Pa */ + /** The supply pressure set point 0-... As Pa */ supplyPressureSetPoint: number | null; - /** The exhaust pressure 0-... as Pa */ + /** The exhaust pressure 0-... As Pa */ exhaustPressure: number | null; - /** The exhaust pressure set point 0-... as Pa */ + /** The exhaust pressure set point 0-... As Pa */ exhaustPressureSetPoint: number | null; /** The working level set point level 0-100 as % */ workingLevelSetPointLevel: number | null; @@ -53,25 +54,37 @@ export type AirConditioner = BaseSystemType & { workingMode: AirConditionerWorkingMode | null; }; -/** The air conditioner supply states */ +/** + * The air conditioner supply states. + * @group Systems + */ export enum AirConditionerSupplyState { 'off' = 0, 'on' = 1, } -/** The air conditioner exhaust states */ +/** + * The air conditioner exhaust states. + * @group Systems + */ export enum AirConditionerExhaustState { 'off' = 0, 'on' = 1, } -/** The air conditioner states */ +/** + * The air conditioner states. + * @group Systems + */ export enum AirConditionerState { 'off' = 0, 'on' = 1, } -/** The air conditioner working modes */ +/** + * The air conditioner working modes. + * @group Systems + */ export enum AirConditionerWorkingMode { 'off' = 0, 'heating' = 1, diff --git a/src/systems/alarmSystems/index.ts b/src/systems/alarmSystems/index.ts index 3f7d699..a07d50c 100644 --- a/src/systems/alarmSystems/index.ts +++ b/src/systems/alarmSystems/index.ts @@ -1,25 +1,27 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { AlarmSystem } from './types'; -const res = SystemType.alarmSystem; +const systemType = SystemType.alarmSystem; /** * Parses the item. - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. + */ +/** + * @group Systems */ export class AlarmSystems extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {AlarmSystem} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): AlarmSystem { const values = valuesToStringList(status); @@ -50,47 +52,43 @@ export class AlarmSystems extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -98,16 +96,16 @@ export class AlarmSystems extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the state. - * @param {string} itemId the item id - * @param {string} zone the zone - * @throws {Error} + * @param itemId - The item id. + * @param zone - The zone. + * @throws {@link ClientError} */ public async setSharped(itemId: string, zone: number): Promise { - await this.client.changeRequest(res, itemId, `${zone}`); + await this.client.changeRequest(systemType, itemId, `${zone}`); } } diff --git a/src/systems/alarmSystems/types.ts b/src/systems/alarmSystems/types.ts index 06df930..aab8079 100644 --- a/src/systems/alarmSystems/types.ts +++ b/src/systems/alarmSystems/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type AlarmSystem = BaseSystemType & { /** The alarm state */ alarmSystemState: AlarmSystemState | null; @@ -10,6 +11,7 @@ export type AlarmSystem = BaseSystemType & { }; /** The alarm device */ +/** @group Systems */ export type AlarmDevice = { /** The alarm zone */ zone: string | null; @@ -21,27 +23,39 @@ export type AlarmDevice = { sharpState: AlarmSystemDeviceSharpState | null; }; -/** The alarm system state */ +/** + * The alarm system state. + * @group Systems + */ export enum AlarmSystemState { 'ok' = 0, 'alarm' = 1, 'keepOpen' = 2, } -/** The alarm system device type state */ +/** + * The alarm system device type state. + * @group Systems + */ export enum AlarmSystemDeviceState { 'ok' = 0, 'alarmButtonUnSharp' = 2, 'alarm' = 3, } -/** The alarm system device sharp state */ +/** + * The alarm system device sharp state. + * @group Systems + */ export enum AlarmSystemDeviceSharpState { 'unSharp' = 0, 'sharp' = 1, } -/** The alarm system device model */ +/** + * The alarm system device model. + * @group Systems + */ export enum AlarmSystemDeviceModel { 'standard' = 1, 'complex400_V1' = 2, diff --git a/src/systems/analyses/index.ts b/src/systems/analyses/index.ts index ca97a42..5e1a320 100644 --- a/src/systems/analyses/index.ts +++ b/src/systems/analyses/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { Analysis } from './types'; -const res = SystemType.analyses; +const systemType = SystemType.analyses; +/** + * @group Systems + */ export class Analyses extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Analysis} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Analysis { const values = valuesToStringList(status); @@ -58,47 +60,43 @@ export class Analyses extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -106,6 +104,6 @@ export class Analyses extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } } diff --git a/src/systems/analyses/types.ts b/src/systems/analyses/types.ts index 8096b34..5925883 100644 --- a/src/systems/analyses/types.ts +++ b/src/systems/analyses/types.ts @@ -1,17 +1,24 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Analysis = BaseSystemType & { /** The current variables */ analysisVariables: AnalysisVariable[] | null; }; -/** The analysis states */ +/** + * The analysis states. + * @group Systems + */ export enum AnalysisState { 'off' = 0, 'on' = 1, } -/** The analysis types */ +/** + * The analysis types. + * @group Systems + */ export enum AnalysisType { 'logic' = 0, 'dIn' = 1, @@ -24,6 +31,7 @@ export enum AnalysisType { } /** The analysis variable */ +/** @group Systems */ export type AnalysisVariable = { /** The current analysis state */ currentState: AnalysisState | null; diff --git a/src/systems/base/index.ts b/src/systems/base/index.ts index 7c535b7..6bdc06c 100644 --- a/src/systems/base/index.ts +++ b/src/systems/base/index.ts @@ -3,16 +3,19 @@ import { throwErrorIfItemIdIsNoFound, throwErrorIfSystemIsNotEnabled, throwErrorIfTrendIsNotEnabled, -} from '../../utils/errorUtils'; +} from '../../utils/errors/errorUtils'; import { SystemType, Trend, TrendItem } from './types'; +/** + * + */ export class BaseSystem { /** The client instance */ protected readonly client: LocalClient | RemoteClient; /** * The base system constructor. - * @param {LocalClient | RemoteClient} client the client. + * @param client - The client. */ public constructor(client: LocalClient | RemoteClient) { this.client = client; @@ -20,43 +23,43 @@ export class BaseSystem { /** * Return the complete status by system. - * @param {SystemType} res the system type - * @returns {string} the response - * @throws {Error} + * @param systemType - The system type. + * @throws {@link ClientError} */ - protected async getCompleteStatus(res: SystemType): Promise { - throwErrorIfSystemIsNotEnabled(this.client.systemConfig, res); + protected async getCompleteStatus(systemType: SystemType): Promise { + throwErrorIfSystemIsNotEnabled(this.client.systemConfig, systemType); - return await this.client.systemStatusRequest(res); + return await this.client.systemStatusRequest(systemType); } /** * Return the status by system and item id. - * @param {SystemType} res the system type - * @param {string} itemId the item id - * @returns {string} the response - * @throws {Error} + * @param systemType - The system type. + * @param itemId - The item id. + * @throws {@link ClientError} */ - protected async getStatusById(res: SystemType, itemId: string): Promise { - throwErrorIfSystemIsNotEnabled(this.client.systemConfig, res); - throwErrorIfItemIdIsNoFound(this.client.trendConfig, res, itemId); + protected async getStatusById( + systemType: SystemType, + itemId: string + ): Promise { + throwErrorIfSystemIsNotEnabled(this.client.systemConfig, systemType); + throwErrorIfItemIdIsNoFound(this.client.trendConfig, systemType, itemId); - return await this.client.itemStatusRequest(res, itemId); + return await this.client.itemStatusRequest(systemType, itemId); } /** * Return a parsed trend. - * @param {SystemType} res the system type - * @param {string} item the item - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} the response - * @throws {Error} + * @param systemType - The system type. + * @param item - The item. + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ private async parseItemTrend( - res: SystemType, + systemType: SystemType, item: string, itemId: string, startDate: string, @@ -67,7 +70,7 @@ export class BaseSystem { for (const trendId of Object.keys(item['trends'])) { const response = await this.client.getTrendByItemId( - res, + systemType, itemId, trendId, startDate, @@ -94,27 +97,26 @@ export class BaseSystem { /** * Return parsed trends. - * @param {SystemType} res the system type - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} the response - * @throws {Error} + * @param systemType - The system type. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ protected async getTrendsStatuses( - res: SystemType, + systemType: SystemType, startDate: string, endDate: string, count: number ): Promise { - throwErrorIfTrendIsNotEnabled(this.client.trendConfig, res); + throwErrorIfTrendIsNotEnabled(this.client.trendConfig, systemType); const items: Trend[] = []; - for (const key of Object.keys(this.client.trendConfig[res])) { + for (const key of Object.keys(this.client.trendConfig[systemType])) { items.push( await this.parseItemTrend( - res, - this.client.trendConfig[res][key], + systemType, + this.client.trendConfig[systemType][key], key, startDate, endDate, @@ -127,27 +129,26 @@ export class BaseSystem { /** * Return a parsed trend item. - * @param {SystemType} res the system type - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {string} the response - * @throws {Error} + * @param systemType - The system type. + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ protected async getTrendStatus( - res: SystemType, + systemType: SystemType, itemId: string, startDate: string, endDate: string, count: number ): Promise { - throwErrorIfTrendIsNotEnabled(this.client.trendConfig, res); - throwErrorIfItemIdIsNoFound(this.client.trendConfig, res, itemId); + throwErrorIfTrendIsNotEnabled(this.client.trendConfig, systemType); + throwErrorIfItemIdIsNoFound(this.client.trendConfig, systemType, itemId); return await this.parseItemTrend( - res, - this.client.trendConfig[res][itemId], + systemType, + this.client.trendConfig[systemType][itemId], itemId, startDate, endDate, diff --git a/src/systems/base/types.ts b/src/systems/base/types.ts index 5cd0e9b..40946b7 100644 --- a/src/systems/base/types.ts +++ b/src/systems/base/types.ts @@ -1,4 +1,5 @@ /** The system base */ +/** @group Systems */ export type BaseSystemType = { /** The item id */ itemId: string | null; @@ -10,7 +11,10 @@ export type BaseSystemType = { sumState: SumState | null; }; -/** The system sum states */ +/** + * The system sum states. + * @group Systems + */ export enum SumState { 'ok' = 0, 'manualOf' = 1, @@ -19,7 +23,10 @@ export enum SumState { 'alarm' = 4, } -/** The supported systems */ +/** + * The supported systems. + * @group Systems + */ export enum SystemType { 'globals' = 'globals', 'weather' = 'globals/meteo', @@ -54,6 +61,7 @@ export enum SystemType { } /** The trend */ +/** @group Systems */ export type Trend = { /** The trend item id */ itemId: string | null; @@ -64,6 +72,7 @@ export type Trend = { }; /** The trend item */ +/** @group Systems */ export type TrendItem = { /** The trend id */ trendId: string | null; diff --git a/src/systems/blinds/index.ts b/src/systems/blinds/index.ts index 3e11157..0a297e7 100644 --- a/src/systems/blinds/index.ts +++ b/src/systems/blinds/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { Blind, BlindState } from './types'; -const res = SystemType.blinds; +const systemType = SystemType.blinds; +/** + * @group Systems + */ export class Blinds extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Blind} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Blind { const values = valuesToStringList(status); @@ -32,47 +34,43 @@ export class Blinds extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -80,36 +78,36 @@ export class Blinds extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the state. - * @param {string} itemId the item id - * @param {BlindState} state the new state - * @throws {Error} + * @param itemId - The item id. + * @param state - The new state. + * @throws {@link ClientError} */ public async setState(itemId: string, state: BlindState): Promise { - await this.client.changeRequest(res, itemId, `${state}`); + await this.client.changeRequest(systemType, itemId, `${state}`); } /** * Sets the position. - * @param {string} itemId the item id - * @param {number} position the new position - * @throws {Error} + * @param itemId - The item id. + * @param position - The new position. + * @throws {@link ClientError} */ public async setPosition(itemId: string, position: number): Promise { - await this.client.changeRequest(res, itemId, `P${position}`); + await this.client.changeRequest(systemType, itemId, `P${position}`); } /** * Sets the angle. - * @param {string} itemId the item id - * @param {number} angle the new angle - * @throws {Error} + * @param itemId - The item id. + * @param angle - The new angle. + * @throws {@link ClientError} */ public async setAngle(itemId: string, angle: number): Promise { - await this.client.changeRequest(res, itemId, `S${angle}`); + await this.client.changeRequest(systemType, itemId, `S${angle}`); } } diff --git a/src/systems/blinds/types.ts b/src/systems/blinds/types.ts index 9e44163..f1f3ab2 100644 --- a/src/systems/blinds/types.ts +++ b/src/systems/blinds/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Blind = BaseSystemType & { /** The current state */ currentState: BlindState | null; @@ -8,10 +9,13 @@ export type Blind = BaseSystemType & { /** The current rotation level 0-100 as % */ rotationLevel: number | null; /** The current rotation range */ - rotationRange: RotationRange | null; + rotationRange: BlindRotationRange | null; }; -/** The blind states */ +/** + * The blind states. + * @group Systems + */ export enum BlindState { 'holdDown' = -2, 'movingDown' = -1, @@ -20,8 +24,11 @@ export enum BlindState { 'holdUp' = 2, } -/** The blind rotations ranges */ -export enum RotationRange { +/** + * The blind rotations ranges. + * @group Systems + */ +export enum BlindRotationRange { 'ninety' = 90, 'hundredEighty' = 180, } diff --git a/src/systems/cameras/index.ts b/src/systems/cameras/index.ts index ce3a300..cce739f 100644 --- a/src/systems/cameras/index.ts +++ b/src/systems/cameras/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { Camera } from './types'; -const res = SystemType.cameras; +const systemType = SystemType.cameras; +/** + * @group Systems + */ export class Cameras extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Camera} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Camera { const values = valuesToStringList(status); @@ -32,36 +34,33 @@ export class Cameras extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -69,17 +68,16 @@ export class Cameras extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } } diff --git a/src/systems/cameras/types.ts b/src/systems/cameras/types.ts index fc40a74..0cd11cb 100644 --- a/src/systems/cameras/types.ts +++ b/src/systems/cameras/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Camera = BaseSystemType & { /** The current new records count */ newRecordCount: number | null; diff --git a/src/systems/clocks/index.ts b/src/systems/clocks/index.ts index b902e36..8694789 100644 --- a/src/systems/clocks/index.ts +++ b/src/systems/clocks/index.ts @@ -1,20 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { Clock, ClockState } from './types'; -const res = SystemType.clocks; +const systemType = SystemType.clocks; +/** + * @group Systems + */ export class Clocks extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Clock} a item - * @throws {Error} + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Clock { const values = valuesToStringList(status); @@ -31,47 +32,43 @@ export class Clocks extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -79,15 +76,15 @@ export class Clocks extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the state. - * @param {string} itemId the item id - * @param {ClockState} state the new state + * @param itemId - The item id. + * @param state - The new state. */ public async setState(itemId: string, state: ClockState): Promise { - await this.client.changeRequest(res, itemId, `${state}`); + await this.client.changeRequest(systemType, itemId, `${state}`); } } diff --git a/src/systems/clocks/types.ts b/src/systems/clocks/types.ts index 1fd5de1..56c8935 100644 --- a/src/systems/clocks/types.ts +++ b/src/systems/clocks/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Clock = BaseSystemType & { /** The current state */ currentState: ClockState | null; @@ -7,14 +8,20 @@ export type Clock = BaseSystemType & { startCondition: ClockStartConditionState | null; }; -/** The clock states */ +/** + * The clock states. + * @group Systems + */ export enum ClockState { 'off' = 0, 'on' = 1, 'onCoincidence' = 2, } -/** The clock start conditions states */ +/** + * The clock start conditions states. + * @group Systems + */ export enum ClockStartConditionState { 'off' = 0, 'on' = 1, diff --git a/src/systems/controlCircuits/index.ts b/src/systems/controlCircuits/index.ts index b27f5c0..13c0d80 100644 --- a/src/systems/controlCircuits/index.ts +++ b/src/systems/controlCircuits/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { ControlCircuit } from './types'; -const res = SystemType.controlCircuits; +const systemType = SystemType.controlCircuits; +/** + * @group Systems + */ export class ControlCircuits extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {ControlCircuit} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem( config: SystemConfig, @@ -37,36 +39,33 @@ export class ControlCircuits extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -74,17 +73,16 @@ export class ControlCircuits extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } } diff --git a/src/systems/controlCircuits/types.ts b/src/systems/controlCircuits/types.ts index 1149c53..bb0ac70 100644 --- a/src/systems/controlCircuits/types.ts +++ b/src/systems/controlCircuits/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type ControlCircuit = BaseSystemType & { /** The current sensor value -10000,10000 */ sensor: number | null; @@ -13,7 +14,10 @@ export type ControlCircuit = BaseSystemType & { pump3WorkingPowerLevel: number | null; }; -/** The control circuits sensor types */ +/** + * The control circuits sensor types. + * @group Systems + */ export enum ControlCircuitSensorType { 'temperaturePT' = 0, 'temperatureAnalog' = 1, diff --git a/src/systems/energyCosts/index.ts b/src/systems/energyCosts/index.ts index b51d746..e0d2ed2 100644 --- a/src/systems/energyCosts/index.ts +++ b/src/systems/energyCosts/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { EnergyCost } from './types'; -const res = SystemType.energyCosts; +const systemType = SystemType.energyCosts; +/** + * @group Systems + */ export class EnergyCosts extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {EnergyCost} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): EnergyCost { const values = valuesToStringList(status); @@ -47,47 +49,43 @@ export class EnergyCosts extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -95,6 +93,6 @@ export class EnergyCosts extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } } diff --git a/src/systems/energyCosts/types.ts b/src/systems/energyCosts/types.ts index 53b1779..1a8b46c 100644 --- a/src/systems/energyCosts/types.ts +++ b/src/systems/energyCosts/types.ts @@ -1,48 +1,52 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type EnergyCost = BaseSystemType & { - /** The current power 0-... as powerUnit */ + /** The current power 0-... As powerUnit */ currentPower: number | null; - /** The total energy today 0-... as energyUnit */ + /** The total energy today 0-... As energyUnit */ totalEnergyToday: number | null; - /** The total energy this month 0-... as energyUnit */ + /** The total energy this month 0-... As energyUnit */ totalEnergyMonth: number | null; - /** The total energy 0-... as energyUnit */ + /** The total energy 0-... As energyUnit */ totalEnergy: number | null; - /** The nominal power 0-... as powerUnit */ + /** The nominal power 0-... As powerUnit */ nominalPower: number | null; /** The energy unit */ energyUnit: string | null; /** The power unit */ powerUnit: string | null; - /** The total energy today from 00:00-06:00 0-... as energyUnit */ + /** The total energy today from 00:00-06:00 0-... As energyUnit */ totalEnergyToday0h6h: number | null; - /** The total energy today from 06:00-12:00 0-... as energyUnit */ + /** The total energy today from 06:00-12:00 0-... As energyUnit */ totalEnergyToday6h12h: number | null; - /** The total energy today from 12:00-18:00 0-... as energyUnit */ + /** The total energy today from 12:00-18:00 0-... As energyUnit */ totalEnergyToday12h18h: number | null; - /** The total energy today from 18:00-24:00 0-... as energyUnit */ + /** The total energy today from 18:00-24:00 0-... As energyUnit */ totalEnergyToday18h24h: number | null; - /** The total energy yesterday from 00:00-06:00 0-... as energyUnit */ + /** The total energy yesterday from 00:00-06:00 0-... As energyUnit */ totalEnergyYesterday0h6h: number | null; - /** The total energy yesterday from 06:00-12:00 0-... as energyUnit */ + /** The total energy yesterday from 06:00-12:00 0-... As energyUnit */ totalEnergyYesterday6h12h: number | null; - /** The total energy yesterday from 12:00-18:00 0-... as energyUnit */ + /** The total energy yesterday from 12:00-18:00 0-... As energyUnit */ totalEnergyYesterday12h18h: number | null; - /** The total energy yesterday from 18:00-24:00 0-... as energyUnit */ + /** The total energy yesterday from 18:00-24:00 0-... As energyUnit */ totalEnergyYesterday18h24h: number | null; - /** The total energy this year 0-... as energyUnit */ + /** The total energy this year 0-... As energyUnit */ totalEnergyThisYear: number | null; - /** The total energy in period year 0-... as energyUnit */ + /** The total energy in period year 0-... As energyUnit */ totalEnergyInPeriod: number | null; /** The start date for this period as dd.mm.yyyy hh:mm:ss */ startDateTotalEnergyInPeriod: string | null; /** The counter direction */ - counterDirection: CounterDirection | null; + counterDirection: EnergyCostsCounterDirection | null; }; -/** The energy costs counter direction */ -export enum CounterDirection { +/** + * The energy costs counter direction. + * @group Systems + */ +export enum EnergyCostsCounterDirection { 'consumption' = 0, 'production' = 1, } diff --git a/src/systems/energyManagers/index.ts b/src/systems/energyManagers/index.ts index a23748e..ae1d7ab 100644 --- a/src/systems/energyManagers/index.ts +++ b/src/systems/energyManagers/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { EnergyManager } from './types'; -const res = SystemType.energyManagers; +const systemType = SystemType.energyManagers; +/** + * @group Systems + */ export class EnergyManagers extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {EnergyManager} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem( config: SystemConfig, @@ -57,47 +59,43 @@ export class EnergyManagers extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -105,6 +103,6 @@ export class EnergyManagers extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } } diff --git a/src/systems/energyManagers/types.ts b/src/systems/energyManagers/types.ts index a124c40..461b500 100644 --- a/src/systems/energyManagers/types.ts +++ b/src/systems/energyManagers/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type EnergyManager = BaseSystemType & { /** The current net meter state */ netMeterState: NetState | null; @@ -53,43 +54,64 @@ export type EnergyManager = BaseSystemType & { maximumPowerBattery: number | null; }; -/** The net states */ +/** + * The net states. + * @group Systems + */ export enum NetState { 'notOk' = 0, 'ok' = 1, } -/** The solar panels states */ +/** + * The solar panels states. + * @group Systems + */ export enum SolarState { 'notActive' = 0, 'active' = 1, } -/** The battery states */ +/** + * The battery states. + * @group Systems + */ export enum BatteryState { 'notActive' = 0, 'active' = 1, } -/** The ems states */ +/** + * The ems states. + * @group Systems + */ export enum EMSState { 'disabled' = 0, 'enabled' = 1, } -/** The ems enabled states */ +/** + * The ems enabled states. + * @group Systems + */ export enum EMSEnabledState { 'disabled' = 0, 'enabled' = 1, } -/** The load shedding states */ +/** + * The load shedding states. + * @group Systems + */ export enum LoadSheddingState { 'off' = 0, 'on' = 1, } -/** The battery types */ +/** + * The battery types. + * @group Systems + */ export enum BatteryType { 'unavailable' = 0, 'e3dc-s10' = 1, diff --git a/src/systems/gekkoInfo/index.ts b/src/systems/gekkoInfo/index.ts index 2f51dbe..521edbb 100644 --- a/src/systems/gekkoInfo/index.ts +++ b/src/systems/gekkoInfo/index.ts @@ -1,17 +1,19 @@ import { SystemStatusResponse } from '../../client'; -import { throwErrorIfSystemIsNotEnabled } from '../../utils/errorUtils'; -import { tryParseInt } from '../../utils/numberUtils'; +import { throwErrorIfSystemIsNotEnabled } from '../../utils/errors/errorUtils'; +import { tryParseInt } from '../../utils/extensions/numberUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { GekkoInfoItem } from './types'; -const res = SystemType.network; +const systemType = SystemType.network; +/** + * @group Systems + */ export class GekkoInfo extends BaseSystem { /** - * Parses the item - * @param {string} status the response from the status request - * @returns {GekkoInfoItem} a parsed item + * Parses the item. + * @param status - The response from the status request. */ private parseItem(status: SystemStatusResponse): GekkoInfoItem { return { @@ -28,25 +30,23 @@ export class GekkoInfo extends BaseSystem { /** * Returns item. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItem(): Promise { - throwErrorIfSystemIsNotEnabled(this.client.systemConfig, res); + throwErrorIfSystemIsNotEnabled(this.client.systemConfig, systemType); - const status = await this.client.systemStatusRequest(res); + const status = await this.client.systemStatusRequest(systemType); return this.parseItem(status); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } } diff --git a/src/systems/gekkoInfo/types.ts b/src/systems/gekkoInfo/types.ts index 26d9dc8..49fe566 100644 --- a/src/systems/gekkoInfo/types.ts +++ b/src/systems/gekkoInfo/types.ts @@ -1,18 +1,22 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type GekkoInfoItem = BaseSystemType & { /** The Hostname of myGEKKO device. */ gekkoName: string | null; /** Language of myGEKKO device. */ - language: Language | null; + language: GekkoLanguage | null; /** Software version of myGEKKO device. */ version: number | null; /** Hardware version of myGEKKO device. */ hardware: string | null; }; -/** The languages. */ -export enum Language { +/** + * The languages. + * @group Systems + */ +export enum GekkoLanguage { 'german' = 0, 'italian' = 1, 'english' = 2, diff --git a/src/systems/globalAlarm/index.ts b/src/systems/globalAlarm/index.ts index c149ada..7768f9f 100644 --- a/src/systems/globalAlarm/index.ts +++ b/src/systems/globalAlarm/index.ts @@ -1,17 +1,19 @@ import { SystemStatusResponse } from '../../client'; -import { throwErrorIfSystemIsNotEnabled } from '../../utils/errorUtils'; -import { tryParseFloat } from '../../utils/numberUtils'; +import { throwErrorIfSystemIsNotEnabled } from '../../utils/errors/errorUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { GlobalAlarmItem } from './types'; -const res = SystemType.alarm; +const systemType = SystemType.alarm; +/** + * @group Systems + */ export class GlobalAlarm extends BaseSystem { /** - * Parses the item - * @param {string} status the response from the status request - * @returns {GlobalAlarmItem} a parsed item + * Parses the item. + * @param status - The response from the status request. */ private parseItem(status: SystemStatusResponse): GlobalAlarmItem { return { @@ -24,26 +26,24 @@ export class GlobalAlarm extends BaseSystem { } /** - * Returns the item. - * @returns {Promise} a item - * @throws {Error} + * Returns the item. + * @throws {@link ClientError} */ public async getItem(): Promise { - throwErrorIfSystemIsNotEnabled(this.client.systemConfig, res); + throwErrorIfSystemIsNotEnabled(this.client.systemConfig, systemType); - const status = await this.client.systemStatusRequest(res); + const status = await this.client.systemStatusRequest(systemType); return this.parseItem(status); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } } diff --git a/src/systems/globalAlarm/types.ts b/src/systems/globalAlarm/types.ts index 8258043..ee2060b 100644 --- a/src/systems/globalAlarm/types.ts +++ b/src/systems/globalAlarm/types.ts @@ -1,11 +1,15 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type GlobalAlarmItem = BaseSystemType & { /** The global alarm state of myGEKKO device */ state: GlobalAlarmState | null; }; -/** The global alarm state of myGEKKO device */ +/** + * The global alarm state of myGEKKO device. + * @group Systems + */ export enum GlobalAlarmState { 'ok' = 0, 'unacknowledged' = 1, diff --git a/src/systems/heatingCircuit/index.ts b/src/systems/heatingCircuit/index.ts index 36fe5e9..c4fd898 100644 --- a/src/systems/heatingCircuit/index.ts +++ b/src/systems/heatingCircuit/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { HeatingCircuit } from './types'; -const res = SystemType.heatingCircuits; +const systemType = SystemType.heatingCircuits; +/** + * @group Systems + */ export class HeatingCircuits extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {HeatingCircuit} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem( config: SystemConfig, @@ -41,47 +43,43 @@ export class HeatingCircuits extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -89,6 +87,6 @@ export class HeatingCircuits extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } } diff --git a/src/systems/heatingCircuit/types.ts b/src/systems/heatingCircuit/types.ts index 92394df..e93c408 100644 --- a/src/systems/heatingCircuit/types.ts +++ b/src/systems/heatingCircuit/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type HeatingCircuit = BaseSystemType & { /** The device model */ deviceModel: HeatingCircuitDeviceModel | null; @@ -21,7 +22,10 @@ export type HeatingCircuit = BaseSystemType & { currentState: HeatingCircuitState | null; }; -/** The heating circuits device models */ +/** + * The heating circuits device models. + * @group Systems + */ export enum HeatingCircuitDeviceModel { 'individual' = 0, 'buderus' = 1, @@ -29,13 +33,19 @@ export enum HeatingCircuitDeviceModel { 'vaillant' = 3, } -/** The heating circuits cooling modes */ +/** + * The heating circuits cooling modes. + * @group Systems + */ export enum HeatingCircuitCoolingMode { 'off' = 0, 'on' = 1, } -/** The heating circuits states */ +/** + * The heating circuits states. + * @group Systems + */ export enum HeatingCircuitState { 'off' = 0, 'on' = 1, diff --git a/src/systems/heatingSystem/index.ts b/src/systems/heatingSystem/index.ts index 59a13e3..42fbcc9 100644 --- a/src/systems/heatingSystem/index.ts +++ b/src/systems/heatingSystem/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { HeatingSystem } from './types'; -const res = SystemType.heatingSystems; +const systemType = SystemType.heatingSystems; +/** + * @group Systems + */ export class HeatingSystems extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {HeatingSystem} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem( config: SystemConfig, @@ -37,47 +39,43 @@ export class HeatingSystems extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -85,6 +83,6 @@ export class HeatingSystems extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } } diff --git a/src/systems/heatingSystem/types.ts b/src/systems/heatingSystem/types.ts index 38c189e..f4797c3 100644 --- a/src/systems/heatingSystem/types.ts +++ b/src/systems/heatingSystem/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type HeatingSystem = BaseSystemType & { /** The device model */ deviceModel: HeatingSystemDeviceModel | null; @@ -13,7 +14,10 @@ export type HeatingSystem = BaseSystemType & { currentState: HeatingSystemState | null; }; -/** The heating system device models */ +/** + * The heating system device models. + * @group Systems + */ export enum HeatingSystemDeviceModel { 'individual' = 0, 'buderus' = 1, @@ -22,13 +26,19 @@ export enum HeatingSystemDeviceModel { 'vaillant' = 4, } -/** The heating system cooling states */ +/** + * The heating system cooling states. + * @group Systems + */ export enum HeatingSystemCoolingState { 'off' = 0, 'on' = 1, } -/** The heating system states */ +/** + * The heating system states. + * @group Systems + */ export enum HeatingSystemState { 'off' = 0, 'on' = 1, diff --git a/src/systems/hotWaterCirculation/index.ts b/src/systems/hotWaterCirculation/index.ts index 1790293..de888de 100644 --- a/src/systems/hotWaterCirculation/index.ts +++ b/src/systems/hotWaterCirculation/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { HotWaterCirculation, HotWaterCirculationState } from './types'; -const res = SystemType.hotWaterCirculations; +const systemType = SystemType.hotWaterCirculations; +/** + * @group Systems + */ export class HotWaterCirculations extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {HotWaterCirculation} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem( config: SystemConfig, @@ -36,51 +38,52 @@ export class HotWaterCirculations extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } + /** + * Sets the state. + * @param itemId - The item id. + * @param state - The new state. + */ public async setState(itemId: string, state: HotWaterCirculationState): Promise { - await this.client.changeRequest(res, itemId, `${state}`); + await this.client.changeRequest(systemType, itemId, `${state}`); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -88,6 +91,6 @@ export class HotWaterCirculations extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } } diff --git a/src/systems/hotWaterCirculation/types.ts b/src/systems/hotWaterCirculation/types.ts index 0e4e8a4..0648458 100644 --- a/src/systems/hotWaterCirculation/types.ts +++ b/src/systems/hotWaterCirculation/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type HotWaterCirculation = BaseSystemType & { /** The pump type */ pumpType: HotWaterCirculationPumpType | null; @@ -11,14 +12,20 @@ export type HotWaterCirculation = BaseSystemType & { returnWaterTemperatureSetPoint: number | null; }; -/** The how water circulation pump types */ +/** + * The how water circulation pump types. + * @group Systems + */ export enum HotWaterCirculationPumpType { 'onOff' = 0, 'pwm' = 1, 'percentage', } -/** The how water circulation states */ +/** + * The how water circulation states. + * @group Systems + */ export enum HotWaterCirculationState { 'off' = 0, 'on' = 1, diff --git a/src/systems/hotWaterSystems/index.ts b/src/systems/hotWaterSystems/index.ts index d6e98ec..d240848 100644 --- a/src/systems/hotWaterSystems/index.ts +++ b/src/systems/hotWaterSystems/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { HotWaterSystem, HotWaterSystemState } from './types'; -const res = SystemType.hotWaterSystems; +const systemType = SystemType.hotWaterSystems; +/** + * @group Systems + */ export class HotWaterSystems extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {HotWaterSystem} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem( config: SystemConfig, @@ -39,35 +41,32 @@ export class HotWaterSystems extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -75,24 +74,24 @@ export class HotWaterSystems extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the state. - * @param {string} itemId the item id - * @param {HotWaterSystemState} state the new state + * @param itemId - The item id. + * @param state - The new state. */ public async setState(itemId: string, state: HotWaterSystemState): Promise { - await this.client.changeRequest(res, itemId, `${state}`); + await this.client.changeRequest(systemType, itemId, `${state}`); } /** * Sets the temperature. - * @param {string} itemId the item id - * @param {number} temperatur the new state + * @param itemId - The item id. + * @param temperatur - The new temperature. */ public async setTemperature(itemId: string, temperatur: number): Promise { - await this.client.changeRequest(res, itemId, `T${temperatur}`); + await this.client.changeRequest(systemType, itemId, `T${temperatur}`); } } diff --git a/src/systems/hotWaterSystems/types.ts b/src/systems/hotWaterSystems/types.ts index 332f309..822284c 100644 --- a/src/systems/hotWaterSystems/types.ts +++ b/src/systems/hotWaterSystems/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type HotWaterSystem = BaseSystemType & { /** The device model */ deviceModel: HotWaterSystemDeviceModel | null; @@ -17,13 +18,19 @@ export type HotWaterSystem = BaseSystemType & { currentState: HotWaterSystemState | null; }; -/** The hot water system states */ +/** + * The hot water system states. + * @group Systems + */ export enum HotWaterSystemState { 'off' = 0, 'on' = 1, } -/** The hot water system device models */ +/** + * The hot water system device models. + * @group Systems + */ export enum HotWaterSystemDeviceModel { 'individual' = 0, 'buderus' = 1, @@ -32,7 +39,10 @@ export enum HotWaterSystemDeviceModel { 'vaillant' = 4, } -/** The hot water system cooling mode states */ +/** + * The hot water system cooling mode states. + * @group Systems + */ export enum HotWaterSystemCoolingModeState { 'off' = 0, 'on' = 1, diff --git a/src/systems/index.ts b/src/systems/index.ts new file mode 100644 index 0000000..87b48c8 --- /dev/null +++ b/src/systems/index.ts @@ -0,0 +1,29 @@ +export { Accesses } from './accesses'; +export { Actions } from './actions'; +export { AirConditioners } from './airConditioners'; +export { AlarmSystems } from './alarmSystems'; +export { Analyses } from './analyses'; +export { Blinds } from './blinds'; +export { Cameras } from './cameras'; +export { Clocks } from './clocks'; +export { ControlCircuits } from './controlCircuits'; +export { EnergyCosts } from './energyCosts'; +export { EnergyManagers } from './energyManagers'; +export { GekkoInfo } from './gekkoInfo'; +export { GlobalAlarm } from './globalAlarm'; +export { HeatingCircuits } from './heatingCircuit'; +export { HeatingSystems } from './heatingSystem'; +export { HotWaterCirculations } from './hotWaterCirculation'; +export { HotWaterSystems } from './hotWaterSystems'; +export { Lights } from './lights'; +export { Loads } from './loads'; +export { Logics } from './logics'; +export { MultiRooms } from './multiRoom'; +export { Pools } from './pools'; +export { RoomTemperatures } from './roomTemperatures'; +export { Saunas } from './saunas'; +export { SmsEmails } from './smsEmail'; +export { Stoves } from './stoves'; +export { Vents } from './vents'; +export { WallBoxes } from './wallBoxes'; +export { Weather } from './weather'; diff --git a/src/systems/lights/index.ts b/src/systems/lights/index.ts index 4a98df5..9d78a95 100644 --- a/src/systems/lights/index.ts +++ b/src/systems/lights/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { Light, LightState } from './types'; -const res = SystemType.lights; +const systemType = SystemType.lights; +/** + * @group Systems + */ export class Lights extends BaseSystem { /** * Parses the item. - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Light} a parsed item + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Light { const values = valuesToStringList(status); @@ -32,47 +34,43 @@ export class Lights extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -80,42 +78,42 @@ export class Lights extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the state. - * @param {string} itemId the item id - * @param {LightState} state the new state + * @param itemId - The item id. + * @param state - The new state. */ public async setState(itemId: string, state: LightState): Promise { - await this.client.changeRequest(res, itemId, `${state}`); + await this.client.changeRequest(systemType, itemId, `${state}`); } /** * Sets the dim level. - * @param {string} itemId the item id - * @param {number} dimLevel the new dim level + * @param itemId - The item id. + * @param dimLevel - The new dim level. */ public async setDimLevel(itemId: string, dimLevel: number): Promise { - await this.client.changeRequest(res, itemId, `D${dimLevel}`); + await this.client.changeRequest(systemType, itemId, `D${dimLevel}`); } /** * Sets the tunable white level. - * @param {string} itemId the item id - * @param {number} tunableWhiteLevel the new tunable white level + * @param itemId - The item id. + * @param tunableWhiteLevel - The new tunable white level. */ public async setTunableWhiteLevel(itemId: string, tunableWhiteLevel: number): Promise { - await this.client.changeRequest(res, itemId, `TW${tunableWhiteLevel}`); + await this.client.changeRequest(systemType, itemId, `TW${tunableWhiteLevel}`); } /** * Sets the color. - * @param {string} itemId the item id - * @param {number} color the new color + * @param itemId - The item id. + * @param color - The new color. */ public async setColor(itemId: string, color: number): Promise { - await this.client.changeRequest(res, itemId, `C${color}`); + await this.client.changeRequest(systemType, itemId, `C${color}`); } } diff --git a/src/systems/lights/types.ts b/src/systems/lights/types.ts index 696b929..496c25c 100644 --- a/src/systems/lights/types.ts +++ b/src/systems/lights/types.ts @@ -1,17 +1,21 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Light = BaseSystemType & { /** The current state */ currentState: LightState | null; /** The current dim level as 0-100 % */ dimLevel: number | null; - /** The current rgb color as decimal as [24bit->R:23-16|G:15-8|B:7-0] */ + /** The current rgb color as decimal as 24 bit rgb */ rgbColor: number | null; /** The current tunable white level as 0-100 % */ tunableWhiteLevel: number | null; }; -/** The light states */ +/** + * The light states. + * @group Systems + */ export enum LightState { 'off' = 0, 'on' = 1, diff --git a/src/systems/loads/index.ts b/src/systems/loads/index.ts index 60de6ce..c495e01 100644 --- a/src/systems/loads/index.ts +++ b/src/systems/loads/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { Load, LoadState } from './types'; -const res = SystemType.loads; +const systemType = SystemType.loads; +/** + * @group Systems + */ export class Loads extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Load} parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Load { const values = valuesToStringList(status); @@ -29,47 +31,43 @@ export class Loads extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -77,15 +75,15 @@ export class Loads extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the state. - * @param {string} itemId the item id - * @param {LoadState} state the new state + * @param itemId - The item id. + * @param state - The new state. */ public async setState(itemId: string, state: LoadState): Promise { - await this.client.changeRequest(res, itemId, `${state}`); + await this.client.changeRequest(systemType, itemId, `${state}`); } } diff --git a/src/systems/loads/types.ts b/src/systems/loads/types.ts index 3b50133..16e8c89 100644 --- a/src/systems/loads/types.ts +++ b/src/systems/loads/types.ts @@ -1,11 +1,15 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Load = BaseSystemType & { /** The current state */ currentState: LoadState | null; }; -/** The load states */ +/** + * The load states. + * @group Systems + */ export enum LoadState { 'off' = 0, 'onImpulse' = 1, diff --git a/src/systems/logics/index.ts b/src/systems/logics/index.ts index b18d353..06b0e87 100644 --- a/src/systems/logics/index.ts +++ b/src/systems/logics/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { Logic } from './types'; -const res = SystemType.alarmsLogics; +const systemType = SystemType.alarmsLogics; +/** + * @group Systems + */ export class Logics extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Logic} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Logic { const values = valuesToStringList(status); @@ -29,47 +31,43 @@ export class Logics extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -77,6 +75,6 @@ export class Logics extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } } diff --git a/src/systems/logics/types.ts b/src/systems/logics/types.ts index 0f246e9..fd06c20 100644 --- a/src/systems/logics/types.ts +++ b/src/systems/logics/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Logic = BaseSystemType & { /** The current value */ value: number | null; diff --git a/src/systems/multiRoom/index.ts b/src/systems/multiRoom/index.ts index 8fa05e7..3daaa60 100644 --- a/src/systems/multiRoom/index.ts +++ b/src/systems/multiRoom/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; -import { MultiRoom, MultiRoomState, PlayList } from './types'; +import { MultiRoom, MultiRoomPlayList, MultiRoomState } from './types'; -const res = SystemType.multiRooms; +const systemType = SystemType.multiRooms; +/** + * @group Systems + */ export class MultiRooms extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {MultiRoom} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): MultiRoom { const values = valuesToStringList(status); @@ -33,8 +35,8 @@ export class MultiRooms extends BaseSystem { }; } - private parsePlayList(values: string[]): PlayList[] { - const items: PlayList[] = []; + private parsePlayList(values: string[]): MultiRoomPlayList[] { + const items: MultiRoomPlayList[] = []; for (let i = 5; i < 21; i++) { items.push({ index: i - 5, @@ -46,47 +48,43 @@ export class MultiRooms extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -94,13 +92,13 @@ export class MultiRooms extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the state. - * @param {string} itemId the item id - * @param {MultiRoomState} state the new state + * @param itemId - The item id. + * @param state - The new state. */ public async setState(itemId: string, state: MultiRoomState): Promise { let value = 'STOP'; @@ -112,40 +110,40 @@ export class MultiRooms extends BaseSystem { value = 'PLAY'; break; } - await this.client.changeRequest(res, itemId, `${value}`); + await this.client.changeRequest(systemType, itemId, `${value}`); } /** * Sets the volume. - * @param {string} itemId the item id - * @param {number} volume the new volume + * @param itemId - The item id. + * @param volume - The new volume. */ public async setVolume(itemId: string, volume: number): Promise { - await this.client.changeRequest(res, itemId, `V${volume}`); + await this.client.changeRequest(systemType, itemId, `V${volume}`); } /** * Sets the previous song. - * @param {string} itemId the item id + * @param itemId - The item id. */ public async setPreviousSong(itemId: string): Promise { - await this.client.changeRequest(res, itemId, `N-1`); + await this.client.changeRequest(systemType, itemId, `N-1`); } /** * Sets the next song. - * @param {string} itemId the item id + * @param itemId - The item id. */ public async setNextSong(itemId: string): Promise { - await this.client.changeRequest(res, itemId, `N+1`); + await this.client.changeRequest(systemType, itemId, `N+1`); } /** * Sets the play list. - * @param {string} itemId the item id - * @param {number} playListIndex the new play list index + * @param itemId - The item id. + * @param playListIndex - The new play list index. */ public async setPlayList(itemId: string, playListIndex: number): Promise { - await this.client.changeRequest(res, itemId, `C${playListIndex}`); + await this.client.changeRequest(systemType, itemId, `C${playListIndex}`); } } diff --git a/src/systems/multiRoom/types.ts b/src/systems/multiRoom/types.ts index 8dc573e..3cd0a1b 100644 --- a/src/systems/multiRoom/types.ts +++ b/src/systems/multiRoom/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type MultiRoom = BaseSystemType & { /** The current state */ currentState: MultiRoomState | null; @@ -11,20 +12,24 @@ export type MultiRoom = BaseSystemType & { currentAudioTitle: string | null; /** The current play list indes */ currentPlaylistIndex: number | null; - /** The current play list as {@link PlayList[]} */ - playList: PlayList[] | null; + /** The current play list */ + playList: MultiRoomPlayList[] | null; /** The current song index */ currentSongIndex: number | null; }; -/** The multiroom states */ +/** + * The multiroom states. + * @group Systems + */ export enum MultiRoomState { 'off' = 0, 'on' = 1, } /** The play list item */ -export type PlayList = { +/** @group Systems */ +export type MultiRoomPlayList = { /** The play list index */ index: number | null; /** The play list name */ diff --git a/src/systems/pools/index.ts b/src/systems/pools/index.ts index add7896..264e16a 100644 --- a/src/systems/pools/index.ts +++ b/src/systems/pools/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { Pool } from './types'; -const res = SystemType.pools; +const systemType = SystemType.pools; +/** + * @group Systems + */ export class Pools extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Pool} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Pool { const values = valuesToStringList(status); @@ -32,47 +34,43 @@ export class Pools extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -80,17 +78,17 @@ export class Pools extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /// TODO: implement all other function /** * Sets the temperature. - * @param {string} itemId the item id - * @param {number} temperature the new temperature + * @param itemId - The item id. + * @param temperature - The new temperature. */ public async setTemperatur(itemId: string, temperature: number): Promise { - await this.client.changeRequest(res, itemId, `T${temperature}`); + await this.client.changeRequest(systemType, itemId, `T${temperature}`); } } diff --git a/src/systems/pools/types.ts b/src/systems/pools/types.ts index 1106083..af2d551 100644 --- a/src/systems/pools/types.ts +++ b/src/systems/pools/types.ts @@ -1,31 +1,41 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Pool = BaseSystemType & { /** The current working mode */ workingMode: PoolWorkingMode | null; /** The current filter state */ - filteringState: FilteringState | null; + filteringState: PoolFilteringState | null; /** The current backwash state */ - backwashState: BackWashState | null; + backwashState: PoolBackWashState | null; /** The current water temperature as 0-100 C° */ waterTemperature: number | null; }; -/** The pool working modes */ +/** + * The pool working modes. + * @group Systems + */ export enum PoolWorkingMode { 'off' = 0, 'restMode' = 1, 'bathing' = 2, } -/** The pool filtering states */ -export enum FilteringState { +/** + * The pool filtering states. + * @group Systems + */ +export enum PoolFilteringState { 'off' = 0, 'on' = 1, } -/** The pool backwash states */ -export enum BackWashState { +/** + * The pool backwash states. + * @group Systems + */ +export enum PoolBackWashState { 'off' = 0, 'on' = 1, } diff --git a/src/systems/roomTemperatures/index.ts b/src/systems/roomTemperatures/index.ts index 9f5b5e7..35d83bc 100644 --- a/src/systems/roomTemperatures/index.ts +++ b/src/systems/roomTemperatures/index.ts @@ -1,6 +1,6 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { @@ -9,15 +9,17 @@ import { RoomTemperatureWorkingModeStandard, } from './types'; -const res = SystemType.roomTemperatures; +const systemType = SystemType.roomTemperatures; +/** + * @group Systems + */ export class RoomTemperatures extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {RoomTemperature} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem( config: SystemConfig, @@ -47,47 +49,43 @@ export class RoomTemperatures extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -95,36 +93,36 @@ export class RoomTemperatures extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the temperature set point. - * @param {string} itemId the item id - * @param {number} temperature the new temperature + * @param itemId - The item id. + * @param temperature - The new temperature. */ public async setTemperaturSetPoint(itemId: string, temperature: number): Promise { - await this.client.changeRequest(res, itemId, `S${temperature}`); + await this.client.changeRequest(systemType, itemId, `S${temperature}`); } /** * Sets the temperature adjust. - * @param {string} itemId the item id - * @param {number} temperature the new temperature adjust + * @param itemId - The item id. + * @param temperature - The new temperature adjust. */ public async setTemperatureAdjust(itemId: string, temperature: number): Promise { - await this.client.changeRequest(res, itemId, `K${temperature}`); + await this.client.changeRequest(systemType, itemId, `K${temperature}`); } /** * Sets the working mode. - * @param {string} itemId the item id - * @param {RoomTemperatureWorkingModeStandard | RoomTemperatureWorkingModeKnx} mode the new working mode + * @param itemId - The item id. + * @param mode - The new working mode. */ public async setWorkingMode( itemId: string, mode: RoomTemperatureWorkingModeStandard | RoomTemperatureWorkingModeKnx ): Promise { - await this.client.changeRequest(res, itemId, `M${mode}`); + await this.client.changeRequest(systemType, itemId, `M${mode}`); } } diff --git a/src/systems/roomTemperatures/types.ts b/src/systems/roomTemperatures/types.ts index 8ee985d..0b8606f 100644 --- a/src/systems/roomTemperatures/types.ts +++ b/src/systems/roomTemperatures/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type RoomTemperature = BaseSystemType & { /** The current temperature as -100-100 C° */ temperature: number | null; @@ -9,7 +10,7 @@ export type RoomTemperature = BaseSystemType & { valveOpeningLevel: number | null; /** The current working mode */ workingMode: RoomTemperatureWorkingModeStandard | RoomTemperatureWorkingModeKnx | null; - /** reserved */ + /** Reserved */ reserved: string | null; /** The current temperature adjust as -100-100 C° */ temperatureAdjustment: number | null; @@ -25,7 +26,10 @@ export type RoomTemperature = BaseSystemType & { deviceModel: RoomTemperatureDeviceModel | null; }; -/** The room temperature standard device working modes */ +/** + * The room temperature standard device working modes. + * @group Systems + */ export enum RoomTemperatureWorkingModeStandard { 'off' = 0, 'comfort' = 8, @@ -34,7 +38,10 @@ export enum RoomTemperatureWorkingModeStandard { 'standby' = 256, } -/** The room temperature knx device working modes */ +/** + * The room temperature knx device working modes. + * @group Systems + */ export enum RoomTemperatureWorkingModeKnx { 'auto' = 0, 'comfort' = 1, @@ -43,13 +50,19 @@ export enum RoomTemperatureWorkingModeKnx { 'buildingProtection' = 4, } -/** The room temperature cooling state */ +/** + * The room temperature cooling state. + * @group Systems + */ export enum RoomTemperatureCoolingState { 'off' = 0, 'on' = 1, } -/** The room temperature device model */ +/** + * The room temperature device model. + * @group Systems + */ export enum RoomTemperatureDeviceModel { 'standard' = 0, 'knx' = 1, diff --git a/src/systems/saunas/index.ts b/src/systems/saunas/index.ts index 39f7cb6..fe46d1e 100644 --- a/src/systems/saunas/index.ts +++ b/src/systems/saunas/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { Sauna, SaunaWorkingMode } from './types'; -const res = SystemType.saunas; +const systemType = SystemType.saunas; +/** + * @group Systems + */ export class Saunas extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Sauna} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Sauna { const values = valuesToStringList(status); @@ -36,47 +38,43 @@ export class Saunas extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -84,15 +82,15 @@ export class Saunas extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the mode. - * @param {string} itemId the item id - * @param {SaunaWorkingMode} mode the new mode + * @param itemId - The item id. + * @param mode - The new mode. */ public async setMode(itemId: string, mode: SaunaWorkingMode): Promise { - await this.client.changeRequest(res, itemId, `${mode}`); + await this.client.changeRequest(systemType, itemId, `${mode}`); } } diff --git a/src/systems/saunas/types.ts b/src/systems/saunas/types.ts index c94f811..6e73a9c 100644 --- a/src/systems/saunas/types.ts +++ b/src/systems/saunas/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Sauna = BaseSystemType & { /** The current working mode */ workingMode: SaunaWorkingMode | null; @@ -19,20 +20,29 @@ export type Sauna = BaseSystemType & { roomRelativeHumiditySetPointLevel: number | null; }; -/** The sauna working modes */ +/** + * The sauna working modes. + * @group Systems + */ export enum SaunaWorkingMode { 'off' = 0, 'onOrFinished' = 1, 'bio' = 2, } -/** The sauna states */ +/** + * The sauna states. + * @group Systems + */ export enum SaunaState { 'off' = 0, 'on' = 1, } -/** The sauna error states */ +/** + * The sauna error states. + * @group Systems + */ export enum SaunaErrorState { 'noError' = 0, 'error' = 1, diff --git a/src/systems/smsEmail/index.ts b/src/systems/smsEmail/index.ts index 95e06fb..1297099 100644 --- a/src/systems/smsEmail/index.ts +++ b/src/systems/smsEmail/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { SmsEmail, SmsEmailState } from './types'; -const res = SystemType.smsEmail; +const systemType = SystemType.smsEmail; +/** + * @group Systems + */ export class SmsEmails extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {SmsEmail} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): SmsEmail { const values = valuesToStringList(status); @@ -29,47 +31,43 @@ export class SmsEmails extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -77,13 +75,13 @@ export class SmsEmails extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the state. - * @param {string} itemId the item id - * @param {SmsEmailState} state the new state + * @param itemId - The item id. + * @param state - The new state. */ public async setState(itemId: string, state: SmsEmailState): Promise { let value = -1; @@ -95,6 +93,6 @@ export class SmsEmails extends BaseSystem { value = 1; break; } - await this.client.changeRequest(res, itemId, `${value}`); + await this.client.changeRequest(systemType, itemId, `${value}`); } } diff --git a/src/systems/smsEmail/types.ts b/src/systems/smsEmail/types.ts index b088adf..1361177 100644 --- a/src/systems/smsEmail/types.ts +++ b/src/systems/smsEmail/types.ts @@ -1,11 +1,15 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type SmsEmail = BaseSystemType & { /** The current state */ currentState: SmsEmailState | null; }; -/** The sms email states */ +/** + * The sms email states. + * @group Systems + */ export enum SmsEmailState { 'off' = 0, 'on' = 1, diff --git a/src/systems/stoves/index.ts b/src/systems/stoves/index.ts new file mode 100644 index 0000000..39cb8da --- /dev/null +++ b/src/systems/stoves/index.ts @@ -0,0 +1,83 @@ +import { ItemStatusResponse, SystemConfig } from '../../client'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; +import { BaseSystem } from '../base'; +import { SystemType, Trend } from '../base/types'; +import { Stove } from './types'; + +const systemType = SystemType.stoves; + +/** + * @group Systems + */ +export class Stoves extends BaseSystem { + /** + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. + */ + private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Stove { + const values = valuesToStringList(status); + + return { + sumState: tryParseFloat(values[4]), + itemId: itemId, + name: config[itemId].name, + page: config[itemId].page, + temperature: tryParseFloat(values[0]), + flapOpeningLevel: tryParseFloat(values[1]), + currentState: tryParseFloat(values[2]), + workingState: tryParseFloat(values[3]), + }; + } + + /** + * Returns all items. + * @throws {@link ClientError} + */ + public async getItems(): Promise { + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); + }); + } + + /** + * Returns a single item by id. + * @param itemId - The item id. + * @throws {@link ClientError} + */ + public async getItemById(itemId: string): Promise { + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); + } + + /** + * Returns all trends. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} + */ + public async getTrends(startDate: string, endDate: string, count: number): Promise { + return await this.getTrendsStatuses(systemType, startDate, endDate, count); + } + + /** + * Returns a single trend by item id. + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} + */ + public async getTrendByItemId( + itemId: string, + startDate: string, + endDate: string, + count: number + ): Promise { + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); + } +} diff --git a/src/systems/stoves/stoves.ts b/src/systems/stoves/stoves.ts deleted file mode 100644 index fb96f15..0000000 --- a/src/systems/stoves/stoves.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; -import { BaseSystem } from '../base'; -import { SystemType, Trend } from '../base/types'; -import { Stove } from './types'; - -const res = SystemType.stoves; - -export class Stoves extends BaseSystem { - /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Stove} a parsed item - */ - private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Stove { - const values = valuesToStringList(status); - - return { - sumState: tryParseFloat(values[4]), - itemId: itemId, - name: config[itemId].name, - page: config[itemId].page, - temperature: tryParseFloat(values[0]), - flapOpeningLevel: tryParseFloat(values[1]), - currentState: tryParseFloat(values[2]), - workingState: tryParseFloat(values[3]), - }; - } - - /** - * Returns all items. - * @returns {Promise} a item - * @throws {Error} - */ - public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); - }); - } - - /** - * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} - */ - public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); - } - - /** - * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} - */ - public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); - } - - /** - * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} - */ - public async getTrendByItemId( - itemId: string, - startDate: string, - endDate: string, - count: number - ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); - } -} diff --git a/src/systems/stoves/types.ts b/src/systems/stoves/types.ts index b31861f..47b0af9 100644 --- a/src/systems/stoves/types.ts +++ b/src/systems/stoves/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Stove = BaseSystemType & { /** The current temperature as 20-1000 C° */ temperature: number | null; @@ -11,7 +12,10 @@ export type Stove = BaseSystemType & { workingState: StoveWorkingState | null; }; -/** The stove states */ +/** + * The stove states. + * @group Systems + */ export enum StovesState { 'stoveIdle' = 0, 'closeDoor' = 5, @@ -21,7 +25,10 @@ export enum StovesState { 'stoveCooledOff' = 13, } -/** The stove working states */ +/** + * The stove working states. + * @group Systems + */ export enum StoveWorkingState { 'idle' = 0, 'active' = 1, diff --git a/src/systems/types.ts b/src/systems/types.ts index cafc7d1..c30aa5c 100644 --- a/src/systems/types.ts +++ b/src/systems/types.ts @@ -1,30 +1,98 @@ -export * from './accesses/types'; -export * from './actions/types'; -export * from './airConditioners/types'; -export * from './alarmSystems/types'; -export * from './base/types'; -export * from './blinds/types'; -export * from './cameras/types'; -export * from './clocks/types'; -export * from './controlCircuits/types'; -export * from './energyCosts/types'; -export * from './energyManagers/types'; -export * from './gekkoInfo/types'; -export * from './globalAlarm/types'; -export * from './heatingCircuit/types'; -export * from './heatingSystem/types'; -export * from './hotWaterCirculation/types'; -export * from './hotWaterSystems/types'; -export * from './lights/types'; -export * from './loads/types'; -export * from './logics/types'; -export * from './multiRoom/types'; -export * from './pools/types'; -export * from './roomTemperatures/types'; -export * from './saunas/types'; -export * from './smsEmail/types'; -export * from './stoves/types'; -export * from './analyses/types'; -export * from './vents/types'; -export * from './wallBoxes/types'; -export * from './weather/types'; +export { Access, AccessState, AccessStartConditionState, AccessType } from './accesses/types'; +export { Action, ActionState, ActionStartConditionState } from './actions/types'; +export { SystemType, Trend, BaseSystemType, SumState, TrendItem } from './base/types'; +export { + AirConditioner, + AirConditionerWorkingMode, + AirConditionerState, + AirConditionerSupplyState, + AirConditionerExhaustState, +} from './airConditioners/types'; +export { + AlarmSystem, + AlarmSystemState, + AlarmDevice, + AlarmSystemDeviceState, + AlarmSystemDeviceModel, + AlarmSystemDeviceSharpState, +} from './alarmSystems/types'; +export { Blind, BlindState, BlindRotationRange } from './blinds/types'; +export { Camera } from './cameras/types'; +export { Clock, ClockState, ClockStartConditionState } from './clocks/types'; +export { ControlCircuit, ControlCircuitSensorType } from './controlCircuits/types'; +export { EnergyCost, EnergyCostsCounterDirection } from './energyCosts/types'; +export { + EnergyManager, + EMSState, + EMSEnabledState, + SolarState, + BatteryState, + BatteryType, + LoadSheddingState, + NetState, +} from './energyManagers/types'; +export { GekkoInfoItem, GekkoLanguage } from './gekkoInfo/types'; +export { GlobalAlarmItem, GlobalAlarmState } from './globalAlarm/types'; +export { + HeatingCircuit, + HeatingCircuitState, + HeatingCircuitCoolingMode, + HeatingCircuitDeviceModel, +} from './heatingCircuit/types'; +export { + HeatingSystem, + HeatingSystemState, + HeatingSystemCoolingState, + HeatingSystemDeviceModel, +} from './heatingSystem/types'; +export { + HotWaterCirculation, + HotWaterCirculationState, + HotWaterCirculationPumpType, +} from './hotWaterCirculation/types'; +export { + HotWaterSystem, + HotWaterSystemState, + HotWaterSystemCoolingModeState, + HotWaterSystemDeviceModel, +} from './hotWaterSystems/types'; +export { Light, LightState } from './lights/types'; +export { Load, LoadState } from './loads/types'; +export { Logic } from './logics/types'; +export { MultiRoom, MultiRoomState, MultiRoomPlayList } from './multiRoom/types'; +export { Pool, PoolWorkingMode, PoolFilteringState, PoolBackWashState } from './pools/types'; +export { + RoomTemperature, + RoomTemperatureWorkingModeKnx, + RoomTemperatureWorkingModeStandard, + RoomTemperatureCoolingState, + RoomTemperatureDeviceModel, +} from './roomTemperatures/types'; +export { Sauna, SaunaState, SaunaErrorState, SaunaWorkingMode } from './saunas/types'; +export { SmsEmailState, SmsEmail } from './smsEmail/types'; +export { Stove, StovesState, StoveWorkingState } from './stoves/types'; +export { Analysis, AnalysisType, AnalysisState, AnalysisVariable } from './analyses/types'; +export { + Vent, + VentLevel, + VentWorkingModeProxxonV1, + VentWorkingModePluggit, + VentWorkingModeWestaflex, + VentBypassState, + VentWorkingModeStiebelTecalor, + VentWorkingModeIndividual, + VentWorkingModeProxxonV2, + VentDeviceModel, + VentCoolingModeState, + VentDehumidificationState, + VentSubWorkingModeProxxon, + VentSubWorkingMode, +} from './vents/types'; +export { + WallBox, + WallBoxUser, + WallBoxChargeState, + WallBoxPluggedState, + WallBoxChargeRequestState, +} from './wallBoxes/types'; +export { WeatherItem } from './weather/types'; diff --git a/src/systems/vents/index.ts b/src/systems/vents/index.ts index e73dc2b..a0cca62 100644 --- a/src/systems/vents/index.ts +++ b/src/systems/vents/index.ts @@ -1,13 +1,13 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { - CoolingModeState, - DehumidificationState, Vent, VentBypassState, + VentCoolingModeState, + VentDehumidificationState, VentLevel, VentWorkingModeIndividual, VentWorkingModePluggit, @@ -17,15 +17,17 @@ import { VentWorkingModeWestaflex, } from './types'; -const res = SystemType.vents; +const systemType = SystemType.vents; +/** + * @group Systems + */ export class Vents extends BaseSystem { /** - * Parses the item - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {Vent} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): Vent { const values = valuesToStringList(status); @@ -58,47 +60,43 @@ export class Vents extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -106,13 +104,13 @@ export class Vents extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the mode. - * @param {string} itemId the item id - * @param {VentWorkingModeProxxonV1 | VentWorkingModeProxxonV2 | VentWorkingModeWestaflex | VentWorkingModeStiebelTecalor | VentWorkingModeIndividual | VentWorkingModePluggit} mode the new mode + * @param itemId - The item id. + * @param mode - The new mode. */ public async setMode( itemId: string, @@ -124,13 +122,13 @@ export class Vents extends BaseSystem { | VentWorkingModeIndividual | VentWorkingModePluggit ): Promise { - await this.client.changeRequest(res, itemId, `M${mode}`); + await this.client.changeRequest(systemType, itemId, `M${mode}`); } /** * Sets the vent lelve. - * @param {string} itemId the item id - * @param {VentLevel} ventLevel the new vent level + * @param itemId - The item id. + * @param ventLevel - The new vent level. */ public async setLevel(itemId: string, ventLevel: VentLevel): Promise { let level = -1; @@ -151,36 +149,36 @@ export class Vents extends BaseSystem { level = 4; break; } - await this.client.changeRequest(res, itemId, `${level}`); + await this.client.changeRequest(systemType, itemId, `${level}`); } /** * Sets the bypass state. - * @param {string} itemId the item id - * @param {VentBypassState} state the new bypass state + * @param itemId - The item id. + * @param state - The new bypass state. */ public async setByPassState(itemId: string, state: VentBypassState): Promise { - await this.client.changeRequest(res, itemId, `BY${state}`); + await this.client.changeRequest(systemType, itemId, `BY${state}`); } /** * Sets the cooling mode state. - * @param {string} itemId the item id - * @param {CoolingModeState} state the new cooling mode state + * @param itemId - The item id. + * @param state - The new cooling mode state. */ - public async setCoolingModeState(itemId: string, state: CoolingModeState): Promise { - await this.client.changeRequest(res, itemId, `C${state}`); + public async setCoolingModeState(itemId: string, state: VentCoolingModeState): Promise { + await this.client.changeRequest(systemType, itemId, `C${state}`); } /** * Sets the dehumidification state. - * @param {string} itemId the item id - * @param {DehumidificationState} state the new dehumidification state + * @param itemId - The item id. + * @param state - The new dehumidification state. */ public async setDehumidificationState( itemId: string, - state: DehumidificationState + state: VentDehumidificationState ): Promise { - await this.client.changeRequest(res, itemId, `D${state}`); + await this.client.changeRequest(systemType, itemId, `D${state}`); } } diff --git a/src/systems/vents/types.ts b/src/systems/vents/types.ts index 3da46e1..af35384 100644 --- a/src/systems/vents/types.ts +++ b/src/systems/vents/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type Vent = BaseSystemType & { /** The current vent level */ ventLevel: VentLevel | null; @@ -37,16 +38,19 @@ export type Vent = BaseSystemType & { /** The current exhaust air working level as 0-100 % */ exhaustAirWorkingLevel: number | null; /** The current sub working mode */ - subWorkingMode: SubWorkingModeProxxon | SubWorkingMode | null; + subWorkingMode: VentSubWorkingModeProxxon | VentSubWorkingMode | null; /** The current cooling working mode state */ - coolingModeState: CoolingModeState | null; + coolingModeState: VentCoolingModeState | null; /** The current dehumidification state */ - dehumidificationState: DehumidificationState | null; + dehumidificationState: VentDehumidificationState | null; /** The current bypass state */ bypassMode: VentBypassState | null; }; -/** The vent levels */ +/** + * The vent levels. + * @group Systems + */ export enum VentLevel { 'off' = 0, 'level1' = 1, @@ -55,7 +59,10 @@ export enum VentLevel { 'level4' = 4, } -/** The vent device models */ +/** + * The vent device models. + * @group Systems + */ export enum VentDeviceModel { 'standard' = 0, 'pluggit' = 1, @@ -65,13 +72,19 @@ export enum VentDeviceModel { 'zimmermannV2' = 5, } -/** The proxxon v1 device working modes */ +/** + * The proxxon v1 device working modes. + * @group Systems + */ export enum VentWorkingModeProxxonV1 { 'off' = 0, 'on' = 1, } -/** The proxxon v2 device working modes */ +/** + * The proxxon v2 device working modes. + * @group Systems + */ export enum VentWorkingModeProxxonV2 { 'off' = 0, 'ecoSummer' = 1, @@ -80,25 +93,37 @@ export enum VentWorkingModeProxxonV2 { 'ovenOperation' = 4, } -/** The westaflex device working modes */ +/** + * The westaflex device working modes. + * @group Systems + */ export enum VentWorkingModeWestaflex { 'off' = 0, 'on' = 1, } -/** The stiebel tecalor device working modes */ +/** + * The stiebel tecalor device working modes. + * @group Systems + */ export enum VentWorkingModeStiebelTecalor { 'off' = 0, 'on' = 1, } -/** The individual device working modes */ +/** + * The individual device working modes. + * @group Systems + */ export enum VentWorkingModeIndividual { 'off' = 0, 'on' = 1, } -/** The pluggit device working modes */ +/** + * The pluggit device working modes. + * @group Systems + */ export enum VentWorkingModePluggit { 'auto' = 0, 'manual' = 1, @@ -106,34 +131,49 @@ export enum VentWorkingModePluggit { 'pluggitWeek' = 3, } -/** The vent bypass states */ +/** + * The vent bypass states. + * @group Systems + */ export enum VentBypassState { 'auto' = 0, 'manual' = 1, 'summer' = 2, } -/** The vent cooling mode states */ -export enum CoolingModeState { +/** + * The vent cooling mode states. + * @group Systems + */ +export enum VentCoolingModeState { 'off' = 0, 'on' = 1, } -/** The proxxon v1 device sub working modes */ -export enum SubWorkingModeProxxon { +/** + * The proxxon v1 device sub working modes. + * @group Systems + */ +export enum VentSubWorkingModeProxxon { 'middleTemp+offset' = 0, 'onlyOffset' = 1, } -/** The sub working modes */ -export enum SubWorkingMode { +/** + * The sub working modes. + * @group Systems + */ +export enum VentSubWorkingMode { 'exhaust' = 0, 'exhaustAndSupply' = 1, 'exhaustAndSupplyAndHeatRecovery' = 2, } -/** The dehumidification states */ -export enum DehumidificationState { +/** + * The dehumidification states. + * @group Systems + */ +export enum VentDehumidificationState { 'off' = 0, 'on' = 1, } diff --git a/src/systems/wallBoxes/index.ts b/src/systems/wallBoxes/index.ts index 74b41df..53a93bb 100644 --- a/src/systems/wallBoxes/index.ts +++ b/src/systems/wallBoxes/index.ts @@ -1,19 +1,21 @@ import { ItemStatusResponse, SystemConfig } from '../../client'; -import { tryParseFloat } from '../../utils/numberUtils'; -import { systemFilteredByItems, valuesToStringList } from '../../utils/stringUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; +import { systemFilteredByItems, valuesToStringList } from '../../utils/extensions/stringUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend } from '../base/types'; import { WallBox, WallBoxChargeState, WallBoxUser } from './types'; -const res = SystemType.wallBoxes; +const systemType = SystemType.wallBoxes; +/** + * @group Systems + */ export class WallBoxes extends BaseSystem { /** - * Parses the weather item. - * @param {SystemConfig} config the myGEKKO device configuration - * @param {string} status the response from the status request - * @param {string} itemId the item id - * @returns {WallBox} a parsed item + * Parses the item. + * @param config - The myGEKKO device configuration. + * @param status - The response from the status request. + * @param itemId - The item id. */ private parseItem(config: SystemConfig, status: ItemStatusResponse, itemId: string): WallBox { const values = valuesToStringList(status); @@ -55,47 +57,43 @@ export class WallBoxes extends BaseSystem { /** * Returns all items. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItems(): Promise { - const status = await this.getCompleteStatus(res); - return systemFilteredByItems(this.client.systemConfig[res]).map((key) => { - return this.parseItem(this.client.systemConfig[res], status[key], key); + const status = await this.getCompleteStatus(systemType); + return systemFilteredByItems(this.client.systemConfig[systemType]).map((key) => { + return this.parseItem(this.client.systemConfig[systemType], status[key], key); }); } /** * Returns a single item by id. - * @param {string} itemId the item id - * @returns {Promise} a item - * @throws {Error} + * @param itemId - The item id. + * @throws {@link ClientError} */ public async getItemById(itemId: string): Promise { - const status = await this.getStatusById(res, itemId); - return this.parseItem(this.client.systemConfig[res], status, itemId); + const status = await this.getStatusById(systemType, itemId); + return this.parseItem(this.client.systemConfig[systemType], status, itemId); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - return await this.getTrendsStatuses(res, startDate, endDate, count); + return await this.getTrendsStatuses(systemType, startDate, endDate, count); } /** * Returns a single trend by item id. - * @param {string} itemId the item id - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param itemId - The item id. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrendByItemId( itemId: string, @@ -103,13 +101,13 @@ export class WallBoxes extends BaseSystem { endDate: string, count: number ): Promise { - return await this.getTrendStatus(res, itemId, startDate, endDate, count); + return await this.getTrendStatus(systemType, itemId, startDate, endDate, count); } /** * Sets the charge state. - * @param {string} itemId the item id - * @param {WallBoxChargeState} state the new charge state + * @param itemId - The item id. + * @param state - The new charge state. */ public async setChargeState(itemId: string, state: WallBoxChargeState): Promise { let value = -1; @@ -123,15 +121,15 @@ export class WallBoxes extends BaseSystem { value = 1; break; } - await this.client.changeRequest(res, itemId, `${value}`); + await this.client.changeRequest(systemType, itemId, `${value}`); } /** * Sets the power. - * @param {string} itemId the item id - * @param {number} power the new power + * @param itemId - The item id. + * @param power - The new power. */ public async setChargePower(itemId: string, power: number): Promise { - await this.client.changeRequest(res, itemId, `CS${power}`); + await this.client.changeRequest(systemType, itemId, `CS${power}`); } } diff --git a/src/systems/wallBoxes/types.ts b/src/systems/wallBoxes/types.ts index 212f856..e36af38 100644 --- a/src/systems/wallBoxes/types.ts +++ b/src/systems/wallBoxes/types.ts @@ -1,5 +1,6 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type WallBox = BaseSystemType & { /** The current plugged state */ pluggedState: WallBoxPluggedState | null; @@ -13,42 +14,52 @@ export type WallBox = BaseSystemType & { maximumChargingPower: number | null; /** The current charging set point power as 1-100 kilowatt */ chargingPowerSetPoint: number | null; - /** The current electric set point as 1-... ampere */ + /** The current electric set point as 1-... Ampere */ electricCurrentSetPoint: number | null; /** The current charging username */ chargeUserName: string | null; /** The charging duration time as hh:mm:ss */ chargeDurationTime: number | null; - /** The current charging energy as 0-... kilowatt hour */ + /** The current charging energy as 0-... Kilowatt hour */ currentChargingEnergy: number | null; /** The charging start time as hh:mm:ss */ chargeStartTime: string | null; /** The current charging user index */ chargeUserIndex: number | null; - /** The registered users as {@link WallBoxUser[]} */ + /** The registered users */ wallBoxUser: WallBoxUser[] | null; }; -/** The wall box plugged states */ +/** + * The wall box plugged states. + * @group Systems + */ export enum WallBoxPluggedState { 'notPlugged' = 0, 'plugged' = 1, } -/** The wall box charge states */ +/** + * The wall box charge states. + * @group Systems + */ export enum WallBoxChargeState { 'off' = 0, 'on' = 1, 'paused' = 2, } -/** The wall box charge request states */ +/** + * The wall box charge request states. + * @group Systems + */ export enum WallBoxChargeRequestState { 'off' = 0, 'on' = 1, } /** The wall box user */ +/** @group Systems */ export type WallBoxUser = { /** The wall box user id */ id: number | null; diff --git a/src/systems/weather/index.ts b/src/systems/weather/index.ts index a003979..021ea7e 100644 --- a/src/systems/weather/index.ts +++ b/src/systems/weather/index.ts @@ -1,17 +1,19 @@ import { SystemStatusResponse, TrendItemResponse } from '../../client'; -import { throwErrorIfSystemIsNotEnabled } from '../../utils/errorUtils'; -import { tryParseFloat } from '../../utils/numberUtils'; +import { throwErrorIfSystemIsNotEnabled } from '../../utils/errors/errorUtils'; +import { tryParseFloat } from '../../utils/extensions/numberUtils'; import { BaseSystem } from '../base'; import { SystemType, Trend, TrendItem } from '../base/types'; import { WeatherItem } from './types'; -const res = SystemType.weather; +const systemType = SystemType.weather; +/** + * @group Systems + */ export class Weather extends BaseSystem { /** - * Parses the item @param status the response from the status request - * @param {string} status the current myGEKKO device status - * @returns {WeatherItem} a parsed item + * Parses the item. + * @param status - The current myGEKKO device status. */ private parseItem(status: SystemStatusResponse): WeatherItem { return { @@ -32,15 +34,14 @@ export class Weather extends BaseSystem { /** * Returns parsed weather item trend. - * @param {string} res the start date as date string - * @param {string} item the start date as date string - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a parsed item + * @param systemType - The start date as date string. + * @param item - The start date as date string. + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. */ private async parseWeatherItemTrend( - res: SystemType, + systemType: SystemType, item: string, startDate: string, endDate: string, @@ -50,7 +51,7 @@ export class Weather extends BaseSystem { for (const trendId of Object.keys(item)) { const response = await this.client.request( - `/trend/${res}/${trendId}/status?tstart=${startDate}&tend=${endDate}&datacount=${count}&` + `/trend/${systemType}/${trendId}/status?tstart=${startDate}&tend=${endDate}&datacount=${count}&` ); trendItems.push({ @@ -72,26 +73,24 @@ export class Weather extends BaseSystem { /** * Returns item. - * @returns {Promise} a item - * @throws {Error} + * @throws {@link ClientError} */ public async getItem(): Promise { - throwErrorIfSystemIsNotEnabled(this.client.systemConfig, res); + throwErrorIfSystemIsNotEnabled(this.client.systemConfig, systemType); - const status = await this.client.systemStatusRequest(res); + const status = await this.client.systemStatusRequest(systemType); return this.parseItem(status); } /** * Returns all trends. - * @param {string} startDate the start date as date string - * @param {string} endDate the start date as date string - * @param {number} count the data count - * @returns {Promise} a trend - * @throws {Error} + * @param startDate - The start date as date string. + * @param endDate - The start date as date string. + * @param count - The data count. + * @throws {@link ClientError} */ public async getTrends(startDate: string, endDate: string, count: number): Promise { - throwErrorIfSystemIsNotEnabled(this.client.systemConfig, res); + throwErrorIfSystemIsNotEnabled(this.client.systemConfig, systemType); return await this.parseWeatherItemTrend( 'meteo' as SystemType, diff --git a/src/systems/weather/types.ts b/src/systems/weather/types.ts index c413c31..28fa542 100644 --- a/src/systems/weather/types.ts +++ b/src/systems/weather/types.ts @@ -1,20 +1,21 @@ import { BaseSystemType } from '../base/types'; +/** @group Systems */ export type WeatherItem = BaseSystemType & { - /** The current twilight value in lux (lx) */ + /** The current twilight value as 0-100000 lux */ twilight: number | null; - /** The current relative humidity level */ + /** The current relative humidity level as 0-100 % */ humidity: number | null; - /** The current brightness value in kilo lux (kLx) */ + /** The current brightness value as 0-100000 kilo lux */ brightness: number | null; - /** The current brightness value from the west sensor in kilo lux (kLx) */ + /** The current brightness value from the west sensor as 0-100000 kilo lux */ brightnessWest: number | null; - /** The current brightness value from the east sensor in kilo lux (kLx) */ + /** The current brightness value from the east sensor as 0-100000 kilo lux */ brightnessEast: number | null; - /** The current value of the wind in meter/second (m/s) */ + /** The current value of the wind as 0-100000 meter per second */ wind: number | null; - /** The current value of the temperature in degrees celsius (°C) */ + /** The current value of the temperature as -100-100 °C */ temperature: number | null; - /** The current value of the accumulated rain in liter/hour (l/h) */ + /** The current value of the accumulated rain as 0-100 liter per hour */ rain: number | null; }; diff --git a/src/utils/errorUtils.ts b/src/utils/errorUtils.ts deleted file mode 100644 index 3dcb89d..0000000 --- a/src/utils/errorUtils.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { SystemConfig } from '../client'; -import { CLIENT_ERROR } from '../errors'; -import { SystemType } from '../systems/base/types'; - -/** - * Throws error if system is not enabled - * @param {SystemConfig} systemConfig the config of myGEKKO device. - * @param {SystemType} res the system type - */ -export function throwErrorIfSystemIsNotEnabled(systemConfig: SystemConfig, res: SystemType): void { - if (systemConfig.valueOf() == 0) { - throw Error(CLIENT_ERROR.SYSTEM_NOT_INITIALIZED); - } - - if (!available(systemConfig, res)) { - throw Error(CLIENT_ERROR.SYSTEM_NOT_SUPPORTED); - } -} - -/** - * Throws error if trend is not enabled - * @param {SystemConfig} trendConfig the config of myGEKKO device. - * @param {SystemType} res the system type - * @throws - */ -export function throwErrorIfTrendIsNotEnabled(trendConfig: SystemConfig, res: SystemType): void { - if (trendConfig.valueOf() == 0) { - throw new Error(CLIENT_ERROR.SYSTEM_NOT_INITIALIZED); - } - if (!available(trendConfig, res)) { - throw new Error(CLIENT_ERROR.TREND_NOT_SUPPORTED); - } -} - -/** - * Throws error if itemId is not found - * @param {SystemConfig} config the config of myGEKKO device. - * @param {SystemType} res the system type. - * @param {string} itemId the item id. - * @throws - */ -export function throwErrorIfItemIdIsNoFound( - config: SystemConfig, - res: SystemType, - itemId: string -): void { - const values = res.split('/'); - let s = config; - - for (const i of values) { - if (values.lastIndexOf(i) === values.length - 1) { - if (!s[i][itemId]) { - throw new Error(CLIENT_ERROR.ITEM_ID_NOT_FOUND); - } - break; - } - s = config[i]; - } -} - -/** - * Checks if config includes system type - * @param {SystemConfig} config the config of myGEKKO device. - * @param {SystemType} res the system type. - * @returns {boolean} true if available otherwise false - */ -function available(config: SystemConfig, res: SystemType): boolean { - const values = res.split('/'); - let s = config; - for (const i of values) { - if (!s[i]) { - return false; - } - s = config[i]; - } - return true; -} diff --git a/src/utils/errors/errorUtils.ts b/src/utils/errors/errorUtils.ts new file mode 100644 index 0000000..9d750b8 --- /dev/null +++ b/src/utils/errors/errorUtils.ts @@ -0,0 +1,83 @@ +import { SystemConfig } from '../../client'; +import { CLIENT_ERROR_MESSAGES, ClientError } from '../../errors'; +import { SystemType } from '../../systems/base/types'; + +/** + * Throws error if system is not enabled. + * @param systemConfig - The config of myGEKKO device. + * @param systemType - The system type. + * @throws {@link ClientError} + */ +export function throwErrorIfSystemIsNotEnabled( + systemConfig: SystemConfig, + systemType: SystemType +): void { + if (systemConfig.valueOf() == 0) { + throw Error(CLIENT_ERROR_MESSAGES.SYSTEM_NOT_INITIALIZED); + } + + if (!available(systemConfig, systemType)) { + throw Error(CLIENT_ERROR_MESSAGES.SYSTEM_NOT_SUPPORTED); + } +} + +/** + * Throws error if trend is not enabled. + * @param trendConfig - The config of myGEKKO device. + * @param systemType - The system type. + * @throws {@link ClientError} + */ +export function throwErrorIfTrendIsNotEnabled( + trendConfig: SystemConfig, + systemType: SystemType +): void { + if (trendConfig.valueOf() == 0) { + throw new ClientError(CLIENT_ERROR_MESSAGES.SYSTEM_NOT_INITIALIZED); + } + if (!available(trendConfig, systemType)) { + throw new ClientError(CLIENT_ERROR_MESSAGES.TREND_NOT_SUPPORTED); + } +} + +/** + * Throws error if itemId is not found. + * @param config - The config of myGEKKO device. + * @param systemType - The system type. + * @param itemId - The item id. + * @throws {@link ClientError} + */ +export function throwErrorIfItemIdIsNoFound( + config: SystemConfig, + systemType: SystemType, + itemId: string +): void { + const values = systemType.split('/'); + let s = config; + + for (const i of values) { + if (values.lastIndexOf(i) === values.length - 1) { + if (!s[i][itemId]) { + throw new ClientError(CLIENT_ERROR_MESSAGES.ITEM_ID_NOT_FOUND); + } + break; + } + s = config[i]; + } +} + +/** + * Checks if config includes system type. + * @param config - The config of myGEKKO device. + * @param systemType - The system type. + */ +function available(config: SystemConfig, systemType: SystemType): boolean { + const values = systemType.split('/'); + let s = config; + for (const i of values) { + if (!s[i]) { + return false; + } + s = config[i]; + } + return true; +} diff --git a/src/utils/numberUtils.ts b/src/utils/extensions/numberUtils.ts similarity index 62% rename from src/utils/numberUtils.ts rename to src/utils/extensions/numberUtils.ts index 567f951..7f43c4c 100644 --- a/src/utils/numberUtils.ts +++ b/src/utils/extensions/numberUtils.ts @@ -1,7 +1,6 @@ /** - * Parse string to number - * @param {string} string the string to parse. - * @returns {number | null} a parsed number + * Parse string to number. + * @param string - The string to parse. */ export function tryParseInt(string: string): number | null { if (string != null && string.length && !isNaN(Number(string))) { @@ -11,9 +10,8 @@ export function tryParseInt(string: string): number | null { } /** - * Parse string to number - * @param {string}string the string to parse. - @returns {number | null} a parsed number + * Parse string to number. + * @param string - To parse. */ export function tryParseFloat(string: string): number | null { if (string != null && string.length && !isNaN(Number(string))) { diff --git a/src/utils/extensions/stringUtils.ts b/src/utils/extensions/stringUtils.ts new file mode 100644 index 0000000..cd3a1ee --- /dev/null +++ b/src/utils/extensions/stringUtils.ts @@ -0,0 +1,31 @@ +import { ItemStatusResponse, SystemConfig } from '../../client'; +import { CLIENT_ERROR_MESSAGES, ClientError } from '../../errors'; + +/** + * Converts string to list of strings. + * @param values - The string. + * @throws {@link ClientError} + */ +export function valuesToStringList(values: ItemStatusResponse): string[] { + try { + return values.sumstate.value.slice(0, -1).split(';'); + } catch (e) { + throw new ClientError(CLIENT_ERROR_MESSAGES.CANNOT_PARSE_STATUS); + } +} + +/** + * Filters system config by items. + * @param systemConfig - The myGEKKO device system config. + */ +export function systemFilteredByItems(systemConfig: SystemConfig): string[] { + return Object.keys(systemConfig).filter((key) => key.includes('item')); +} + +/** + * Filters system config by groups. + * @param systemConfig - The myGEKKO device system config. + */ +export function systemFilteredByGroup(systemConfig: SystemConfig): string[] { + return Object.keys(systemConfig).filter((key) => key.includes('group')); +} diff --git a/src/utils/index.ts b/src/utils/index.ts new file mode 100644 index 0000000..ea82010 --- /dev/null +++ b/src/utils/index.ts @@ -0,0 +1,13 @@ +import { + decimalToHexColor, + hexToDecimal, + rgbToDecimal, + rgbToHex, + tunableWhiteToHex, +} from './lights/colorUtils'; + +/** + * The color utils. + * @group Utils + */ +export { tunableWhiteToHex, rgbToHex, rgbToDecimal, hexToDecimal, decimalToHexColor }; diff --git a/src/utils/colorUtils.ts b/src/utils/lights/colorUtils.ts similarity index 56% rename from src/utils/colorUtils.ts rename to src/utils/lights/colorUtils.ts index bc8e7bf..36d3bb1 100644 --- a/src/utils/colorUtils.ts +++ b/src/utils/lights/colorUtils.ts @@ -1,7 +1,7 @@ /** - * Calculates the color from tunable white level - * @param {number} value the tunable white level - * @returns {string} a hex color + * Calculates the color from tunable white level. + * @param value - The tunable white level. + * @group Utils */ export function tunableWhiteToHex(value: number): string { let r: number, g: number, b: number; @@ -18,31 +18,31 @@ export function tunableWhiteToHex(value: number): string { } /** - * Calculates the hex color from rgb color - * @param {number} r the 24 bits red color - * @param {number} g the 24 bits green color - * @param {number} b the 24 bits blue color - * @returns {string} a hex color + * Calculates the hex color from rgb color. + * @param r - The 24 bits red color. + * @param g - The 24 bits green color. + * @param b - The 24 bits blue color. + * @group Utils */ export function rgbToHex(r: number, g: number, b: number): string { return '#' + ((1 << 24) | (r << 16) | (g << 8) | b).toString(16).slice(1); } /** - * Calculates the decimal color from rgb color - * @param {number} r the 24 bits red color - * @param {number} g the 24 bits green color - * @param {number} b the 24 bits blue color - * @returns {number} a decimal color + * Calculates the decimal color from rgb color. + * @param r - The 24 bits red color. + * @param g - The 24 bits green color. + * @param b - The 24 bits blue color. + * @group Utils */ export function rgbToDecimal(r: number, g: number, b: number): number { return (r << 16) + (g << 8) + b; } /** - * Calculates decimal color from hex color - * @param {string} hex the hex color - * @returns {number} a decimal color + * Calculates decimal color from hex color. + * @param hex - The hex color. + * @group Utils */ export function hexToDecimal(hex: string): number { const r = parseInt(hex.substring(1, 3), 16); @@ -52,9 +52,9 @@ export function hexToDecimal(hex: string): number { } /** - * Calculates the hex color from decimal color - * @param {number} decimal the decimal color - * @returns {string} a hex color + * Calculates the hex color from decimal color. + * @param decimal - The decimal color. + * @group Utils */ export function decimalToHexColor(decimal: number): string { const r = (decimal >> 16) & 0xff; diff --git a/src/utils/stringUtils.ts b/src/utils/stringUtils.ts deleted file mode 100644 index b6ed6dd..0000000 --- a/src/utils/stringUtils.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { ItemStatusResponse, SystemConfig } from '../client'; -import { CLIENT_ERROR } from '../errors'; - -/** - * Converts string to list of strings - * @param {string} values the string. - * @returns {string[]} a list of values - */ -export function valuesToStringList(values: ItemStatusResponse): string[] { - try { - return values.sumstate.value.slice(0, -1).split(';'); - } catch (e) { - throw new Error(CLIENT_ERROR.CANNOT_PARSE_STATUS); - } -} - -/** - * Filters system config by items - * @param {SystemConfig} systemConfig the myGEKKO device system config. - * @returns {string[]} a filtered list of items - */ -export function systemFilteredByItems(systemConfig: SystemConfig): string[] { - return Object.keys(systemConfig).filter((key) => key.includes('item')); -} - -/** - * Filters system config by groups - * @param {SystemConfig} systemConfig the myGEKKO device system config. - * @returns {string[]} a filtered list of groups - */ -export function systemFilteredByGroup(systemConfig: SystemConfig): string[] { - return Object.keys(systemConfig).filter((key) => key.includes('group')); -} diff --git a/test/utils/colorUtils.test.ts b/test/utils/colorUtils.test.ts index e3b5d40..1eddf5a 100644 --- a/test/utils/colorUtils.test.ts +++ b/test/utils/colorUtils.test.ts @@ -4,7 +4,7 @@ import { rgbToDecimal, rgbToHex, tunableWhiteToHex, -} from '../../src/utils/colorUtils'; +} from '../../src/utils/lights/colorUtils'; const bitterSweet = { rgb: { r: 255, g: 100, b: 100 }, diff --git a/test/utils/numberUtils.test.ts b/test/utils/numberUtils.test.ts index fd80664..557e1fb 100644 --- a/test/utils/numberUtils.test.ts +++ b/test/utils/numberUtils.test.ts @@ -1,4 +1,4 @@ -import { tryParseFloat, tryParseInt } from '../../src/utils/numberUtils'; +import { tryParseFloat, tryParseInt } from '../../src/utils/extensions/numberUtils'; test('tryParseInt', () => { expect(tryParseInt('Test')).toBe(null); diff --git a/test/utils/stringUtils.test.ts b/test/utils/stringUtils.test.ts index 8f7dc78..a2c30a8 100644 --- a/test/utils/stringUtils.test.ts +++ b/test/utils/stringUtils.test.ts @@ -1,9 +1,9 @@ -import { CLIENT_ERROR } from '../../src/errors'; +import { CLIENT_ERROR_MESSAGES } from '../../src'; import { systemFilteredByGroup, systemFilteredByItems, valuesToStringList, -} from '../../src/utils/stringUtils'; +} from '../../src/utils/extensions/stringUtils'; test('valuesToStringList', () => { expect(valuesToStringList(JSON.parse('{"sumstate":{"value":"0;0;3;kW;10.001;"}}'))).toEqual([ @@ -23,7 +23,7 @@ test('valuesToStringList', () => { expect(() => { valuesToStringList(JSON.parse('{}')); - }).toThrow(CLIENT_ERROR.CANNOT_PARSE_STATUS); + }).toThrow(CLIENT_ERROR_MESSAGES.CANNOT_PARSE_STATUS); }); test('systemFilteredByItems', () => { diff --git a/test/utils/systemCheck.test.ts b/test/utils/systemCheck.test.ts index c4c6652..0bb6432 100644 --- a/test/utils/systemCheck.test.ts +++ b/test/utils/systemCheck.test.ts @@ -1,10 +1,10 @@ -import { CLIENT_ERROR } from '../../src/errors'; -import { SystemType } from '../../src/systems/base/types'; +import { CLIENT_ERROR_MESSAGES } from '../../src'; +import { SystemType } from '../../src'; import { throwErrorIfItemIdIsNoFound, throwErrorIfSystemIsNotEnabled, throwErrorIfTrendIsNotEnabled, -} from '../../src/utils/errorUtils'; +} from '../../src/utils/errors/errorUtils'; test('throwErrorIfSystemIsNotEnabled', () => { expect(() => @@ -12,9 +12,9 @@ test('throwErrorIfSystemIsNotEnabled', () => { ).not.toThrow(); expect(() => throwErrorIfSystemIsNotEnabled('{"blinds": {"item0":{}}}', SystemType.lights) - ).toThrow(CLIENT_ERROR.SYSTEM_NOT_SUPPORTED); + ).toThrow(CLIENT_ERROR_MESSAGES.SYSTEM_NOT_SUPPORTED); expect(() => throwErrorIfSystemIsNotEnabled('', SystemType.blinds)).toThrow( - CLIENT_ERROR.SYSTEM_NOT_INITIALIZED + CLIENT_ERROR_MESSAGES.SYSTEM_NOT_INITIALIZED ); }); @@ -24,9 +24,9 @@ test('throwErrorIfTrendIsNotAvailable', () => { ).not.toThrow(); expect(() => throwErrorIfTrendIsNotEnabled('{"blinds": {"item0":{}}}', SystemType.lights) - ).toThrow(CLIENT_ERROR.TREND_NOT_SUPPORTED); + ).toThrow(CLIENT_ERROR_MESSAGES.TREND_NOT_SUPPORTED); expect(() => throwErrorIfTrendIsNotEnabled('', SystemType.blinds)).toThrow( - CLIENT_ERROR.SYSTEM_NOT_INITIALIZED + CLIENT_ERROR_MESSAGES.SYSTEM_NOT_INITIALIZED ); }); @@ -45,7 +45,7 @@ test('throwErrorIfItemIdIsNoAvailable', () => { expect(() => throwErrorIfItemIdIsNoFound(JSON.parse('{"blinds": {"item0":{}}}'), SystemType.blinds, 'item3') - ).toThrow(CLIENT_ERROR.ITEM_ID_NOT_FOUND); + ).toThrow(CLIENT_ERROR_MESSAGES.ITEM_ID_NOT_FOUND); expect(() => throwErrorIfItemIdIsNoFound( @@ -53,5 +53,5 @@ test('throwErrorIfItemIdIsNoAvailable', () => { SystemType.weather, 'item3' ) - ).toThrow(CLIENT_ERROR.ITEM_ID_NOT_FOUND); + ).toThrow(CLIENT_ERROR_MESSAGES.ITEM_ID_NOT_FOUND); }); diff --git a/tsconfig.json b/tsconfig.json index 3d7f96e..a89617c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { + "strict": true, "module": "commonjs", "target": "es2019", "declaration": true, "outDir": "./dist", "rootDir": "src", - "strict": true, "moduleResolution": "node", "suppressImplicitAnyIndexErrors": true, "ignoreDeprecations": "5.0" diff --git a/tsdoc.json b/tsdoc.json new file mode 100644 index 0000000..b89839c --- /dev/null +++ b/tsdoc.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", + "extends": ["typedoc/tsdoc.json"] +} diff --git a/typedoc.config.cjs b/typedoc.config.cjs index 9b9020e..4bffe53 100644 --- a/typedoc.config.cjs +++ b/typedoc.config.cjs @@ -1,22 +1,19 @@ /** @type {import("typedoc")} */ module.exports = { - entryPoints: ['src/index.ts'], - excludePrivate: false, + $schema: 'https://typedoc.org/schema.json', + entryPoints: ['./src/index.ts'], + excludePrivate: true, excludeProtected: false, - excludeInternal: false, + excludeInternal: true, out: 'docs', - requiredToBeDocumented: [ - 'Enum', - 'EnumMember', - 'Variable', - 'Function', - 'Class', - 'Interface', - 'Property', - 'Method', - 'GetSignature', - 'SetSignature', - 'TypeAlias', - ], - internalModule: 'systems', + treatWarningsAsErrors: true, + githubPages: true, + navigation: { + includeCategories: false, + includeGroups: true, + fullTree: false, + }, + navigationLinks: { + GitHub: 'https://github.com/pinpong/mygekko-client-library', + }, }; diff --git a/yarn.lock b/yarn.lock index 69cd327..83c0bd8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -635,6 +635,21 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@microsoft/tsdoc-config@0.16.2": + version "0.16.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz#b786bb4ead00d54f53839a458ce626c8548d3adf" + integrity sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw== + dependencies: + "@microsoft/tsdoc" "0.14.2" + ajv "~6.12.6" + jju "~1.4.0" + resolve "~1.19.0" + +"@microsoft/tsdoc@0.14.2": + version "0.14.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz#c3ec604a0b54b9a9b87e9735dfc59e1a5da6a5fb" + integrity sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -688,9 +703,9 @@ lodash "^4.17.21" "@types/babel__core@^7.1.14": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.1.tgz#916ecea274b0c776fec721e333e55762d3a9614b" - integrity sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw== + version "7.20.2" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.2.tgz#215db4f4a35d710256579784a548907237728756" + integrity sha512-pNpr1T1xLUc2l3xJKuPtsEky3ybxN3m4fJkknfIpTCTfIZCDW57oAg+EfCgIIp2rvCe0Wn++/FfodDS4YXxBwA== dependencies: "@babel/parser" "^7.20.7" "@babel/types" "^7.20.7" @@ -699,24 +714,24 @@ "@types/babel__traverse" "*" "@types/babel__generator@*": - version "7.6.4" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.4.tgz#1f20ce4c5b1990b37900b63f050182d28c2439b7" - integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg== + version "7.6.5" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.5.tgz#281f4764bcbbbc51fdded0f25aa587b4ce14da95" + integrity sha512-h9yIuWbJKdOPLJTbmSpPzkF67e659PbQDba7ifWm5BJ8xTv+sDmS7rFmywkWOvXedGTivCdeGSIIX8WLcRTz8w== dependencies: "@babel/types" "^7.0.0" "@types/babel__template@*": - version "7.4.1" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.1.tgz#3d1a48fd9d6c0edfd56f2ff578daed48f36c8969" - integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== + version "7.4.2" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.2.tgz#843e9f1f47c957553b0c374481dc4772921d6a6b" + integrity sha512-/AVzPICMhMOMYoSx9MoKpGDKdBRsIXMNByh1PXSZoa+v6ZoLa8xxtsT/uLQ/NJm0XVAWl/BvId4MlDeXJaeIZQ== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.1.tgz#dd6f1d2411ae677dcb2db008c962598be31d6acf" - integrity sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg== + version "7.20.2" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.2.tgz#4ddf99d95cfdd946ff35d2b65c978d9c9bf2645d" + integrity sha512-ojlGK1Hsfce93J0+kn3H5R73elidKUaZonirN33GSmgTUMpzI/MIFfSpF3haANe3G1bEBS9/9/QEqwTzwqFsKw== dependencies: "@babel/types" "^7.20.7" @@ -755,9 +770,9 @@ pretty-format "^29.0.0" "@types/json-schema@^7.0.12": - version "7.0.12" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb" - integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA== + version "7.0.13" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.13.tgz#02c24f4363176d2d18fc8b70b9f3c54aba178a85" + integrity sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ== "@types/json5@^0.0.29": version "0.0.29" @@ -765,9 +780,9 @@ integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== "@types/node@*": - version "20.6.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.1.tgz#8b589bba9b2af0128796461a0979764562687e6f" - integrity sha512-4LcJvuXQlv4lTHnxwyHQZ3uR9Zw2j7m1C9DfuwoTFQQP4Pmu04O6IfLYgMmHoOCt0nosItLLZAH+sOrRE0Bo8g== + version "20.6.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.2.tgz#a065925409f59657022e9063275cd0b9bd7e1b12" + integrity sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw== "@types/semver@^7.5.0": version "7.5.2" @@ -886,7 +901,7 @@ acorn@^8.9.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== -ajv@^6.12.4: +ajv@^6.12.4, ajv@~6.12.6: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -1613,10 +1628,10 @@ eslint-plugin-import@2.28.1: semver "^6.3.1" tsconfig-paths "^3.14.2" -eslint-plugin-jsdoc@46.8.0: - version "46.8.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-46.8.0.tgz#d08cd35eca79b34586fe71e85796fe6d2ba5fcff" - integrity sha512-qsYP7LN/ji5htZAdfAr8qX0bRZcbTU0hpuECR50UpaqkPyXsWgp2y77RPQ4t7fR5bHpgnGcD5L43PxjyOvIfQA== +eslint-plugin-jsdoc@^46.8.1: + version "46.8.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-46.8.1.tgz#cfc649c15d460903fe8e86eda582023bb97f283a" + integrity sha512-uTce7IBluPKXIQMWJkIwFsI1gv7sZRmLjctca2K5DIxPi8fSBj9f4iru42XmGwuiMyH2f3nfc60sFmnSGv4Z/A== dependencies: "@es-joy/jsdoccomment" "~0.40.1" are-docs-informative "^0.0.2" @@ -1628,6 +1643,14 @@ eslint-plugin-jsdoc@46.8.0: semver "^7.5.4" spdx-expression-parse "^3.0.1" +eslint-plugin-tsdoc@0.2.17: + version "0.2.17" + resolved "https://registry.yarnpkg.com/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.17.tgz#27789495bbd8778abbf92db1707fec2ed3dfe281" + integrity sha512-xRmVi7Zx44lOBuYqG8vzTXuL6IdGOeF9nHX17bjJ8+VE6fsxpdGem0/SBTmAwgYMKYB1WBkqRJVQ+n8GK041pA== + dependencies: + "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc-config" "0.16.2" + eslint-scope@^7.2.2: version "7.2.2" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" @@ -1853,9 +1876,9 @@ flat-cache@^3.0.4: rimraf "^3.0.2" flatted@^3.2.7: - version "3.2.7" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" - integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== + version "3.2.9" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" + integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== follow-redirects@^1.15.0: version "1.15.2" @@ -2175,7 +2198,7 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== -is-core-module@^2.13.0: +is-core-module@^2.1.0, is-core-module@^2.13.0: version "2.13.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.0.tgz#bb52aa6e2cbd49a30c2ba68c42bf3435ba6072db" integrity sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ== @@ -2717,6 +2740,11 @@ jest@29.7.0: import-local "^3.0.2" jest-cli "^29.7.0" +jju@~1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/jju/-/jju-1.4.0.tgz#a3abe2718af241a2b2904f84a625970f389ae32a" + integrity sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA== + js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -3184,7 +3212,7 @@ path-key@^4.0.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-4.0.0.tgz#295588dc3aee64154f877adb9d780b81c554bf18" integrity sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ== -path-parse@^1.0.7: +path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -3315,14 +3343,22 @@ resolve.exports@^2.0.0: integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== resolve@^1.20.0, resolve@^1.22.4: - version "1.22.5" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.5.tgz#a83c145cf04ffcd19b1f3f5f9e0ae8b9053f0615" - integrity sha512-qWhv7PF1V95QPvRoUGHxOtnAlEvlXBylMZcjUR9pAumMmveFtcHJRXGIr+TkjfNJVQypqv2qcDiiars2y1PsSg== + version "1.22.6" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.6.tgz#dd209739eca3aef739c626fea1b4f3c506195362" + integrity sha512-njhxM7mV12JfufShqGy3Rz8j11RPdLy4xi15UurGJeoHLfJpVXKdh3ueuOqbYUcDZnffr6X739JBo5LzyahEsw== dependencies: is-core-module "^2.13.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +resolve@~1.19.0: + version "1.19.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" + integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== + dependencies: + is-core-module "^2.1.0" + path-parse "^1.0.6" + restore-cursor@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-4.0.0.tgz#519560a4318975096def6e609d44100edaa4ccb9" @@ -3746,11 +3782,6 @@ typed-array-length@^1.0.4: for-each "^0.3.3" is-typed-array "^1.1.9" -typedoc-plugin-missing-exports@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/typedoc-plugin-missing-exports/-/typedoc-plugin-missing-exports-2.1.0.tgz#f283a407eb7b3a43dafc598f44bbfc2d36dc1704" - integrity sha512-+1DhqZCEu7Vu5APnrqpPwl31D+hXpt1fV0Le9ycCRL1eLVdatdl6KVt4SEVwPxnEpKwgOn2dNX6I9+0F1aO2aA== - typedoc@0.25.1: version "0.25.1" resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.25.1.tgz#50de2d8fb93623fbfb59e2fa6407ff40e3d3f438"