---
sidebar_position: 0
---

# nmc

The `sos.native.nmc` API groups together methods for controlling WebOs devices using NMC commands.

:::warning
This API is currently available on WebOs devices only.
:::

<details>
    <summary>NMC Management Capabilities</summary>
		| Capability | Description |
		|:------------|:-------------|
		| `NATIVE_COMMANDS_NMC` | If device supports performing NMC commands |

		If you want to check if the device supports this capability, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
</details>

## Methods

### sendOne()

The `sendOne()` method sends an NMC command to another WebOS device on the same network or to the localhost.

```ts expandable
sendOne(ipAddress: IpAddressType, command: typeof NmcCommands, data: string[] | [
]): Promise<INMCResponse>;
// show-more
interface INMCResponse {
    type: 'ACK' | 'NACK';
    commandType: string[];
    result: number;
}

const NmcCommands = [
	['k', 'a'], // Power
	['k', 'b'], // Input Select
	['k', 'c'], // Aspect Ratio
	['k', 'd'], // Screen Mute
	['k', 'e'], // Volume Mute
	['k', 'f'], // Volume Control
	['k', 'g'], // Contrast
	['k', 'h'], // Brightness
	['k', 'i'], // Color
	['k', 'j'], // Tint
	['k', 'k'], // Sharpness
	['k', 'l'], // OSD Select
	['k', 'm'], // Remote Lock/Key Lock
	['k', 't'], // Balance
	['k', 'u'], // Color Temperature
	['k', 'z'], // Abnormal state
	['j', 'p'], // ISM mode
	['j', 'u'], // Auto configuration
	['m', 'c'], // Key
	['d', 'd'], // Tile Mode
	['d', 'e'], // Tile H Position
	['d', 'f'], // Tile V Position
	['d', 'g'], // Tile H Size
	['d', 'h'], // Tile V Size
	['d', 'i'], // Tile ID Set
	['d', 'j'], // Natural Mode (In Tile mode)
	['d', 'x'], // Picture Mode (PSM)
	['d', 'y'], // Sound Mode
	['d', 'w'], // Fan Fault check
	['d', 'l'], // Elapsed time return
	['d', 'n'], // Temperature value
	['d', 'd'], // Lamp fault check
	['d', 'u'], // Auto Volume
	['d', 'v'], // Speak
	['f', 'a'], // Time
	['f', 'd'], // On Timer(On/Off Timer)Time
	['f', 'e'], // Off Timer(On/Off Timer) Time
	['f', 'u'], // Scheduling Input Select
	['f', 'f'], // Sleep Time
	['f', 'g'], // Auto Sleep
	['f', 'h'], // Power On Delay
	['f', 'i'], // Language
	['f', 'j'], // DPM Select
	['f', 'k'], // Reset
	['f', 'l'], // Power Saving
	['f', 'o'], // Power Indicator
	['f', 'p'], // Logo Indicator
	['f', 'y'], // Serial no
	['f', 'z'], // S/W Version
	['x', 'b'], // Input Select
	['f', '#'], // USB Connection Check
	['f', '#'], // USB File List Count.
	['f', '#'], // USB Get File Info.
	['f', '#'], // USB Media Control
	['f', '#'], // USB Add Play List
	['f', '#'], // USB Add Schedule
	['f', '#'], // USB Set Schedule
][0];

```

#### Params

| Name        | Type                 | Required         | Description                                                        |
|-------------|----------------------|------------------|--------------------------------------------------------------------|
| `ipAddress` | `string`             |  <div>Yes</div>  | The IP address of the device to send the command to.               |
| `command`   | `typeof NmcCommands` |  <div>Yes</div>  | The NMC command to send. See `NmcCommands` for available commands. |
| `data`      | `string[] \| []`     |  <div>Yes</div>  | The optional data to send with the command.                        |

#### Return value

NMC response object containing the result of the command execution.

#### Possible errors


- If the `ipAddress` is not a valid string or if the `command` is not a valid number.
- If the `data` is not an array of strings.
- If any error occurs during the command execution.

#### Example

```ts
// Send a command to a WebOS device at IP address for menu open
await sos.native.nmc.sendOne('192.168.0.10', ['m','c'], ['43']);

// Send a command to a WebOS device at IP address for device power on
await sos.native.nmc.sendOne('192.168.0.10', ['k', 'a'], ['1']);
```