homebridge-unipi-ng
v1.1.4
Published
Unipi Neuron NG Plugin for Homebridge. A new version of the original homebridge-unipi plugin.
Downloads
319
Maintainers
Readme
Homebridge Unipi NG
Why
I originally developed the homebridge-unipi plugin to control my Unipi Neuron board with HomeKit. While the plugin worked well for many years, it was based on an older Homebridge version and the code could be cleaner. It was also missing some features that I wanted to add. So... time for a rewrite.
What is different
- The plugin is now based on the latest Homebridge version
- The plugin only exposes the devices that you actually configure in the config.json file
- The plugin is cleaner and written in Typescript
- The plugin supports different 'virtual' devices, like lights, fans, ...
- Devices can optionally derive their state from a unipi output
- Devices can target a Unipi output directly or in 'pulse' mode
- Devices can BOTH derive their state and target and output. For example to be able to determine the state of a light after power loss.
- The plugin supports multiple Unipi boards
- Works with HomeAssistant and possibly other platforms.
- Push buttons are exposed as singular accessories, instead of services on the main accessory. This is because Home Assistant does not support previous multi-service old setup.
- The plugin supports a 'debug' option to log all messages from a specific device. This can be useful to determine the correct configuration for a device.
- The plugin supports a 'disabled' option for devices. This can be useful to temporarily disable a device without removing it from the configuration.
- The plugin will by default create virtual evok 'monitoring' circuits that are fake inputs that will reflect the input state. This way, even if the device state is changed from another UniPi integration, the state will be reflected in the HomeKit interface.
- Support for timer devices. These devices are shown as switches, and can be triggered (started) manually, by homekit or by an evok trigger.
- Support for 'monitor' devices. These devices are shown as switches, and can be used to derive the state of an output device from an input device. They can also trigger a homekit event, or an evok target device.
What is the same
- Buttons can easily toggle other devices (lights, lamps, ...)
- Devices mapped to a UniPi output can either be toggled directly using the output state or in 'pulse' mode, where the output is pulsed for a short time in order to toggle a pulse relay.
- Buttons support single, long and double press actions
Release history
Use with Home Assistant
In Home Assistant, add a new 'Homekit Device' integration. Configure the integration with the Homebridge pin code and optionally the IP and port. Home Assistant will likely detect the integration and propose pairing with it.
Installation
- Install the plugin using
npm -g install homebridge-unipi-ng
ornpm install homebridge-unipi-ng
- Add the plugin to your Homebridge config.json file. Note that you should disregards the sample bridge in the config below.
I do however recommend that you use the
ciao
advertiser.
{
"bridge": { // Keep what you have here
"name": "Example Unipi NG Bridge",
"username": "01:02:03:04:05:06",
"port": 54321,
"pin": "123-45-678",
"advertiser": "ciao"
},
"accessories": [],
"platforms": [
{ // This is the block you should add
"id": "unique-platform-id", // A unique id for this platform
"platform": "UnipiNGPlatform", // The platform type (exact)
"name": "Unipi NG Platform", // The name of the platform
"devices": [ // The list of the devices to expose
{
"id": "neuron-1", // A unique id for this device
"disabled": false, // By default, not disabled. Use for devices that you want to disable.
"manufacturer": "UniPi", // Optional manufacturer
"model": "Neuron M203", // Optional model
"serial": "140", // Optional serial
"name": "UniPi Neuron 1", // Display name
"type": "evok", // Required for the Unipi devices
"options": { // Options for the device
"url": "ws://192.168.86.252/ws", // Websocket URL to the Unipi device
"debug": [ // Debug options. Will log an evok message if all properties match
{ // Example: Log all messages from inputs
"dev": "input"
},
{ // Example: Log all messages from relay 2_01
"dev": "relay",
"circuit": "2_01"
}
]
}
},
{ // A light. Targets the relay 2_02 on neuron-1 for switching. Maintains own state.
"id": "light-bathroom",
"name": "Bathroom lights",
"type": "light",
"manufacturer": "MiBoxer",
"target": {
"pulse": true,
"evok": "neuron-1",
"dev": "relay",
"circuit": "2_02"
}
},
{ // A light. Targets the relay 2_02 on neuron-1 for switching. Reads state from input 1_02.
"id": "light-hallway",
"name": "Hallway lights",
"type": "light",
"manufacturer": "MiBoxer",
"source": {
"evok": "neuron-1",
"dev": "input",
"circuit": "1_02"
},
"target": {
"pulse": true,
"evok": "neuron-1",
"dev": "relay",
"circuit": "2_02"
}
},
{ // Shows the state of User LED 1 as a light (disabled)
"id": "led-user-1",
"disabled": true,
"manufacturer": "UniPi",
"model": "Neuron",
"serial": "Not set",
"name": "User LED One",
"type": "light",
"source": {
"evok": "neuron-1",
"dev": "led",
"circuit": "1_01"
}
},
{ // A fan. Targets the relay 2_01 on neuron-1 for switching. Maintains own state.
"id": "fan-bathroom",
"name": "Badkamer Ventilator",
"type": "fan",
"target": {
"pulse": true,
"evok": "neuron-1",
"dev": "relay",
"circuit": "2_01"
}
},
{ // A push button
"id": "button-hallway-lights",
"name": "Button for hallway lights",
"manufacturer": "Niko",
"type": "button",
"source": {
"evok": "neuron-1",
"dev": "input",
"circuit": "1_01"
}
},
{
"id": "switch-something",
"name": "A switch that controls something (unknown)",
"manufacturer": "MiBoxer",
"type": "switch",
"target": {
"pulse": false,
"evok": "neuron-1",
"dev": "relay",
"circuit": "2_04"
}
}
],
"platform": "UnipiNGPlatform"
}
]
}