Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tagyoureit committed Jun 4, 2018
1 parent 9e870c2 commit b3d31a9
Show file tree
Hide file tree
Showing 20 changed files with 79 additions and 59 deletions.
3 changes: 3 additions & 0 deletions .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@
"snyk": "^1.80.1"
},
"snyk": true
}
}
2 changes: 1 addition & 1 deletion specs/assets/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@
}
},
"integrations": {}
}
}
2 changes: 1 addition & 1 deletion specs/helpers/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion specs/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions src/etc/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -515,7 +515,7 @@ module.exports = function(container) {
}


var strValves = {
var strValve = {
3: 'Pool',
15: 'Spa',
48: 'Heater',
Expand Down Expand Up @@ -661,7 +661,7 @@ module.exports = function(container) {
strChlorinatorActions: strChlorinatorActions,
strControllerActions: strControllerActions,
strRunMode: strRunMode,
strValves: strValves,
strValve: strValve,
heatModeStr: heatModeStr,
heatMode: heatMode,
ctrl: ctrl,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion src/lib/comms/inbound/controller/2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/comms/inbound/controller/29.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
34 changes: 20 additions & 14 deletions src/lib/comms/influx-connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
})
}
Expand Down Expand Up @@ -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
}])
Expand All @@ -190,6 +194,8 @@ module.exports = function (container) {
}




var init = function () {

}
Expand Down
3 changes: 3 additions & 0 deletions src/lib/comms/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions src/lib/comms/socketio-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/equipment/circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions src/lib/equipment/intellitouch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
32 changes: 16 additions & 16 deletions src/lib/equipment/valves.js → src/lib/equipment/valve.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,40 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

//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
}
}

2 changes: 1 addition & 1 deletion src/lib/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers/reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ module.exports = function(container) {
container.intellitouch.init()
container.temperatures.init()
container.uom.init()
container.valves.init()
container.valve.init()

}

Expand Down
6 changes: 3 additions & 3 deletions src/www/bootstrap/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))

Expand Down Expand Up @@ -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())

Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/www/public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ $(function () {
'<br>Unknown?: ' + data.spaHeatMode2 +
'<br>Pool Heat Mode: ' + data.poolHeatMode +
'<br>Spa Heat Mode: ' + data.spaHeatMode +
'<br>Valve: ' + data.valves +
'<br>Valve: ' + data.valve +
'<br>Run Mode: ' + data.runmode +
'<br>Unit of Measure: ' + data.UOM +
'<br>Heater Active(?): ' + data.HEATER_ACTIVE +
Expand Down Expand Up @@ -384,4 +384,4 @@ $(function () {
})


});
});

0 comments on commit b3d31a9

Please sign in to comment.