UNPKG

lavva.exalushome

Version:

Library implementing communication and abstraction layers for ExalusHome system

62 lines (61 loc) 3.86 kB
import { IDIService } from "../../IDIService"; import { DeviceResponseType, IDevice } from "../Devices/IDevice"; import { ResponseResult } from "../FieldChangeResult"; import { IAvailableState, IAvailableStatePerChannel, StateDataResponse, StateInterval } from "./StatesHistory"; export interface IStatesHistoryService extends IDIService { /** * Generic method to get state history data from controller, * if you want know what type of generic you should use for particular state - use method GetAvailableStatesAsync that returns DeviceResponseType with appropiate name of T object * @param device device object * @param channel channel number * @param responseType the state from which we want historical data, state must exists at given channel * @param stateFrom the interval from which we want historical data * @param limit data volume limit - pagination * @param offset offset of data - pagination * @returns StateDataResponse or StateHistoryErrorCode if failed */ GetStatesByIntervalAsync<T>(device: IDevice, channel: number, responseType: DeviceResponseType, stateFrom: StateInterval, limit: number, offset: number, orderByDesc?: boolean): Promise<StateDataResponse<T> | ResponseResult<StateHistoryErrorCode>>; /** * Generic method to get state history data from controller, * if you want know what type of generic you should use for particular state - use method GetAvailableStatesAsync that returns DeviceResponseType with appropiate name of T object * @param deviceGuid GUID of device * @param channel channel number * @param responseType the state from which we want historical data, state must exists at given channel * @param stateFrom the interval from which we want historical data * @param limit data volume limit - pagination * @param offset offset of data - pagination * @returns StateDataResponse or StateHistoryErrorCode if failed */ GetStatesByIntervalAsync<T>(deviceGuid: string, channel: number, responseType: DeviceResponseType, stateFrom: StateInterval, limit: number, offset: number, orderByDesc?: boolean): Promise<StateDataResponse<T> | ResponseResult<StateHistoryErrorCode>>; /** * Returns array that contains supported states that have historical data. Each state contains information about data object that should use as generic T parameter in function GetStatesByIntervalAsync<T> */ GetAvailableStatesAsync(): Promise<IAvailableState[] | ResponseResult<StateHistoryErrorCode>>; /** * Returns information about historical states supported on a specific channle of device * @param device device * @param channel channel number */ GetAvailableStatesPerChannelAsync(device: IDevice, channel: number): Promise<IAvailableStatePerChannel | ResponseResult<StateHistoryErrorCode>>; /** * Returns information about historical states supported on a specific channle of device * @param deviceGuid deviceGuid * @param channel channel number */ GetAvailableStatesPerChannelAsync(deviceGuid: string, channel: number): Promise<IAvailableStatePerChannel | ResponseResult<StateHistoryErrorCode>>; /** * Checks if state history functionality is supported, if function returns false, it means that we don't have historical data support. */ IsFunctionalitySupportedAsync(): Promise<boolean>; } export declare enum StateHistoryErrorCode { CannotFindDevice = "CannotFindDevice", ResponseTypeNotSupported = "ResponseTypeNotSupported", InvalidChannelNumber = "InvalidChannelNumber", IncorrectLimitValue = "IncorrectLimitValue", IncorrectOffsetValue = "IncorrectOffsetValue", OtherError = "OtherError", FatalError = "FatalError", NoData = "NoData", FunctionalityNotSupported = "FunctionalityNotSupported" }