# Daikin Air Conditioner Control Options

This document describes all controllable options available for Daikin air conditioners when using the daikin-ts library.

## Important Notes

### API Endpoints

The library uses the following endpoints to interact with Daikin devices:

- **Get Control Info**: `GET /aircon/get_control_info`
- **Set Control Info**: `GET /aircon/set_control_info` (with query parameters)

### Temperature Format

When setting temperature (`stemp`), always use decimal format with `.0`:

```typescript
// ✅ Correct - use decimal format
await device.set({ stemp: '22.0' });

// ❌ Wrong - may not work
await device.set({ stemp: '22' });
```

The device expects values like `"22.0"` not `"22"`. This is because the internal API uses the format from `dt<X>` values (e.g., `dt3` for cool mode).

### How Settings Work

The `device.set()` method:
1. Fetches current control info from `aircon/get_control_info`
2. Merges new settings with current values
3. Sets power to ON if mode is changed (unless mode is "off")
4. Sends all parameters to `aircon/set_control_info`

## Table of Contents

- [Basic Control](#basic-control)
- [Temperature Control](#temperature-control)
- [Fan Control](#fan-control)
- [Advanced Modes](#advanced-modes)
- [Holiday Mode](#holiday-mode)
- [Streamer](#streamer)
- [Device Properties](#device-properties)

---

## Basic Control

### Power On/Off

| Setting | Values | Description |
|---------|--------|-------------|
| `pow` | `0`, `1` | Power state (0=off, 1=on) |

**Example:**
```typescript
await device.set({ pow: '1' });  // Turn on
await device.set({ pow: '0' });  // Turn off
```

### Operation Mode

| Setting | Daikin Value | Human Value | Description |
|---------|--------------|-------------|-------------|
| `mode` | `0` | `auto` | Automatic mode |
| `mode` | `1` | `auto-1` | Auto mode (variant) |
| `mode` | `2` | `dry` | Dry mode |
| `mode` | `3` | `cool` | Cooling mode |
| `mode` | `4` | `hot` / `heat` | Heating mode |
| `mode` | `6` | `fan` | Fan only mode |
| `mode` | `7` | `auto-7` | Auto mode (variant) |
| `mode` | `10` | `off` | Off mode |

**Example:**
```typescript
await device.set({ mode: 'cool' });
await device.set({ mode: 'heat' });
await device.set({ mode: 'auto' });
await device.set({ mode: 'dry' });
await device.set({ mode: 'fan' });
await device.set({ mode: 'off' });
```

---

## Temperature Control

### Target Temperature (`stemp`)

| Parameter | Values | Description |
|-----------|--------|-------------|
| `stemp` | `10` - `41` | Target temperature in Celsius |
| `stemp` | `M` | Maximum temperature |
| `stemp` | `H` | Not typically used |

**Example:**
```typescript
// Set target to 22°C
await device.set({ stemp: '22' });

// Set to maximum (H) or minimum (L) - check device support
await device.set({ stemp: 'M' });
```

### Target Humidity (`shum`)

| Parameter | Values | Description |
|-----------|--------|-------------|
| `shum` | `0` - `100` | Target humidity percentage |

**Example:**
```typescript
await device.set({ shum: '50' });  // Set target humidity to 50%
```

---

## Fan Control

### Fan Rate (`f_rate`)

| Daikin Value | Human Value | Description |
|--------------|-------------|-------------|
| `A` | `auto` | Automatic fan speed |
| `B` | `silence` | Silent operation |
| `3` | `1` | Fan speed 1 (lowest) |
| `4` | `2` | Fan speed 2 |
| `5` | `3` | Fan speed 3 |
| `6` | `4` | Fan speed 4 |
| `7` | `5` | Fan speed 5 (highest) |

**Example:**
```typescript
await device.set({ f_rate: 'auto' });
await device.set({ f_rate: 'silence' });
await device.set({ f_rate: '3' });  // Fan speed 3
```

### Fan Direction (`f_dir`)

| Daikin Value | Human Value | Description |
|--------------|-------------|-------------|
| `0` | `off` | No swing |
| `1` | `vertical` | Vertical swing (up/down) |
| `2` | `horizontal` | Horizontal swing (left/right) |
| `3` | `3d` | 3D swing (combined) |

**Example:**
```typescript
await device.set({ f_dir: 'off' });
await device.set({ f_dir: 'vertical' });
await device.set({ f_dir: 'horizontal' });
await device.set({ f_dir: '3d' });
```

---

## Advanced Modes

### Powerful Mode

Increases heating/cooling power for faster temperature adjustment.

```typescript
await device.setAdvancedMode('powerful', 'on');   // Enable
await device.setAdvancedMode('powerful', 'off');  // Disable
```

### Econo Mode

Reduces power consumption (useful for energy saving).

```typescript
await device.setAdvancedMode('econo', 'on');   // Enable
await device.setAdvancedMode('econo', 'off');  // Disable
```

---

## Holiday Mode

Sets the device to holiday/away mode, maintaining minimal operation.

```typescript
await device.setHoliday('on');   // Enable holiday mode
await device.setHoliday('off');  // Disable holiday mode
```

---

## Streamer

The Daikin Streamer is an air purifying technology.

```typescript
await device.setStreamer('on');   // Enable streamer
await device.setStreamer('off');  // Disable streamer
```

---

## Device Properties

### Read-Only Properties

| Property | Type | Description |
|----------|------|-------------|
| `mac` | `string` | Device MAC address |
| `baseUrl` | `string` | Base URL of the device |
| `deviceIp` | `string` | IP address of the device |
| `outsideTemperature` | `number \| null` | Outside temperature |
| `insideTemperature` | `number \| null` | Inside temperature |
| `targetTemperature` | `number \| null` | Target temperature |
| `humidity` | `number \| null` | Current humidity |
| `targetHumidity` | `number \| null` | Target humidity |
| `compressorFrequency` | `number \| null` | Compressor frequency |

### Support Flags

| Property | Type | Description |
|----------|------|-------------|
| `supportAwayMode` | `boolean` | Supports holiday/away mode |
| `supportFanRate` | `boolean` | Supports fan rate control |
| `supportSwingMode` | `boolean` | Supports swing mode |
| `supportOutsideTemperature` | `boolean` | Has outside temperature sensor |
| `supportHumidity` | `boolean` | Supports humidity control |
| `supportAdvancedModes` | `boolean` | Supports powerful/econo modes |
| `supportCompressorFrequency` | `boolean` | Reports compressor frequency |
| `supportFilterDirty` | `boolean` | Reports filter status |
| `supportZoneCount` | `boolean` | Supports zones (AirBase) |
| `supportEnergyConsumption` | `boolean` | Reports energy consumption |

### Methods

| Method | Description |
|--------|-------------|
| `init()` | Initialize device and fetch status |
| `updateStatus()` | Refresh device status |
| `set(settings)` | Apply settings |
| `setHoliday(mode)` | Set holiday mode |
| `setAdvancedMode(mode, value)` | Set advanced mode |
| `setStreamer(mode)` | Set streamer |
| `showValues()` | Display all values |

---

## Complete Example

```typescript
import { DaikinFactory } from './src/factory.js';

// Connect to device
const device = await DaikinFactory('192.168.1.100', { key: 'YOUR_KEY' });

// Turn on and set to cool mode at 22°C
await device.set({
  mode: 'cool',
  stemp: '22',
  f_rate: 'auto',
  f_dir: 'off'
});

// Enable powerful mode for fast cooling
await device.setAdvancedMode('powerful', 'on');

// Check current status
console.log(`Inside: ${device.insideTemperature}°C`);
console.log(`Target: ${device.targetTemperature}°C`);
console.log(`Mode: ${device.values.get('mode')}`);
```

---

## Device Type Specific Notes

- **BRP069**: Standard device, full control support
- **BRP084**: Firmware 2.8.0+, similar to BRP069
- **BRP072C**: Uses HTTPS with legacy SSL (requires special configuration)
- **AirBase**: Supports zones (multiple room control)
- **SkyFi**: Legacy device with limited features
