diff --git a/controller/nixie/chemistry/ChemController.ts b/controller/nixie/chemistry/ChemController.ts
index ea03091e..c0401a48 100644
--- a/controller/nixie/chemistry/ChemController.ts
+++ b/controller/nixie/chemistry/ChemController.ts
@@ -2216,7 +2216,7 @@ export class NixieChemProbePh extends NixieChemProbe {
deviceBinding: this.probe.deviceBinding,
eventName: "chemController",
property: "pHLevel",
- sendValue: 'pH',
+ sendValue: 'all',
isActive: data.remFeedEnabled,
sampling: 1,
changesOnly: false,
diff --git a/defaultConfig.json b/defaultConfig.json
index 2a39a20d..5b1c0db5 100755
--- a/defaultConfig.json
+++ b/defaultConfig.json
@@ -52,6 +52,7 @@
"interfaces": {
"smartThings": {
"name": "SmartThings",
+ "type": "rest",
"enabled": false,
"fileName": "smartThings-Hubitat.json",
"globals": {},
@@ -62,6 +63,7 @@
},
"hubitat": {
"name": "Hubitat",
+ "type": "rest",
"enabled": false,
"fileName": "smartThings-Hubitat.json",
"globals": {},
@@ -72,6 +74,7 @@
},
"vera": {
"name": "Vera",
+ "type": "rest",
"enabled": false,
"fileName": "vera.json",
"vars": {
@@ -83,6 +86,7 @@
}
},
"valveRelay": {
+ "type": "rest",
"name": "Valve Relays",
"enabled": false,
"fileName": "valveRelays.json",
diff --git a/web/Server.ts b/web/Server.ts
index f341dbd4..42ca25e3 100755
--- a/web/Server.ts
+++ b/web/Server.ts
@@ -16,6 +16,7 @@ along with this program. If not, see .
*/
import * as path from "path";
import * as fs from "fs";
+import * as dns from "dns";
import express = require('express');
import { utils } from "../controller/Constants";
import { config } from "../config/Config";
@@ -101,6 +102,7 @@ export class WebServer {
let type = c.type || 'http';
logger.info(`Init ${type} interface: ${c.name}`);
switch (type) {
+ case 'rest':
case 'http':
int = new HttpInterfaceServer(c.name, type);
int.init(c);
@@ -182,7 +184,7 @@ export class WebServer {
if (this._servers[i].uuid === uuid) this._servers.splice(i, 1);
}
}
- public async updateServerInterface(obj: any) {
+ public async updateServerInterface(obj: any): Promise {
let int = config.setInterface(obj);
let srv = this.findServerByGuid(obj.uuid);
// if server is not enabled; stop & remove it from local storage
@@ -197,6 +199,7 @@ export class WebServer {
}
else srv.init(obj);
}
+ return config.getInterfaceByUuid(obj.uuid);
}
}
class ProtoServer {
@@ -935,16 +938,21 @@ export class REMInterfaceServer extends ProtoServer {
// First, send the connection info for njsPC and see if a connection exists.
let url = '/config/checkconnection/';
// can & should extend for https/username-password/ssl
- let data: any = { type: "njspc", isActive: true, id: null, name: "njsPC - automatic", protocol: "http:", ipAddress: webApp.ip(), port: config.getSection('web').servers.http.port || 4200, userName: "", password: "", sslKeyFile: "", sslCertFile: "" }
+ let data: any = { type: "njspc", isActive: true, id: null, name: "njsPC - automatic", protocol: "http:", ipAddress: webApp.ip(), port: config.getSection('web').servers.http.port || 4200, userName: "", password: "", sslKeyFile: "", sslCertFile: "", hostnames: [] }
+ logger.info(`Checking REM Connection ${data.name} ${data.ipAddress}:${data.port}`);
+ try {
+ data.hostnames = await dns.promises.reverse(data.ipAddress);
+ } catch (err) { logger.error(`Error getting hostnames for njsPC REM connection`); }
let result = await this.putApiService(url, data, 5000);
// If the result code is > 200 we have an issue. (-1 is for timeout)
if (result.status.code > 200 || result.status.code < 0) return reject(new Error(`initConnection: ${result.error.message}`));
- else { this.remoteConnectionId = result.obj.id };
+ else {
+ this.remoteConnectionId = result.obj.id;
+ };
// The passed connection has been setup/verified; now test for emit
// if this fails, it could be because the remote connection is disabled. We will not
// automatically re-enable it
-
url = '/config/checkemit'
data = { eventName: "checkemit", property: "result", value: 'success', connectionId: result.obj.id }
// wait for REM server to finish resetting
@@ -957,14 +965,14 @@ export class REMInterfaceServer extends ProtoServer {
// console.log(data);
clearTimeout(_tmr);
logger.info(`REM bi-directional communications established.`)
- return resolve();
+ resolve();
});
result = await self.putApiService(url, data);
// If the result code is > 200 or -1 we have an issue.
if (result.status.code > 200 || result.status.code === -1) return reject(new Error(`initConnection: ${result.error.message}`));
else {
clearTimeout(_tmr);
- return resolve();
+ resolve();
}
}
catch (err) { reject(new Error(`initConnection setTimeout: ${result.error.message}`)); }
diff --git a/web/services/config/Config.ts b/web/services/config/Config.ts
index 9d61ba09..c9bc0932 100755
--- a/web/services/config/Config.ts
+++ b/web/services/config/Config.ts
@@ -307,13 +307,16 @@ export class ConfigRoute {
let opts = {
interfaces: config.getSection('web.interfaces'),
types: [
- {name: 'rem', desc: 'Relay Equipment Manager'},
- {name: 'mqtt', desc: 'MQTT'}
+ { name: 'rest', desc: 'Rest' },
+ { name: 'http', desc: 'Http' },
+ { name: 'rem', desc: 'Relay Equipment Manager' },
+ { name: 'mqtt', desc: 'MQTT' },
+ { name: 'influx', desc: 'InfluxDB' }
],
protocols: [
{ val: 0, name: 'http://', desc: 'http://' },
{ val: 1, name: 'https://', desc: 'https://' },
- { val: 2, name: 'mqtt://', desc: 'mqtt://' },
+ { val: 2, name: 'mqtt://', desc: 'mqtt://' }
]
}
return res.status(200).send(opts);
@@ -831,8 +834,8 @@ export class ConfigRoute {
});
app.put('/app/interface', async (req, res, next) => {
try{
- await webApp.updateServerInterface(req.body);
- return res.status(200).send('OK');
+ let iface = await webApp.updateServerInterface(req.body);
+ return res.status(200).send(iface);
}
catch (err) {next(err);}
});