11 Commits

Author SHA1 Message Date
89b8775ce3 Add support for specifying the sender id to each call
This parameter is optional, so compatibility shouldn't be affected. Each SLMessage can set its own sender ID which is present on the returned message. This allows callers to fire multiple requests at once, even of the same type, while being able to identify which response went with which request. If not specified, the default value is 0.

Also went ahead and documented some of the helper functions present on SLMessage (so, available on all message instances).

Finally, since I was in and messing with each message anyway, I simplified and removed some repeated code from each derived message and had it call into the super to take advantage of shared decoding functionality.

The lambdas ("arrow functions") in test functions were removed per advice from Mocha's documentation where the implicit `this` rebinding can apparently cause problems. This should probably have been its own commit, but, again, I was already in there messing with stuff, so...oh well.

Closes #43
2020-08-11 22:20:58 -05:00
0a0c8c7cd0 Bug Fix for decodeValveData / improvedNaming / CIRCUIT_VALUE_MAP (#33)
* initial code to interpret valveDataArray

* Some additional comments on the valveDataArray decoding message

* Adds decodeSensorData, decodeValveData, decodeDelayData, decodeMiscData

* reverts unintended change to index.js

* Refactor / rename variables
	- renamed variables to better describe their use
	- created a helper function 'isValvePresent' to simplify code
	- changed while loop to for loop

* - Fixes bug in decodeValveData where only last valve's data was returned
- renames some variables based on testing to more descriptive names
- add CIRCUIT_NAME_VALUE_MAP for fixed values that the system uses (determined by testing on my system)

* refactored decodeMiscData to simplify code

* - Changed CIRCUIT_NAME_VALUE_MAP to array of objects
- Refactored getCircuitByDeviceId
- Added getCircuitsMap as helper to getCircuitByDeviceId and as a utility function to help in UI development
2020-06-19 09:57:51 -05:00
cd981c19ef Added ability to get circuit info by the device id
This is useful for EquipmentConfiguration and upcoming PumpStatus messages.
2020-06-08 22:14:31 -05:00
a2d39e7463 Added some helpers to interpret the controllerType field
These aren't particularly useful, at least not to me, but I found them while perusing the official app, so I figured they couldn't hurt to have.
2020-02-22 11:27:09 -06:00
ed99d411b2 Minor optimization to set buffer size appropriately
This avoids unnecessary allocations/reallocations while decoding a message by pre-sizing the buffer to the amount we know it will require. I feel like there's probably a better way to handle this, but this works for now.
2020-02-10 21:36:13 -06:00
22858061f7 eslint didn't like these not having semi-colons
I should probably turn the semi-colon linter off since I really dislike the semi-colons everywhere, but it's probably too late for that at this point in the project.
2020-02-09 14:22:32 -06:00
661d8db173 Added helper methods for interpreting the equipFlags value
Provided by @mikemucc in #15. Also updated the readme with the new information.
2019-12-27 15:57:21 -06:00
3c6b8ebcc7 Linter fixes 2018-04-28 23:06:11 -05:00
0bbae0446b Removed debug logging
Added verification of broadcast response message size
Added clearer handling of message types

I'm sure there's a better way to do debug logging, but I don't really feel like adding a dependency on another module just for that.
2018-03-30 20:35:24 -05:00
8c02b4857d degC is now true/false instead of 0/1
Seek ahead instead of using padding variables
2018-03-30 20:14:08 -05:00
b6ee816fb3 Added decoding of messages
Also moved things out to their own files and setup require()s to bring it all together.
2018-03-30 16:07:56 -05:00