154 lines
4.3 KiB
TypeScript
154 lines
4.3 KiB
TypeScript
export type NumericSensor = { value?: number | null; calibration?: number | null };
|
||
export type DeviceConfig = { status?: number | null };
|
||
export type TargetTemp = { value?: number | null };
|
||
|
||
export type PayloadData = {
|
||
updatedAt?: string;
|
||
name?: string;
|
||
day?: number | null;
|
||
lux?: number | null;
|
||
actualTemperature?: number | null;
|
||
setpointCurrent?: number | null;
|
||
coop?: { kode?: string };
|
||
inverter?: { setEnable?: boolean; value?: number | null };
|
||
sensors?: {
|
||
temperature1?: NumericSensor;
|
||
temperature2?: NumericSensor;
|
||
temperature3?: NumericSensor;
|
||
temperatureOutside?: NumericSensor;
|
||
humidity?: NumericSensor;
|
||
ammonia?: NumericSensor;
|
||
co2?: NumericSensor;
|
||
water?: NumericSensor;
|
||
wind?: NumericSensor;
|
||
lux?: NumericSensor;
|
||
};
|
||
device?: Record<string, DeviceConfig>;
|
||
targetTemperature?: Record<string, TargetTemp>;
|
||
fanTargetTemperature?: Record<string, number>;
|
||
heaterTargetTemperature?: Record<string, { targetOn?: number; targetOff?: number }>;
|
||
/** Pendingin: setpoint °C from active cooler level (`setting.cooler` lv1–lv3) when device is on. */
|
||
coolerTargetTemperature?: number | null;
|
||
/** Dashboard `/tabelalarm` `data.humidity.nilai` (often raw tenths like live sensor; >100 -> /10 for %). */
|
||
humidityAlarmNilai?: number | null;
|
||
/** `/tabelalarm` `batas_atas` — upper temp limit (°C) and which sensor it applies to. */
|
||
batasAtasNilai?: number | null;
|
||
batasAtasSensorInUse?: string | null;
|
||
/** `/tabelalarm` `batas_bawah_1` — lower temp limit (°C). */
|
||
batasBawah1Nilai?: number | null;
|
||
batasBawah1SensorInUse?: string | null;
|
||
/** `/tabelalarm` `batas_bawah_2` — second lower temp limit (°C). */
|
||
batasBawah2Nilai?: number | null;
|
||
batasBawah2SensorInUse?: string | null;
|
||
};
|
||
|
||
export type IotFlockResultRow = {
|
||
id?: number | string;
|
||
flock_id?: string;
|
||
/** Some flock list payloads use `flock` instead of `flock_id`. */
|
||
flock?: string;
|
||
payload?: { data?: PayloadData };
|
||
};
|
||
|
||
export type IotFlocksRaw = {
|
||
count?: number;
|
||
results?: IotFlockResultRow[];
|
||
};
|
||
|
||
export type IotDeviceRow = {
|
||
key: string;
|
||
label: string;
|
||
status: string;
|
||
setpoint: string;
|
||
};
|
||
|
||
export type IotFanHistoryMetric =
|
||
| 'fan1'
|
||
| 'fan2'
|
||
| 'fan3'
|
||
| 'fan4'
|
||
| 'fan5'
|
||
| 'fan6'
|
||
| 'fan7'
|
||
| 'fan8'
|
||
| 'fan9'
|
||
| 'fan10'
|
||
| 'fan11';
|
||
|
||
export type IotHvacHistoryMetric = 'heater1' | 'heater2' | 'cooler';
|
||
|
||
export type IotDeviceHistoryMetric = IotFanHistoryMetric | IotHvacHistoryMetric;
|
||
|
||
/** Metrics that support a 24h line chart (flocks API history). */
|
||
export type IotHistoryMetric =
|
||
| 'avgTemp'
|
||
| 'setPoint'
|
||
| 'humidity'
|
||
| 'outsideTemp'
|
||
| 'lux'
|
||
| 'wind'
|
||
| 'ammonia'
|
||
| 'co2'
|
||
| 'water'
|
||
| 'temp1'
|
||
| 'temp2'
|
||
| 'temp3'
|
||
| IotDeviceHistoryMetric;
|
||
|
||
/** One time-series sample for IoT history modals. */
|
||
export type IotSensorHistoryPoint = {
|
||
atMs: number;
|
||
value: number;
|
||
};
|
||
|
||
/** Device 24h chart: setpoint (°C) and on/off status (0 | 1) on one timeline. */
|
||
export type IotDeviceHistoryPoint = {
|
||
atMs: number;
|
||
setpoint: number | null;
|
||
status: number | null;
|
||
};
|
||
|
||
/** @deprecated Use {@link IotDeviceHistoryPoint} */
|
||
export type IotFanHistoryPoint = IotDeviceHistoryPoint;
|
||
|
||
/** @deprecated Use {@link IotDeviceHistoryPoint} */
|
||
export type IotFan1HistoryPoint = IotDeviceHistoryPoint;
|
||
|
||
export type IotComputedDashboard = {
|
||
datetime: string;
|
||
dashboardTitle: string;
|
||
deviceName: string;
|
||
avgTemp: string;
|
||
setPoint: string;
|
||
experienceTemp: string;
|
||
experienceActiveFanCount: number;
|
||
experienceWindSpeed: string;
|
||
experienceHumidityAdjustment: string;
|
||
experienceChillEffect: string;
|
||
chillFactor: string;
|
||
chillFactorValue: number | null;
|
||
dayAgeValue: number | null;
|
||
temp1: string;
|
||
temp2: string;
|
||
temp3: string;
|
||
humidity: string;
|
||
outsideTemp: string;
|
||
dayAge: string;
|
||
ammonia: string;
|
||
co2: string;
|
||
water: string;
|
||
wind: string;
|
||
lux: string;
|
||
inverterLabel: string;
|
||
coopName: string;
|
||
fanDevices: IotDeviceRow[];
|
||
hvacDevices: IotDeviceRow[];
|
||
/** True when live humidity % exceeds `humidityAlarmNilai` threshold from tabelalarm. */
|
||
humidityAlarmHighlight: boolean;
|
||
/** True when mapped live temp is at/above `batasAtasNilai` from tabelalarm. */
|
||
avgTempAlarmHighlight: boolean;
|
||
temp1AlarmHighlight: boolean;
|
||
temp2AlarmHighlight: boolean;
|
||
temp3AlarmHighlight: boolean;
|
||
};
|