Skip to content

Commit

Permalink
Merge pull request #6 from iainbullock/Fix#3
Browse files Browse the repository at this point in the history
Merged to fix issue #2 and #3
  • Loading branch information
pumamood authored Feb 6, 2021
2 parents 7a65653 + 871fb01 commit b2d9f65
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Tested with Heatmiser Wifi accessory here, not with Netmonitor.

# Installing Plugin

Plugin is NodeJS module published through NPM
Plugin is NodeJS module published through NPM

You can install this plugin the same way you installed Homebridge - as a global NPM module. For example:

Expand All @@ -20,11 +20,16 @@ You can install this plugin the same way you installed Homebridge - as a global

Add to config.json under "accessories" array
* For Heatmiser WiFi thermostats

Options for "your_model" are: "DT", "DT-E", "PRT", "PRT-E", "PRTHW" (see https://github.com/carlossg/heatmiser-node/blob/master/lib/wifi.js#L40)

```json
{
"accessory": "HeatmiserWifi",
"ip_address": "your_netmonitor_ip",
"ip_address": "your_heatmiserwifi_ip",
"pin": your_pin,
"port": 8068,
"model": "your_model",
"name": "Kitchen Thermostat",
"room": "Kitchen"
}
Expand All @@ -37,7 +42,7 @@ Add to config.json under "accessories" array
"ip_address": "your_netmonitor_ip",
"pin": your_pin,
"network_address": 1, // Network Address of the Stat you want to talk to
"name": "Kitchen Thermostat",
"name": "Kitchen Thermostat",
"room": "Kitchen"
}
```
16 changes: 9 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function HeatmiserWifi(log, config, api) {
this.log = log;
this.ip_address = config["ip_address"];
this.pin = config["pin"];
this.port = config["port"];
this.model = config["model"];
this.lock = new AsyncLock({ timeout: config["timeout"] || 5000 });}

HeatmiserWifi.prototype = {
Expand All @@ -30,14 +32,14 @@ HeatmiserWifi.prototype = {

getCurrentHeatingCoolingState: function (callback) {
this.lock.acquire(key, function (done) {
// async work
// async work
this.log("getCurrentHeatingCoolingState");

//Characteristic.CurrentHeatingCoolingState.OFF = 0;
//Characteristic.CurrentHeatingCoolingState.HEAT = 1;
//Characteristic.CurrentHeatingCoolingState.COOL = 2;
var e = null;
var hm = new heatmiser.Wifi(this.ip_address, this.pin);
var hm = new heatmiser.Wifi(this.ip_address, this.pin, this.port, this.model);
hm.on('error', (err) => {
this.log('An error occurred! ' + err.message);
e = err;
Expand Down Expand Up @@ -69,7 +71,7 @@ HeatmiserWifi.prototype = {
this.lock.acquire(key, function (done) {
this.log("getTargetHeatingCoolingState");
var e = null;
var hm = new heatmiser.Wifi(this.ip_address, this.pin);
var hm = new heatmiser.Wifi(this.ip_address, this.pin, this.port, this.model);
hm.on('error', (err) => {
this.log('An error occurred! ' + err.message);
e = err;
Expand Down Expand Up @@ -97,7 +99,7 @@ HeatmiserWifi.prototype = {
this.log("getCurrentTemperature");

var e = null;
var hm = new heatmiser.Wifi(this.ip_address, this.pin);
var hm = new heatmiser.Wifi(this.ip_address, this.pin, this.port, this.model);
hm.on('error', (err) => {
this.log('An error occurred! ' + err.message);
e = err;
Expand All @@ -119,7 +121,7 @@ HeatmiserWifi.prototype = {
this.log("getTargetTemperature");

var e = null;
var hm = new heatmiser.Wifi(this.ip_address, this.pin);
var hm = new heatmiser.Wifi(this.ip_address, this.pin, this.port, this.model);
hm.on('error', (err) => {
this.log('An error occurred! ' + err.message);
e = err;
Expand All @@ -144,7 +146,7 @@ HeatmiserWifi.prototype = {
}

var e = null;
var hm = new heatmiser.Wifi(this.ip_address, this.pin);
var hm = new heatmiser.Wifi(this.ip_address, this.pin, this.port, this.model);
hm.on('error', (err) => {
this.log('An error occurred! ' + err.message);
e = err;
Expand All @@ -159,7 +161,7 @@ HeatmiserWifi.prototype = {
this.log("getTemperatureDisplayUnits");

var e = null;
var hm = new heatmiser.Wifi(this.ip_address, this.pin);
var hm = new heatmiser.Wifi(this.ip_address, this.pin, this.port, this.model);
hm.on('error', (err) => {
this.log('An error occurred! ' + err.message);
e = err;
Expand Down

0 comments on commit b2d9f65

Please sign in to comment.