# homebridge-web-rgb

> Homebridge plugin for a web-based RGB device

Latest version **1.4.4** (published 2022-01-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install homebridge-web-rgb
pnpm add homebridge-web-rgb
yarn add homebridge-web-rgb
bun add homebridge-web-rgb
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.4 |
| Published | 2022-01-17 |
| First published | 2021-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.13.0 |
| Dependencies | 3 |
| Unpacked size | 22.1 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 8 |
| Author | phenotypic |
| Maintainers | phenotypic |
| Keywords | homebridge-plugin |

## Links

- npm: https://www.npmjs.com/package/homebridge-web-rgb
- Repository: https://github.com/phenotypic/homebridge-web-rgb
- Homepage: https://github.com/phenotypic/homebridge-web-rgb#readme
- Issues: https://github.com/phenotypic/homebridge-web-rgb/issues
- npm.io page: https://npm.io/package/homebridge-web-rgb

## Dependencies (3)

- [ip](https://npm.io/package/ip.md) >=1.1.5
- [request](https://npm.io/package/request.md) >=2.88.0
- [color-convert](https://npm.io/package/color-convert.md) >=2.0.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.4.4 (latest) — 2022-01-17
- 1.4.3 — 2022-01-11
- 1.4.2 — 2021-12-31
- 1.4.1 — 2021-12-29

## README

<p align="center">
  <a href="https://github.com/homebridge/homebridge"><img src="https://raw.githubusercontent.com/homebridge/branding/master/logos/homebridge-color-round-stylized.png" height="140"></a>
</p>

<span align="center">

# homebridge-web-rgb

[![npm](https://img.shields.io/npm/v/homebridge-web-rgb.svg)](https://www.npmjs.com/package/homebridge-web-rgb) [![npm](https://img.shields.io/npm/dt/homebridge-web-rgb.svg)](https://www.npmjs.com/package/homebridge-web-rgb)

</span>

## Description

This [homebridge](https://github.com/homebridge/homebridge) plugin exposes a web-based RGB device to Apple's [HomeKit](http://www.apple.com/ios/home/). Using simple HTTP requests, the plugin allows you to turn on/off the light as well as control its color, color temperature, and brightness.

Find script samples for the RGB controller in the _examples_ folder.

## Installation

1. Install [homebridge](https://github.com/homebridge/homebridge#installation)
2. Install this plugin: `npm install -g homebridge-web-rgb`
3. Update your `config.json` file

## Configuration

```json
"accessories": [
     {
       "accessory": "HTTP-RGB",
       "name": "RGB strip",
       "apiroute": "http://myurl.com"
     }
]
```

### Core
| Key | Description | Default |
| --- | --- | --- |
| `accessory` | Must be `HTTP-RGB` | N/A |
| `name` | Name to appear in the Home app | N/A |
| `apiroute` | Root URL of your device | N/A |

### Optional fields
| Key | Description | Default |
| --- | --- | --- |
| `disableColor` | Whether the color characteristic should be hidden | `false` |
| `disableBrightness` | Whether the brightness characteristic should be hidden | `false` |
| `colorTemperature` | Whether to expose the color temperature characteristic separately from the color characteristic | `false` |

### Additional options
| Key | Description | Default |
| --- | --- | --- |
| `pollInterval` | Time (in seconds) between device polls | `300` |
| `listener` | Whether to start a listener to get real-time changes from the device | `false` |
| `timeout` | Time (in milliseconds) until the accessory will be marked as _Not Responding_ if it is unreachable | `3000` |
| `port` | Port for your HTTP listener (if enabled) | `2000` |
| `http_method` | HTTP method used to communicate with the device | `GET` |
| `username` | Username if HTTP authentication is enabled | N/A |
| `password` | Password if HTTP authentication is enabled | N/A |
| `model` | Appears under the _Model_ field for the accessory | plugin |
| `serial` | Appears under the _Serial_ field for the accessory | apiroute |
| `manufacturer` | Appears under the _Manufacturer_ field for the accessory | author |
| `firmware` | Appears under the _Firmware_ field for the accessory | version |

## Examples

| Device type | Changes to `config.json` |
| --- | --- |
| RGB | N/A |
| RGBW/WW | N/A (API handles) |
| Cool/warm white | `"disableColor": true` |
| CCT | `"disableColor": true`, `"colorTemperature": true`|
| RBGCCT | `"colorTemperature": true`|

## API Interfacing

Your API should be able to:

1. Return JSON information when it receives `/status`:
```
{
    "currentState": INT_VALUE,
    "currentBrightness": INT_VALUE,
    "currentColor": "HEX_VALUE"
}
```

**Note:** You must also include the following fields in `/status` where relevant:

- `colorTemperature` (if `colorTemperature` is enabled)

2. Set the state when it receives:
```
/setState?value=BOOL_VALUE
```

3. Set the color when it receives:
```
/setColor?value=HEX_VALUE
```

4. Set the brightness when it receives:
```
/setBrightness?value=INT_VALUE
```

4. Set the color temperature when it receives: (if `colorTemperature` is enabled)
```
/setColorTemperature?value=INT_VALUE
```

### Optional (if listener is enabled)

1. Update `state` following a manual override by messaging the listen server:
```
/state?value=INT_VALUE
```

2. Update `color` following a manual override by messaging the listen server:
```
/color?value=HEX_VALUE
```

3. Update `brightness` following a manual override by messaging the listen server:
```
/brightness?value=INT_VALUE
```

3. Update `colorTemperature` following a manual override by messaging the listen server: (if `colorTemperature` is enabled)
```
/colorTemperature?value=INT_VALUE
```

---
_Source: https://npm.io/package/homebridge-web-rgb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
