Commit Graph

40 Commits

Author SHA1 Message Date
485b494ea8 Add support for reading unit history data
unit.getHistoryData(fromTime, toTime) will request data about sensor and circuit changes over time, then `getHistoryData` will be emitted when the data is ready to be handled.

Fixes #59
2022-04-15 16:38:24 -05:00
a5d207d3aa Add support for setting the current system date/time
#56
2021-09-06 23:02:02 -05:00
37d40b3386 Add support for retrieving the current system date/time
#56
2021-09-06 23:00:51 -05:00
789f75f4a6 Add missing break 2020-12-12 21:14:41 -06:00
1ea8548991 Add handling/documentation for the scheduleChanged event
See discussion on #44 for more info
2020-12-12 21:12:15 -06:00
27bdf0380e Ensure all messages populate the response senderId
Fixed `addClient` and `removeClient` events returning `SLCancelDelay` objects. This shouldn't really make a difference as there are no properties to worry about on one or the other, but it was still incorrect and could cause bugs if stuff was added to those messages in the future.
2020-08-12 08:51:44 -05:00
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
2e5203fb85 Adds keepalive setting to socket 2020-06-28 15:40:14 -05:00
b2439cd90c Added SLAddClient / SLRemoveClient messages (#30) 2020-06-10 08:05:32 -05:00
98f759c717 Added debug logging, updated readme with new message+event 2020-06-09 16:51:41 -05:00
db522ba5db SLCancelDelay message added (#29) 2020-06-09 16:43:09 -05:00
51d5b5a620 Added dependency on debug package, converted console.log to debug logs
I find these console logs valuable for development but don't want them on all the time for everyone. It's cumbersome to comment/uncomment them continually, so this package helps nicely. I generally don't like adding dependencies, but this one seems wildly popular and itself only has one dependency (and that dependencies doesn't depend on anything else). So it seems acceptable to use.

I also enabled these debug logs by default when running the example configuration from VSCode.
2020-06-09 09:25:40 -05:00
c0ac043d7b Added constants for heat modes 2020-06-09 08:47:32 -05:00
75d642cbfc GetPumpStatus / SetPumpFlow commands (#28)
* added GetPumpStatus / SetPumpFlow commands

* Updated README.md with GetPumpStatus / SetPumpFlow information

* rename `setPointType` to `isRPMs`

* renamed val0 to pumpType and val1 to isRunning

* added `unknown command` case

* fixed lint error

* Renamed unknown values to pumpUnknown1 and pumpUnknown2

* renamed 30 to unknownCommand
2020-06-09 07:49:24 -05:00
8d908aad5d WIP interpretation of equipment configuration properties 2020-06-08 19:05:45 -05:00
c1ceacbd98 Updated Readme / Added EggTimer Support (#25)
* added setCircuitRuntimeById function
2020-06-06 18:57:58 -05:00
9c72e7b61d Schedule Editing Additions (#24)
* Added support for: adding schedule events, deleting schedule events, listing schedule events and updating scheduled events
2020-06-03 22:07:33 -05:00
f315bcd6a5 Allowed eslint to fix style violations 2020-05-25 13:25:18 -05:00
9205e3b62b add .on(‘error’) handlers that emit the error (#21)
- propagate internal errors back to caller by emitting them so they can properly be handled by callers
2020-05-25 13:19:28 -05:00
81b3a61c28 Added SLEquipmentConfigurationMessage
I am not documenting this in the readme just yet because I don't really know how to interpret the data provided, but it seems to be necessary if we want to be able to change pump speeds in the future or read any historical data about the equipment. I'm not sure how much I'm going to be able to figure out about these arrays since the data appears random to me at the moment, but perhaps others will be able to figure out what's in here.
2020-02-22 11:29:29 -06:00
0397e8ad8f Added support for controlling the salt cell generator output levels
Closes #17
2020-02-08 15:33:13 -06:00
e567e9c821 gatewayName conversion was stripping final character (#14) 2019-11-30 12:01:29 -06:00
757a3be7d1 Set heat mode (#13)
* Function to set the heater mode + readme updates

* making the test set the heater to 'heat pump'
2019-11-24 16:53:53 -06:00
b95f6ff777 Fixed spelling of Caribbean
I knew that first one didn't look right, but it's what the official app's source code had, so I went with it.
2019-07-29 21:48:20 -05:00
5ec3fbb802 Added ability to send light commands (on, off, set colors, etc.)
This implementation is barebones and only does what I was able to find easily in the official app's source code. I'd love to do more with this, so any pull requests adding functionality would be welcomed.

Closes https://github.com/parnic/node-screenlogic/issues/4
2019-07-29 21:37:36 -05:00
64edc5879b Added handling of the system disliking function arguments
Updated readme with failure events that are triggered
2019-06-22 10:10:13 -05:00
1aa1dddb49 Added ability to set pool or spa heat setpoint
Fixes #9
2019-06-21 00:12:29 -05:00
25188ddce9 To be safe, only pass the chunk of the buffer that's relevant 2019-03-26 19:16:23 -05:00
d70bc88f7c Actually fixed large message handling
We shouldn't be trying to read the message length out of the middle of a message when there are multiple segments.

Fixes https://github.com/parnic/node-screenlogic/issues/5 (for real this time, I hope...I don't have a way to test)
2019-03-26 07:10:18 -05:00
08c5457f2c Fixed handling of messages larger than 1024 bytes
Fixes https://github.com/parnic/node-screenlogic/issues/5
2019-03-25 20:02:58 -05:00
a09df2569b Added support for remote + passworded access
This password encoder was decompiled from the Android app then manually cleaned up and ported to Javascript. It ain't pretty, but it works.

I don't know that this is all necessarily the most correct or idiomatic way to implement these features, but I wanted to make sure the functionality got committed to help out people wanting to use this for smart home appliances (#1).
2019-02-22 16:06:11 -06:00
3c6b8ebcc7 Linter fixes 2018-04-28 23:06:11 -05:00
1f83be8e10 Fixed error
On my RPi3 I'm seeing a failure to find units because send() is demanding a Buffer or String. Uint8Array works for me in every other environment I've tried, but something about the RPi wants this to be a buffer. Having it as a buffer also works in other environments, thankfully.
2018-04-23 23:21:01 -05:00
e1c775b8a8 Added ability to set circuit state
This allows for, for example, turning on a water feature or changing pool/spa active status.
2018-04-16 19:49:01 -05:00
7907430e95 Added ability to connect by address and port 2018-03-31 11:24:37 -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
3262ac428b Added chem data
Added salt cell config
Added system version
Tweaked pool status to pre-adjust values

Chem data uses big endian encoding for most of its values (but not all) while everything else (so far) has used little endian. Chem data also encodes bits like whether there's a system error or not inside other pieces of data like salt levels. There are also bytes in the returned data that I don't know the significance of just yet.
Pool status was tweaked such that asking for pH is corrected down to its proper float representation (e.g. 7.60) instead of the integer representation that is sent by the system (760). Same for water balance/saturation. Salt now returns the proper value (scaled up by 50) instead of the value sent over by the system, which I guess is the maximum precision the system can provide.
2018-03-30 19:59:17 -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
af02f60791 Code cleanup
Much better organization and ease-of-use now that the proof of concept is established. Still an awful lot to do here, but I'm getting the hang of the whole node.js thing.
Also moved the actual test functionality out to a test script so the module itself doesn't execute anything.
2018-03-30 10:27:01 -05:00
7d4af8db5f Renamed to follow convention 2018-03-30 10:25:03 -05:00