diff --git a/.snyk b/.snyk index 371800ba..7b111313 100644 --- a/.snyk +++ b/.snyk @@ -123,6 +123,9 @@ ignore: - snyk-go-plugin > graphlib > lodash: reason: None given expires: '2018-05-27T15:05:54.491Z' + request-promise > request-promise-core > lodash: + reason: None given + expires: '2018-07-03T23:22:22.863Z' - node-ssdp > async > lodash: reason: None given expires: '2018-04-01T03:18:10.568Z' diff --git a/README.md b/README.md index 5b5097c2..05e4a954 100755 --- a/README.md +++ b/README.md @@ -1,13 +1,12 @@ -# nodejs-poolController - Version 5.0.1 +# nodejs-poolController - Version 5.1.1 [![Join the chat at https://gitter.im/nodejs-poolController/Lobby](https://badges.gitter.im/nodejs-poolController/Lobby.svg)](https://gitter.im/nodejs-poolController/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/tagyoureit/nodejs-poolController.svg?branch=master)](https://travis-ci.org/tagyoureit/nodejs-poolController) [![Coverage Status](https://coveralls.io/repos/github/tagyoureit/nodejs-poolController/badge.svg?branch=master)](https://coveralls.io/github/tagyoureit/nodejs-poolController?branch=master) [![Known Vulnerabilities](https://snyk.io/test/github/tagyoureit/nodejs-poolcontroller/badge.svg)](https://snyk.io/test/github/tagyoureit/nodejs-poolcontroller) -#### 5.0.1 -1. Fixed Influx error on startup #90 -1. Fixed bad characters in custom names - +5.1.1 +1. Renamed all 'valves' items to valve to be in line with singular renaming of items +1. InfluxDB - moved some items that were in tag fields to field keys; added valves #### 5.1.0 Highlights 1. Intellibrite support - API's, Sockets and a WebUI @@ -21,6 +20,13 @@ See the constants.js file and the sections: strIntellibriteModes (for modes) lightColors (for setColor) + +#### 5.0.1 +1. Fixed Influx error on startup #90 +1. Fixed bad characters in custom names + + + #### 5.0.0 Highlights Make sure to run `npm upgrade`. There are many package updates and changes. diff --git a/package.json b/package.json index dea96363..a0cbf72c 100644 --- a/package.json +++ b/package.json @@ -76,4 +76,4 @@ "snyk": "^1.80.1" }, "snyk": true -} +} \ No newline at end of file diff --git a/specs/assets/config/config.json b/specs/assets/config/config.json index c27683d6..6d7b88b9 100644 --- a/specs/assets/config/config.json +++ b/specs/assets/config/config.json @@ -149,4 +149,4 @@ } }, "integrations": {} -} +} \ No newline at end of file diff --git a/specs/helpers/initialize.js b/specs/helpers/initialize.js index 1be12cff..634c5fd0 100644 --- a/specs/helpers/initialize.js +++ b/specs/helpers/initialize.js @@ -40,7 +40,7 @@ initAllAsync = function(configLocation, sysDefaultLocation) { bottle.container.intellitouch.init() // synchronous bottle.container.temperatures.init() // synchronous bottle.container.UOM.init() // synchronous - bottle.container.valves.init() // synchronous + bottle.container.valve.init() // synchronous bottle.container.queuePacket.init() // synchronous bottle.container.writePacket.init() // synchronous bottle.container.intellitouch.init() // synchronous diff --git a/specs/index.spec.js b/specs/index.spec.js index f036777b..75c3a47d 100755 --- a/specs/index.spec.js +++ b/specs/index.spec.js @@ -85,7 +85,7 @@ describe('nodejs-poolController', function () { // bottle.container.intellitouch.init() // bottle.container.temperatures.init() // bottle.container.UOM.init() - // bottle.container.valves.init() + // bottle.container.valve.init() // }) // .then(resolve) // .catch(function (err) { diff --git a/src/etc/constants.js b/src/etc/constants.js index 48a69ccb..e47097f6 100755 --- a/src/etc/constants.js +++ b/src/etc/constants.js @@ -36,7 +36,7 @@ module.exports = function(container) { EQUIP2: 9, EQUIP3: 10, UOM: 15, //Celsius (4) or Farenheit (0); Also Service/Timeout. See strRunMode below. - VALVES: 16, + VALVE: 16, DELAY: 18, //64==??; 65-135 (for 50 circuits) is the circuit that is currently delayed. UNKNOWN: 19, //Something to do with heat. POOL_TEMP: 20, @@ -337,7 +337,7 @@ module.exports = function(container) { 10: 'SAL Light', 11: 'Photon Gen', 12: 'Color Wheel', - 13: 'Valves', + 13: 'Valve', 14: 'Spillway', 15: 'Floor Cleaner', 16: 'Intellibrite', @@ -390,7 +390,7 @@ module.exports = function(container) { 25: 'IntelliChlor Status', 27: 'Pump Config (Extended)', 29: 'Valve Status', - 30: 'High Speed Circuits for Valves', + 30: 'High Speed Circuits for Valve', 32: 'is4/is10 Settings', 33: 'Intelliflo Spa Side Remote settings', 34: 'Solar/Heat Pump Status', @@ -515,7 +515,7 @@ module.exports = function(container) { } - var strValves = { + var strValve = { 3: 'Pool', 15: 'Spa', 48: 'Heater', @@ -661,7 +661,7 @@ module.exports = function(container) { strChlorinatorActions: strChlorinatorActions, strControllerActions: strControllerActions, strRunMode: strRunMode, - strValves: strValves, + strValve: strValve, heatModeStr: heatModeStr, heatMode: heatMode, ctrl: ctrl, diff --git a/src/lib/app.js b/src/lib/app.js index 48fc9805..044e4efd 100755 --- a/src/lib/app.js +++ b/src/lib/app.js @@ -170,7 +170,7 @@ bottle.factory('circuit', require(__dirname + '/equipment/circuit.js')) bottle.factory('temperatures', require(__dirname + '/equipment/temperatures.js')) bottle.factory('time', require(__dirname + '/equipment/time.js')) bottle.factory('UOM', require(__dirname + '/equipment/UOM.js')) -bottle.factory('valves', require(__dirname + '/equipment/valves.js')) +bottle.factory('valve', require(__dirname + '/equipment/valve.js')) bottle.factory('customNames', require(__dirname + '/equipment/customnames.js')) bottle.factory('schedule', require(__dirname + '/equipment/schedule.js')) bottle.factory('intellitouch', require(__dirname + '/equipment/intellitouch.js')) @@ -220,7 +220,7 @@ var initAsync = exports.initAsync = function() { bottle.container.intellitouch.init() bottle.container.temperatures.init() bottle.container.UOM.init() - bottle.container.valves.init() + bottle.container.valve.init() bottle.container.intellichem.init() // bottle.container.logger.info('Intro: ', bottle.container.settings.displayIntroMsg()) diff --git a/src/lib/comms/inbound/controller/2.js b/src/lib/comms/inbound/controller/2.js index ea140878..41bff573 100755 --- a/src/lib/comms/inbound/controller/2.js +++ b/src/lib/comms/inbound/controller/2.js @@ -50,7 +50,7 @@ module.exports = function(container) { //mask the data[6] with 0011 shift right two places for 1100 mask (11xx-->11) container.heat.setHeatModeFromController(data[c.controllerStatusPacketFields.HEATER_MODE]&3, data[c.controllerStatusPacketFields.HEATER_MODE] >> 2) - container.valves.setValves(data) + container.valve.setValve(data) status.runmode = c.strRunMode[data[c.controllerStatusPacketFields.UOM] & 129]; // more here? container.UOM.setUOM((data[c.controllerStatusPacketFields.UOM] & 4) >> 3) diff --git a/src/lib/comms/inbound/controller/29.js b/src/lib/comms/inbound/controller/29.js index 10b2420d..c323c10c 100644 --- a/src/lib/comms/inbound/controller/29.js +++ b/src/lib/comms/inbound/controller/29.js @@ -33,7 +33,7 @@ module.exports = function(container) { if (container.settings.get('logMessageDecoding')) - container.logger.debug('Msg#: %s Valves status. Valve B --> %s (%s) Full packet: %s', counter, valveBFriendlyName, valveBName, data); + container.logger.debug('Msg#: %s Valve status. Valve B --> %s (%s) Full packet: %s', counter, valveBFriendlyName, valveBName, data); return true } diff --git a/src/lib/comms/influx-connector.js b/src/lib/comms/influx-connector.js index 00b46cb0..118619b6 100644 --- a/src/lib/comms/influx-connector.js +++ b/src/lib/comms/influx-connector.js @@ -69,7 +69,7 @@ module.exports = function (container) { // which is more efficient for Influx for (var key in data) { data_array.push({ - measurement: 'circuits', + measurement: 'circuit', tags: { 'number': data[key].number, 'numberStr': data[key].numberStr, @@ -108,19 +108,22 @@ module.exports = function (container) { for (var key in data) { if (typeof(data[key].rpm) === 'number') { data_array.push({ - measurement: 'pumps', + measurement: 'pump', tags: { + 'source': 'nodejs-poolcontroller', 'pump': data[key].pump, 'type': data[key].type, - 'run': data[key].run, - 'mode': data[key].mode, - 'remotecontrol': data[key].remotecontrol, - 'power': data[key].power + 'name': data[key].name, + 'friendlyName': data[key].friendlyName }, fields: { 'watts': data[key].watts, 'rpm': data[key].rpm, - 'gpm': data[key].gpm + 'gpm': data[key].gpm, + 'run': data[key].run, + 'mode': data[key].mode, + 'remotecontrol': data[key].remotecontrol, + 'power': data[key].power } }) } @@ -160,18 +163,19 @@ module.exports = function (container) { 'poolTemp': data.poolTemp, 'spaTemp': data.spaTemp, 'airTemp': data.airTemp, - 'solarTemp': data.solarTemp - } - } - - influx.writePoints([{ - 'measurement': 'temperatures', - 'tags': { + 'solarTemp': data.solarTemp, 'poolHeatMode': data.poolHeatMode, 'poolHeatModeStr': data.poolHeatModeStr, 'spaHeatMode': data.spaHeatMode, 'spaHeatModeStr': data.spaHeatModeStr, 'freeze': data.freeze + } + } + + influx.writePoints([{ + 'measurement': 'temperature', + 'tags': { + 'source': 'nodejs-poolcontroller' }, 'fields': temp_fields }]) @@ -190,6 +194,8 @@ module.exports = function (container) { } + + var init = function () { } diff --git a/src/lib/comms/server.js b/src/lib/comms/server.js index 890c8b47..ad1a7483 100755 --- a/src/lib/comms/server.js +++ b/src/lib/comms/server.js @@ -357,6 +357,9 @@ module.exports = function (container) { app.get('/schedule', function (req, res) { res.send(container.schedule.getCurrentSchedule()); }); + app.get('/valve', function (req, res) { + res.send(container.valve.getValve()); + }); app.get('/schedule/toggle/id/:id/day/:day', function (req, res) { var id = parseInt(req.params.id); diff --git a/src/lib/comms/socketio-helper.js b/src/lib/comms/socketio-helper.js index 51e3f3b9..3146ac55 100755 --- a/src/lib/comms/socketio-helper.js +++ b/src/lib/comms/socketio-helper.js @@ -138,9 +138,8 @@ module.exports = function(container) { intellichem) } - if (outputType === 'valves' || outputType === 'all'){ - emitToClientsOnEnabledSockets('valves', container.valves.getValves()) - emitToClientsOnEnabledSockets('valve', container.valves.getValves()) + if (outputType === 'valve' || outputType === 'all'){ + emitToClientsOnEnabledSockets('valve', container.valve.getValve()) } } diff --git a/src/lib/equipment/circuit.js b/src/lib/equipment/circuit.js index e3c60426..0b53f31a 100755 --- a/src/lib/equipment/circuit.js +++ b/src/lib/equipment/circuit.js @@ -726,7 +726,7 @@ module.exports = function (container) { if (container.settings.get('logIntellibrite')) { container.logger.silly('Intellibrite All on/off groups indexBy: ', JSON.stringify(tempLightGroup, null, 2)) if (diff1 === undefined) { - container.logger.debug('Intellibrite all on/off packet retrieved, but there were no changes. (Hint: you need to add the circuit to the "Special Lights" group in order for Light Position changes to take effect.') + container.logger.silly('Intellibrite all on/off packet retrieved, but there were no changes.') } else { diff --git a/src/lib/equipment/intellitouch.js b/src/lib/equipment/intellitouch.js index c10a5fac..2a5468d6 100755 --- a/src/lib/equipment/intellitouch.js +++ b/src/lib/equipment/intellitouch.js @@ -46,6 +46,9 @@ module.exports = function(container) { container.logger.verbose('Queueing messages to retrieve Pool/Spa Heat Mode') container.queuePacket.queuePacket([165, controllerSettings.preambleByte, 16, controllerSettings.appAddress, 200, 1, 0]); + container.logger.verbose('Queueing messages to retrieve Valve information') + container.queuePacket.queuePacket([165, controllerSettings.preambleByte, 16, controllerSettings.appAddress, 221, 1, 0]); + container.logger.verbose('Queueing messages to retrieve settings(?)') container.queuePacket.queuePacket([165, controllerSettings.preambleByte, 16, controllerSettings.appAddress, 232, 1, 0]); diff --git a/src/lib/equipment/valves.js b/src/lib/equipment/valve.js similarity index 57% rename from src/lib/equipment/valves.js rename to src/lib/equipment/valve.js index 4c87f24b..cee449b8 100755 --- a/src/lib/equipment/valves.js +++ b/src/lib/equipment/valve.js @@ -15,40 +15,40 @@ * along with this program. If not, see . */ -//TODO: make an 'update' function so poolHeatModeStr/spaHeatModeStr update when we set the corresponding modes. +var valve -var valves - -module.exports = function(container) { +module.exports = function (container) { /*istanbul ignore next */ if (container.logModuleLoading) - container.logger.info('Loading: valves.js') + container.logger.info('Loading: valve.js') - var init = function() { - valves = { - "valves": 0 + var init = function () { + valve = { + "valve": 0 } } - function setValves(data) { - //container.logger.info('Received valves status packet. \n\tPossible association with %s. \n\t Valves data: %s', data[container.constants.controllerStatusPacketFields.VALVES], data) - valves.valves = data[container.constants.controllerStatusPacketFields.VALVES]; + function setValve(data) { + container.logger.info('Received valve status packet. \n\tPossible association with %s. \n\t valve data: %s', data[container.constants.controllerStatusPacketFields.valve], data) + valve.valve = data[container.constants.controllerStatusPacketFields.valve]; + container.io.emitToClients('valve') } - function getValves() { - return {'valve': valves} + function getValve() { + return {'valve': valve} } /*istanbul ignore next */ if (container.logModuleLoading) - container.logger.info('Loaded: valves.js') + container.logger.info('Loaded: valve.js') return { init: init, - setValves: setValves, - getValves: getValves + setValve: setValve, + getValve: getValve } } + diff --git a/src/lib/helpers/helpers.js b/src/lib/helpers/helpers.js index 4a0698a0..dcc8e26a 100755 --- a/src/lib/helpers/helpers.js +++ b/src/lib/helpers/helpers.js @@ -209,7 +209,7 @@ module.exports = function (container) { container._.extend(pool, container.temperatures.getTemperatures()) container._.extend(pool, container.time.getTime()) container._.extend(pool, container.UOM.getUOM()) - container._.extend(pool, container.valves.getValves()) + container._.extend(pool, container.valve.getValve()) container._.extend(pool, container.chlorinator.getChlorinatorStatus()) container._.extend(pool, container.intellichem.getCurrentIntellichem()) return pool diff --git a/src/lib/helpers/reload.js b/src/lib/helpers/reload.js index 909fb690..c5246b44 100644 --- a/src/lib/helpers/reload.js +++ b/src/lib/helpers/reload.js @@ -94,7 +94,7 @@ module.exports = function(container) { container.intellitouch.init() container.temperatures.init() container.uom.init() - container.valves.init() + container.valve.init() } diff --git a/src/www/bootstrap/main.js b/src/www/bootstrap/main.js index e2fbe482..c71e4c5f 100755 --- a/src/www/bootstrap/main.js +++ b/src/www/bootstrap/main.js @@ -823,7 +823,7 @@ function bindLightSelectPicker() { $(el).on('changed.bs.select', function (e, clickedIndex, newValue, oldValue) { - console.log('intellibrite light mode name: %s val: %s ', $(el).val(), $(el).find('option:selected').data('val')) + //console.log('intellibrite light mode name: %s val: %s ', $(el).val(), $(el).find('option:selected').data('val')) socket.emit('setLightMode', $(el).find('option:selected').data('val')) @@ -869,7 +869,7 @@ function bindLightPosition(el, _default) { $(el).selectpicker('val', _default) $(el).on('changed.bs.select', function (e, clickedIndex, newValue, oldValue) { - console.log('name: %s val: %s circuit: %s', $(el).val(), $(el).find('option:selected').data('val'), $(el).closest('select').data('circuitnum')) + //console.log('name: %s val: %s circuit: %s', $(el).val(), $(el).find('option:selected').data('val'), $(el).closest('select').data('circuitnum')) socket.emit('setLightPosition', $(el).closest('select').data('circuitnum'), $(el).val()) @@ -1227,7 +1227,7 @@ function startSocketRx() { var rowHeader = $('#pumps tr:first:contains(' + currPump["friendlyName"] + ')'); var colAppend = rowHeader.length ? false : true; - console.log('currPump["friendlyName"]: ', currPump["friendlyName"]) + //console.log('currPump["friendlyName"]: ', currPump["friendlyName"]) if (colAppend === false) { var colTarget = -1; $('th', rowHeader).each(function (index) { diff --git a/src/www/public/main.js b/src/www/public/main.js index dcd9a6ec..e7c7c63a 100755 --- a/src/www/public/main.js +++ b/src/www/public/main.js @@ -122,7 +122,7 @@ $(function () { '
Unknown?: ' + data.spaHeatMode2 + '
Pool Heat Mode: ' + data.poolHeatMode + '
Spa Heat Mode: ' + data.spaHeatMode + - '
Valve: ' + data.valves + + '
Valve: ' + data.valve + '
Run Mode: ' + data.runmode + '
Unit of Measure: ' + data.UOM + '
Heater Active(?): ' + data.HEATER_ACTIVE + @@ -384,4 +384,4 @@ $(function () { }) -}); \ No newline at end of file +});