39 lines
890 B
TypeScript
39 lines
890 B
TypeScript
import request from '@/utils/request';
|
|
import { AxiosPromise } from 'axios';
|
|
|
|
export interface SolarPropertyCommand {
|
|
id: string | number;
|
|
properties: Record<string, any>;
|
|
cache?: boolean;
|
|
}
|
|
|
|
export interface SolarPropertyCommandResult {
|
|
deviceId: string | number;
|
|
serialNum: string;
|
|
online: boolean;
|
|
statusCode?: number;
|
|
properties: Record<string, any>;
|
|
mode: 'direct' | 'cached';
|
|
cached: boolean;
|
|
sent: boolean;
|
|
}
|
|
|
|
export const getDeviceStatus = (devicetype: number, serialnum: string): AxiosPromise<number> => {
|
|
return request({
|
|
url: '/iot/device/status',
|
|
method: 'get',
|
|
params: {
|
|
devicetype,
|
|
serialnum
|
|
}
|
|
});
|
|
};
|
|
|
|
export const sendSolarPropertyCommand = (data: SolarPropertyCommand): AxiosPromise<SolarPropertyCommandResult> => {
|
|
return request({
|
|
url: '/iot/device/solar/property-command',
|
|
method: 'post',
|
|
data
|
|
});
|
|
};
|