Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43e3fdf35f | ||
|
|
d07d621e45 | ||
|
|
c8d117a894 | ||
|
|
9a6c9e681d | ||
|
|
0394d789f8 |
No files matched your search
@@ -29,32 +29,15 @@ This plugin currently supports the following services (and characteristics):
|
|||||||
| [Thermostat](#thermostat) | Thermostat with temperature sensor and heating state |
|
| [Thermostat](#thermostat) | Thermostat with temperature sensor and heating state |
|
||||||
| [WindowCovering](#window-covering) | Window covering (shutters, blinds, ...) |
|
| [WindowCovering](#window-covering) | Window covering (shutters, blinds, ...) |
|
||||||
|
|
||||||
Other accessories are being worked on and will be added as soon as ready.
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
* [SmartHomeNG](https://github.com/smarthomeNG/smarthome)
|
* [SmartHomeNG](https://github.com/smarthomeNG/smarthome)
|
||||||
* [homebridge](https://www.npmjs.com/package/homebridge)
|
* [Node.js >=14.18.1](https://nodejs.org/en/)
|
||||||
|
* [Homebridge](https://homebridge.io)
|
||||||
|
|
||||||
## Installation
|
## Installation of plugin
|
||||||
### Install nodejs >=14.18.1
|
|
||||||
See [NodeJS](https://nodejs.org/en/) website for details depending on your OS.
|
|
||||||
|
|
||||||
### Install libavahi-compat-libdnssd-dev lib
|
Use [Homebridge Config UI X](https://github.com/oznu/homebridge-config-ui-x#readme) or install manually using ```npm install -g homebridge-smarthomeng```
|
||||||
For me i needed these libraries to be installed for my homebridge to work. See their [Homepage](https://homebridge.io) for installation instructions.
|
|
||||||
Below is what i did on my Debian Bullseye installation:
|
|
||||||
|
|
||||||
|
|
||||||
sudo apt install libavahi-compat-libdnssd-dev
|
|
||||||
|
|
||||||
|
|
||||||
### Install homebridge >=1.3.5 from NPM repository
|
|
||||||
|
|
||||||
npm install -g homebridge --unsafe-perm
|
|
||||||
|
|
||||||
|
|
||||||
### Install this plugin from NPM repository
|
|
||||||
|
|
||||||
npm install -g homebridge-smarthomeng --unsafe-perm
|
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
@@ -63,13 +46,13 @@ If you already have a working homebridge installation just add the platform sect
|
|||||||
### Platform configuration
|
### Platform configuration
|
||||||
The following parameters are available to configure the plugin as platform in homebridge.
|
The following parameters are available to configure the plugin as platform in homebridge.
|
||||||
|
|
||||||
| Parameter | Possible values | Mandatory | Description |
|
| Parameter | Possible values | Mandatory | Default | Description |
|
||||||
|:----------|:---------------------------------------|:----------|:----------------------------------------------------|
|
|:----------|:---------------------------------------|:----------|:--------|:------------------------------------|
|
||||||
| platform | Any \<string> | Yes | Internal name of your platform |
|
| platform | Any \<string> | Yes | | Internal name of your platform |
|
||||||
| name | Any \<string> | Yes | Visible name in HomeKit |
|
| name | Any \<string> | Yes | | Visible name in HomeKit |
|
||||||
| host | IP address or FQDN of your SHNG server | Yes | Your SHNG host |
|
| host | IP address or FQDN of your SHNG server | Yes | | Your SHNG host |
|
||||||
| port | Port \<number> | No | Listening port of websocket module. Default is 2424 |
|
| port | Port \<number> | No | 2424 | Listening port of websocket module. |
|
||||||
| tls | \<boolean> | No | Should TLS encryption be used. Defaults is 'false' |
|
| tls | \<boolean> | No | False | Should TLS encryption be used. |
|
||||||
|
|
||||||
#### Example configuration:
|
#### Example configuration:
|
||||||
```json
|
```json
|
||||||
@@ -160,11 +143,11 @@ For now this accessory only supports turning the fan on and off. Further improve
|
|||||||
This accessory is used for opening/closing garage doors or any other automatic gate.
|
This accessory is used for opening/closing garage doors or any other automatic gate.
|
||||||
|
|
||||||
#### Characteristics in addition to [common characteristics](#common-accessories-characteristics)
|
#### Characteristics in addition to [common characteristics](#common-accessories-characteristics)
|
||||||
| Parameter | Possible values | Mandatory | Default | Description |
|
| Parameter | Possible values | Mandatory | Description |
|
||||||
|:---------------------------|:----------------|:----------|:--------|:------------------------------------------------------------------|
|
|:--------------------|:----------------|:----------|:------------------------------------------------------------------|
|
||||||
| CurrentDoorState | \<item> | Yes | | SHNG item to monitor the current door state |
|
| CurrentDoorState | \<item> | Yes | SHNG item to monitor the current door state |
|
||||||
| TargetDoorState | \<item> | Yes | | SHNG item to monitor and set the target position |
|
| TargetDoorState | \<item> | Yes | SHNG item to monitor and set the target position |
|
||||||
| ObstructionDetected | \<item> | No | | SHNG item to monitor if the door is blocked |
|
| ObstructionDetected | \<item> | No | SHNG item to monitor if the door is blocked |
|
||||||
|
|
||||||
#### Additional comments
|
#### Additional comments
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"private": false,
|
"private": false,
|
||||||
"displayName": "SmartHomeNG",
|
"displayName": "SmartHomeNG",
|
||||||
"name": "homebridge-smarthomeng",
|
"name": "homebridge-smarthomeng",
|
||||||
"version": "2.0.5",
|
"version": "2.0.6",
|
||||||
"description": "SmartHomeNG plugin for Homebridge",
|
"description": "SmartHomeNG plugin for Homebridge",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
+92
-89
@@ -75,97 +75,100 @@ export class SmartHomeNGPlatform implements StaticPlatformPlugin {
|
|||||||
|
|
||||||
// convert all configured accessory keys to lowercase to tolerate user case errors
|
// convert all configured accessory keys to lowercase to tolerate user case errors
|
||||||
const accessories = JSON.parse(JSON.stringify(uncapitalizeKeys(this.config.accessories)));
|
const accessories = JSON.parse(JSON.stringify(uncapitalizeKeys(this.config.accessories)));
|
||||||
|
this.log.debug(accessories);
|
||||||
for (const accessory of accessories) {
|
if (Object.keys(accessories).length > 0) {
|
||||||
if (!accessory.manufacturer) {
|
for (const accessory of accessories) {
|
||||||
accessory.manufacturer = 'SmartHomeNG';
|
if (!accessory.manufacturer) {
|
||||||
}
|
accessory.manufacturer = 'SmartHomeNG';
|
||||||
if (!accessory.model) {
|
}
|
||||||
accessory.model = 'SHNG Item';
|
if (!accessory.model) {
|
||||||
}
|
accessory.model = 'SHNG Item';
|
||||||
|
}
|
||||||
if (accessory.type !== '') {
|
|
||||||
this.log.info('Parsing accessory:', accessory.name, 'of type', accessory.type);
|
if (accessory.type !== '') {
|
||||||
// set lo lowercase to ignore user case errors
|
this.log.info('Parsing accessory:', accessory.name, 'of type', accessory.type);
|
||||||
switch (accessory.type.toLowerCase()) {
|
// set lo lowercase to ignore user case errors
|
||||||
|
switch (accessory.type.toLowerCase()) {
|
||||||
// Presence sensor
|
|
||||||
case 'occupancysensor':
|
// Presence sensor
|
||||||
devices.push(new OccupancySensor(this, accessory));
|
case 'occupancysensor':
|
||||||
break;
|
devices.push(new OccupancySensor(this, accessory));
|
||||||
// Motion sensor
|
break;
|
||||||
case 'motionsensor':
|
// Motion sensor
|
||||||
devices.push(new MotionSensor(this, accessory));
|
case 'motionsensor':
|
||||||
break;
|
devices.push(new MotionSensor(this, accessory));
|
||||||
|
break;
|
||||||
// Contact sensor
|
|
||||||
case 'contactsensor':
|
// Contact sensor
|
||||||
devices.push(new ContactSensor(this, accessory));
|
case 'contactsensor':
|
||||||
break;
|
devices.push(new ContactSensor(this, accessory));
|
||||||
|
break;
|
||||||
// Doorbell
|
|
||||||
case 'doorbell':
|
// Doorbell
|
||||||
devices.push(new Doorbell(this, accessory));
|
case 'doorbell':
|
||||||
break;
|
devices.push(new Doorbell(this, accessory));
|
||||||
|
break;
|
||||||
// Security system
|
|
||||||
case 'securitysystem':
|
// Security system
|
||||||
devices.push(new SecuritySystem(this, accessory));
|
case 'securitysystem':
|
||||||
break;
|
devices.push(new SecuritySystem(this, accessory));
|
||||||
|
break;
|
||||||
// Switch
|
|
||||||
case 'switch':
|
// Switch
|
||||||
devices.push(new Switch(this, accessory));
|
case 'switch':
|
||||||
break;
|
devices.push(new Switch(this, accessory));
|
||||||
|
break;
|
||||||
// Lightbulb
|
|
||||||
case 'lightbulb':
|
// Lightbulb
|
||||||
devices.push(new Lightbulb(this, accessory));
|
case 'lightbulb':
|
||||||
break;
|
devices.push(new Lightbulb(this, accessory));
|
||||||
|
break;
|
||||||
// Outlet
|
|
||||||
case 'outlet':
|
// Outlet
|
||||||
devices.push(new Outlet(this, accessory));
|
case 'outlet':
|
||||||
break;
|
devices.push(new Outlet(this, accessory));
|
||||||
|
break;
|
||||||
// Fan (uses Fanv2)
|
|
||||||
case 'fan':
|
// Fan (uses Fanv2)
|
||||||
devices.push(new Fan(this, accessory));
|
case 'fan':
|
||||||
break;
|
devices.push(new Fan(this, accessory));
|
||||||
|
break;
|
||||||
// Temperature sensor
|
|
||||||
case 'temperaturesensor':
|
// Temperature sensor
|
||||||
devices.push(new TemperatureSensor(this, accessory));
|
case 'temperaturesensor':
|
||||||
break;
|
devices.push(new TemperatureSensor(this, accessory));
|
||||||
|
break;
|
||||||
// Thermostat
|
|
||||||
case 'thermostat':
|
// Thermostat
|
||||||
devices.push(new Thermostat(this, accessory));
|
case 'thermostat':
|
||||||
break;
|
devices.push(new Thermostat(this, accessory));
|
||||||
|
break;
|
||||||
// WindowCovering
|
|
||||||
case 'windowcovering':
|
// WindowCovering
|
||||||
devices.push(new WindowCovering(this, accessory));
|
case 'windowcovering':
|
||||||
break;
|
devices.push(new WindowCovering(this, accessory));
|
||||||
|
break;
|
||||||
// Garage door
|
|
||||||
case 'garagedoor':
|
// Garage door
|
||||||
devices.push(new GarageDoor(this, accessory));
|
case 'garagedoor':
|
||||||
break;
|
devices.push(new GarageDoor(this, accessory));
|
||||||
|
break;
|
||||||
// Humidity sensor
|
|
||||||
case 'humiditysensor':
|
// Humidity sensor
|
||||||
devices.push(new HumiditySensor(this, accessory));
|
case 'humiditysensor':
|
||||||
break;
|
devices.push(new HumiditySensor(this, accessory));
|
||||||
|
break;
|
||||||
// Show error for (yet ?) unsupported device
|
|
||||||
default:
|
// Show error for (yet ?) unsupported device
|
||||||
this.log.warn('Accessory type', accessory.type, 'for', accessory.name, 'not recognized !');
|
default:
|
||||||
break;
|
this.log.warn('Accessory type', accessory.type, 'for', accessory.name, 'not recognized !');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.log.warn('Ignoring accessory (no type given): ' + accessory);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.log.warn('Ignoring accessory (no type given): ' + accessory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
callback(devices);
|
callback(devices);
|
||||||
this.log.debug('Finished building accessories list');
|
this.log.debug('Finished building accessories list');
|
||||||
|
|||||||
Reference in new issue
Block a user