Skip to content

Commit

Permalink
[Release] v2.3.0 Fixes and improvements (#24)
Browse files Browse the repository at this point in the history
* fix thermo and dehumidifier update

* fix dehumidifier active state

* Add humidity sensor

* Fix NPE

* return sensor too

* Add temperature sensor

* update deps

* Use new client (auto discover hub on network)

* Don't check config

* Fix active/inactive

* Update README.md

* Map dehumidifiers with thermostat

* Fix NPE

* Use only one class for thermostats and dehumidifiers

* Fix NPE

* Status adjustments

* test

* test 2

* Update active statue for dehumidifier

* Update dependencies
  • Loading branch information
madchicken authored Aug 18, 2020
1 parent bef2392 commit 84df3b3
Show file tree
Hide file tree
Showing 8 changed files with 563 additions and 523 deletions.
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ Add the following section to the platform array in the Homebridge config.json fi
"platform": "Comelit",
"name": "Comelit",
"username": "YOUR_USERNAME",
"password": "YOUR_PASSWORD",
"broker_url": "mqtt://192.168.1.2"
"password": "YOUR_PASSWORD"
}
```

By default username and password are both set to `admin`.
`broker_url` is the `mqtt://` + the IP/name of your HUB in the local network.
By default, username and password are both set to `admin`.
You can also provide the `broker_url` as config parameter, that is the HUB IP address on your network,
or leave it empty and let the plugin auto discover the HUB for you.

## Find the broker URL

Expand All @@ -62,8 +62,7 @@ You should get an output like this:
Found hardware IcoM MAC XXXXXXXXXXXX, app Mngr version 3.0.1, system id ViP_, IcoM - at IP [X.X.X.X]
Found hardware D407 MAC XXXXXXXXXXXX, app HSrv version 1.2.0, system id ViP_, Home server - Comelit Hub 1 at IP [X.X.X.X]

Hit CTRL+C to interrupt the scan command.
The IP you are looking for is the `Home server` one.
The IP you are looking for is the `app HSrv` one.

## VEDO alarm support

Expand All @@ -73,6 +72,7 @@ VEDO alarm supported has been moved to a separate plugin: https://github.com/mad

The plugin offers some extra configuration flag. Here is the list

- broker_url: string - IP of your HUB (optional)
- sentry_dsn: string - DSN for Sentry monitoring (see https://sentry.com)
- blind_closing_time: number - number of seconds your blinds take to go from fully open to fully closed (default 35)
- keep_alive?: number - number of seconds for the MQTT keep alive message
Expand Down Expand Up @@ -106,6 +106,23 @@ To enable metrics, specify `export_prometheus_metrics: true` in the platform con
}
```

## Compiling from source

This plugin uses `yarn`, so you need to install it before starting (see https://yarnpkg.com for instructions).
Once you have it, just run

```
yarn && yarn build
```

inside the project folder.

## Contribute

Any help on this project is really welcome, so if you have some programming skill, and you want to improve
the current implementation, fork the repo and open your PR!
If otherwise, you simply enjoyed using this plugin, and you want to contribute in some way, you can always donate something!

## Version History

1.0.0 - Initial version
Expand All @@ -116,6 +133,7 @@ To enable metrics, specify `export_prometheus_metrics: true` in the platform con
1.1.0 - VEDO alarm support and various fixes
1.2.0 - Switch to use external comelit-client dependency
2.0.0 - Major update to support Homebridge 1.1.0
2.3.0 - Auto discover HUB

## Screenshots

Expand Down
15 changes: 6 additions & 9 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"default": "Comelit"
},
"broker_url": {
"title": "MQTT Broker URL",
"Description": "URL of the Comelit HUB on your private network. You can use the Comelit CLI tool to discover it",
"title": "MQTT Broker URL (Optional)",
"Description": "URL of the Comelit HUB on your private network. You can use the Comelit CLI tool to discover it or leave it empty for auto discovery",
"type": "string",
"required": true,
"default": "mqtt://192.168.0.66"
"required": false,
"default": ""
},
"hub_username": {
"title": "MQTT Broker Username",
Expand All @@ -35,12 +35,14 @@
},
"username": {
"title": "Username",
"description": "Username used to log into Comelit system",
"type": "string",
"required": true,
"default": ""
},
"password": {
"title": "Password",
"description": "Password used to log into Comelit system",
"type": "string",
"required": true,
"default": "",
Expand Down Expand Up @@ -81,11 +83,6 @@
"type": "boolean",
"default": false
},
"hide_dehumidifiers": {
"title": "Avoid mapping dehumidifiers",
"type": "boolean",
"default": false
},
"hide_power_suppliers": {
"title": "Avoid mapping different power supplier devices (controllo carichi)",
"type": "boolean",
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-comelit-platform",
"version": "2.2.0",
"version": "2.3.0",
"author": "Pierpaolo Follia",
"repository": {
"type": "git",
Expand All @@ -13,8 +13,8 @@
"comelit"
],
"engines": {
"node": ">8.15.1",
"homebridge": ">=0.4.5"
"node": ">12.13.0",
"homebridge": ">=1.1.0"
},
"main": "dist/index.js",
"files": [
Expand All @@ -29,7 +29,8 @@
"watch-ts": "tsc -w",
"lint": "tsc --noEmit && eslint \"src/*.{js,ts}\" --quiet --fix",
"prettier": "prettier --single-quote --trailing-comma es5 --write \"{src,__{tests,mocks}__}/**/*.ts\"",
"clean": "rimraf dist/"
"clean": "rimraf dist/",
"publish": "yarn build && yarn publish"
},
"husky": {
"hooks": {
Expand All @@ -39,27 +40,27 @@
"dependencies": {
"@sentry/node": "5.12.2",
"async-mqtt": "^2.6.1",
"comelit-client": "1.7.2",
"comelit-client": "1.7.5",
"express": "^4.17.1",
"lodash": "^4.17.15",
"lodash": "^4.17.19",
"mqtt": "^4.1.0",
"mqtt-packet": "^6.3.2",
"prom-client": "^12.0.0",
"typescript": "^3.7.4"
"typescript": "^3.9.7"
},
"devDependencies": {
"@types/express": "^4.17.2",
"@types/jest": "^25.2.3",
"@types/lodash": "^4.14.149",
"@types/mqtt": "^2.5.0",
"@types/node": "^11.15.3",
"@types/jest": "^25.2.3",
"@typescript-eslint/eslint-plugin": "^2.14.0",
"@typescript-eslint/parser": "^2.14.0",
"hap-nodejs": "^0.7.3",
"homebridge": "^1.1.0",
"eslint": "^6.4.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-prettier": "^3.1.2",
"hap-nodejs": "^0.7.7",
"homebridge": "^1.1.0",
"husky": "^4.2.3",
"jest": "^24.9.0",
"nock": "^12.0.2",
Expand Down
157 changes: 0 additions & 157 deletions src/accessories/dehumidifier.ts

This file was deleted.

6 changes: 5 additions & 1 deletion src/accessories/power-supplier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export class PowerSupplier extends ComelitAccessory<SupplierDeviceData> {
}

protected initServices(): Service[] {
return [this.initAccessoryInformation()];
const powerManagementService =
this.accessory.getService(this.platform.Service.PowerManagement) ||
this.accessory.addService(this.platform.Service.PowerManagement);

return [this.initAccessoryInformation(), powerManagementService];
}

update(data: SupplierDeviceData): void {
Expand Down
Loading

0 comments on commit 84df3b3

Please sign in to comment.