homebridge-smartsystem 6.0.2 → 6.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-smartsystem",
3
3
  "displayname": "Duotecno Bridge",
4
- "version": "6.0.2",
4
+ "version": "6.0.5",
5
5
  "description": "SmartServer (Proxy Websockets to TCP sockets, Smappee MQTT, Duotecno IP Nodes, Homekit interface)",
6
6
  "main": "index.js",
7
7
  "author": "Johan Coppieters",
package/server/base.js CHANGED
@@ -10,7 +10,7 @@ const types_1 = require("../duotecno/types");
10
10
  class Base {
11
11
  constructor(type, logger, config) {
12
12
  this.type = type || "base";
13
- this.logger = logger || console.log;
13
+ this.logger = console.log; // logger || console.log;
14
14
  if (config)
15
15
  this.config = config;
16
16
  else
@@ -43,7 +43,7 @@ class Base {
43
43
  this.write(this.type, this.config);
44
44
  }
45
45
  read(type, fname = "") {
46
- const fn = fname || (__dirname + 'config.' + type + '.json');
46
+ const fn = fname || (__dirname + '/../config.' + type + '.json');
47
47
  let config = null;
48
48
  try {
49
49
  const configBuf = fs.readFileSync(fn);
@@ -61,7 +61,7 @@ class Base {
61
61
  return temp;
62
62
  }
63
63
  write(type, config, fname = "") {
64
- const fn = fname || ('./config.' + type + '.json');
64
+ const fn = fname || (__dirname + '/../config.' + type + '.json');
65
65
  try {
66
66
  config = types_1.Sanitizers[type](config);
67
67
  fs.writeFileSync(fn, JSON.stringify(config, null, 2));
package/server/base.ts CHANGED
@@ -15,7 +15,7 @@ export class Base {
15
15
 
16
16
  constructor(type: string, logger?: LogFunction, config?) {
17
17
  this.type = type || "base";
18
- this.logger = logger || console.log;
18
+ this.logger = console.log // logger || console.log;
19
19
 
20
20
  if (config)
21
21
  this.config = config;
@@ -57,7 +57,7 @@ export class Base {
57
57
 
58
58
 
59
59
  read(type: string, fname: string = "") {
60
- const fn = fname || (__dirname + 'config.' + type + '.json');
60
+ const fn = fname || (__dirname + '/../config.' + type + '.json');
61
61
  let config = null;
62
62
 
63
63
  try {
@@ -78,7 +78,7 @@ export class Base {
78
78
  }
79
79
 
80
80
  write(type: string, config, fname: string = "") {
81
- const fn = fname || ('./config.' + type + '.json');
81
+ const fn = fname || (__dirname + '/../config.' + type + '.json');
82
82
  try {
83
83
  config = Sanitizers[type](config);
84
84
  fs.writeFileSync(fn, JSON.stringify(config, null, 2));
@@ -34,7 +34,7 @@ class Platform extends base_1.Base {
34
34
  this.startWaiting = 0;
35
35
  this.config = Object.assign({}, config);
36
36
  this.config.debug = (config && ("debug" in config)) ? config.debug : false;
37
- this.log("running in directory: " + process.cwd());
37
+ this.log("running in " + ((this.config.debug) ? "debug" : "prod") + " mode in directory: " + process.cwd());
38
38
  this.log("with config:" + JSON.stringify(config, null, 2));
39
39
  // this.log("homebridge object:", api);
40
40
  this.homebridgeAPI = api;
@@ -36,7 +36,7 @@ export class Platform extends Base {
36
36
  this.config = {... config};
37
37
  this.config.debug = (config && ("debug" in config)) ? config.debug : false;
38
38
 
39
- this.log("running in directory: " + process.cwd());
39
+ this.log("running in " + ((this.config.debug) ? "debug" : "prod") + " mode in directory: " + process.cwd());
40
40
  this.log("with config:" + JSON.stringify(config, null, 2));
41
41
  // this.log("homebridge object:", api);
42
42
 
@@ -76,21 +76,21 @@ class SmartApp extends webapp_1.WebApp {
76
76
  this.platform = platform;
77
77
  // when all masters are loaded -> attach units to the switches
78
78
  this.system.emitter.on('ready', this.initSwitchUnits.bind(this));
79
- this.addFile("unitList", "./server/views/unit-list.ejs", "application/json");
80
- this.addFile("masterList", "./server/views/master-list.ejs", "text/html");
81
- this.addFile("masterDetail", "./server/views/master-detail.ejs", "text/html");
82
- this.addFile("nodeDetail", "./server/views/node-details.ejs", "text/html");
83
- this.addFile("serviceList", "./server/views/service-list.ejs", "text/html");
84
- this.addFile("smappee", "./server/views/smappee.ejs", "text/html");
85
- this.addFile("homekit", "./server/views/homekit.ejs", "text/html");
86
- this.addFile("settings", "./server/views/settings.ejs", "text/html");
87
- this.addFile("switchDetail", "./server/views/switch-details.ejs", "text/html");
88
- this.addFile("switchList", "./server/views/switch-list.ejs", "text/html");
89
- this.addFile("smappeeRule", "./server/views/smappee-rule.ejs", "text/html");
90
- this.addFile("smappeeBinding", "./server/views/smappee-binding.ejs", "text/html");
91
- this.addFile("materializeCSS", "./server/views/assets/materialize.min.css", "text/css");
92
- this.addFile("materializeJS", "./server/views/assets/materialize.min.js", "text/javascript");
93
- this.addFile("favicon", "./server/views/assets/favicon.ico", "image/x-icon");
79
+ this.addFile("unitList", __dirname + "/views/unit-list.ejs", "application/json");
80
+ this.addFile("masterList", __dirname + "/views/master-list.ejs", "text/html");
81
+ this.addFile("masterDetail", __dirname + "/views/master-detail.ejs", "text/html");
82
+ this.addFile("nodeDetail", __dirname + "/views/node-details.ejs", "text/html");
83
+ this.addFile("serviceList", __dirname + "/views/service-list.ejs", "text/html");
84
+ this.addFile("smappee", __dirname + "/views/smappee.ejs", "text/html");
85
+ this.addFile("homekit", __dirname + "/views/homekit.ejs", "text/html");
86
+ this.addFile("settings", __dirname + "/views/settings.ejs", "text/html");
87
+ this.addFile("switchDetail", __dirname + "/views/switch-details.ejs", "text/html");
88
+ this.addFile("switchList", __dirname + "/views/switch-list.ejs", "text/html");
89
+ this.addFile("smappeeRule", __dirname + "/views/smappee-rule.ejs", "text/html");
90
+ this.addFile("smappeeBinding", __dirname + "/views/smappee-binding.ejs", "text/html");
91
+ this.addFile("materializeCSS", __dirname + "/views/assets/materialize.min.css", "text/css");
92
+ this.addFile("materializeJS", __dirname + "/views/assets/materialize.min.js", "text/javascript");
93
+ this.addFile("favicon", __dirname + "/views/assets/favicon.ico", "image/x-icon");
94
94
  }
95
95
  writeConfig() {
96
96
  // copy switches into config, eliminate the runtime stuff (like unit)
@@ -85,21 +85,21 @@ export class SmartApp extends WebApp {
85
85
  // when all masters are loaded -> attach units to the switches
86
86
  this.system.emitter.on('ready', this.initSwitchUnits.bind(this));
87
87
 
88
- this.addFile("unitList", "./server/views/unit-list.ejs", "application/json");
89
- this.addFile("masterList", "./server/views/master-list.ejs", "text/html");
90
- this.addFile("masterDetail", "./server/views/master-detail.ejs", "text/html");
91
- this.addFile("nodeDetail", "./server/views/node-details.ejs", "text/html");
92
- this.addFile("serviceList", "./server/views/service-list.ejs", "text/html");
93
- this.addFile("smappee", "./server/views/smappee.ejs", "text/html");
94
- this.addFile("homekit", "./server/views/homekit.ejs", "text/html");
95
- this.addFile("settings", "./server/views/settings.ejs", "text/html");
96
- this.addFile("switchDetail", "./server/views/switch-details.ejs", "text/html");
97
- this.addFile("switchList", "./server/views/switch-list.ejs", "text/html");
98
- this.addFile("smappeeRule", "./server/views/smappee-rule.ejs", "text/html");
99
- this.addFile("smappeeBinding", "./server/views/smappee-binding.ejs", "text/html");
100
- this.addFile("materializeCSS", "./server/views/assets/materialize.min.css", "text/css");
101
- this.addFile("materializeJS", "./server/views/assets/materialize.min.js", "text/javascript");
102
- this.addFile("favicon", "./server/views/assets/favicon.ico", "image/x-icon");
88
+ this.addFile("unitList", __dirname + "/views/unit-list.ejs", "application/json");
89
+ this.addFile("masterList", __dirname + "/views/master-list.ejs", "text/html");
90
+ this.addFile("masterDetail", __dirname + "/views/master-detail.ejs", "text/html");
91
+ this.addFile("nodeDetail", __dirname + "/views/node-details.ejs", "text/html");
92
+ this.addFile("serviceList", __dirname + "/views/service-list.ejs", "text/html");
93
+ this.addFile("smappee", __dirname + "/views/smappee.ejs", "text/html");
94
+ this.addFile("homekit", __dirname + "/views/homekit.ejs", "text/html");
95
+ this.addFile("settings", __dirname + "/views/settings.ejs", "text/html");
96
+ this.addFile("switchDetail", __dirname + "/views/switch-details.ejs", "text/html");
97
+ this.addFile("switchList", __dirname + "/views/switch-list.ejs", "text/html");
98
+ this.addFile("smappeeRule", __dirname + "/views/smappee-rule.ejs", "text/html");
99
+ this.addFile("smappeeBinding", __dirname + "/views/smappee-binding.ejs", "text/html");
100
+ this.addFile("materializeCSS", __dirname + "/views/assets/materialize.min.css", "text/css");
101
+ this.addFile("materializeJS", __dirname + "/views/assets/materialize.min.js", "text/javascript");
102
+ this.addFile("favicon", __dirname + "/views/assets/favicon.ico", "image/x-icon");
103
103
  }
104
104
 
105
105
  writeConfig() {