homebridge-samsung-window-ac
Version:
Homebridge plugin for Samsung Window Air Conditioners
89 lines (88 loc) • 2.93 kB
TypeScript
import type { API, Characteristic, DynamicPlatformPlugin, Logging, PlatformAccessory, PlatformConfig, Service } from 'homebridge';
interface DeviceStatusResponse {
components: {
main: {
switch: {
switch: {
value: string;
timestamp: string;
};
};
temperatureMeasurement: {
temperature: {
value: number;
unit: string;
timestamp: string;
};
};
relativeHumidityMeasurement: {
humidity: {
value: number;
unit: string;
timestamp: string;
};
};
airConditionerMode: {
airConditionerMode: {
value: string;
timestamp: string;
};
};
thermostatCoolingSetpoint: {
coolingSetpoint: {
value: number;
unit: string;
timestamp: string;
};
};
};
};
}
/**
* HomebridgePlatform
* This class is the main constructor for your plugin, this is where you should
* parse the user config and discover/register accessories with Homebridge.
*/
export declare class SamsungWindowACPlatform implements DynamicPlatformPlugin {
readonly log: Logging;
readonly config: PlatformConfig;
readonly api: API;
readonly Service: typeof Service;
readonly Characteristic: typeof Characteristic;
readonly accessories: Map<string, PlatformAccessory>;
readonly discoveredCacheUUIDs: string[];
private tokenManager;
private deviceId;
constructor(log: Logging, config: PlatformConfig, api: API);
/**
* This function is invoked when homebridge restores cached accessories from disk at startup.
* It should be used to set up event handlers for characteristics and update respective values.
*/
configureAccessory(accessory: PlatformAccessory): void;
/**
* This method discovers Samsung Window AC devices.
* In a real implementation, you would discover devices from the local network or cloud services.
*/
discoverDevices(): Promise<void>;
/**
* Get device ID from SmartThings API
*/
private getDeviceId;
/**
* Get all device status from SmartThings API (single request)
*/
getDeviceStatus(): Promise<DeviceStatusResponse | null>;
/**
* Set target temperature via SmartThings API
*/
setTargetTemperature(temperature: number): Promise<boolean>;
/**
* Set air conditioner mode via SmartThings API
*/
setACMode(mode: string): Promise<boolean>;
/**
* Turn off air conditioner via SmartThings API
*/
turnOffAC(): Promise<boolean>;
}
export {};