lavva.exalushome
Version:
Library implementing communication and abstraction layers for ExalusHome system
71 lines (70 loc) • 5.19 kB
TypeScript
import { IDIService } from "../../IDIService";
import { DeviceResponseType, IDevice } from "../Devices/IDevice";
import { ResponseResult } from "../FieldChangeResult";
import { AveragingStateValues, BrightnessHistory, DataRangeType, EnergyHistory, IAvailableState, IAvailableStatePerChannel, StateDataResponse, StateInterval } from "./StatesHistory";
export interface IStatesHistoryService extends IDIService {
DoesSupportPreciseTimeFramesAsync(): Promise<boolean>;
ExportPressureToCsv(device: IDevice, channel: number, data: StateDataResponse<AveragingStateValues>): void;
ExportBrightnessToCsv(device: IDevice, channel: number, data: StateDataResponse<BrightnessHistory>): void;
ExportHumidityToCsv(device: IDevice, channel: number, data: StateDataResponse<AveragingStateValues>): void;
ExportWindSpeedToCsv(device: IDevice, channel: number, data: StateDataResponse<AveragingStateValues>): void;
ExportTemperatureToCsv(device: IDevice, channel: number, data: StateDataResponse<AveragingStateValues>): void;
ExportEnergyToCsv(device: IDevice, channel: number, response: StateDataResponse<EnergyHistory>): void;
GetStatesByTimeRangeAsync<T>(devicGuide: string, channel: number, responseType: DeviceResponseType, timeRange: DataRangeType, time: Date, limit: number, offset: number, orderByDesc?: boolean): Promise<StateDataResponse<T> | ResponseResult<StateHistoryErrorCode>>;
GetStatesByTimeRangeAsync<T>(device: IDevice, channel: number, responseType: DeviceResponseType, timeRange: DataRangeType, time: Date, 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 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"
}