57 Commits

Author SHA1 Message Date
b983972422 Update version, vulnerable deps
All checks were successful
Node.js CI / build (18.x) (push) Successful in 16s
Node.js CI / build (20.x) (push) Successful in 16m20s
Node.js CI / build (22.x) (push) Successful in 12s
2025-03-21 12:04:59 -05:00
dc2cd4ec4c Update comment 2025-03-21 12:03:20 -05:00
b37f96fc08 Update SetHeatMode to support other heater types
Thanks to @afri in #1
2025-03-21 12:03:07 -05:00
458048b58a Reinstate ws WebSocket library
All checks were successful
Node.js CI / build (18.x) (push) Successful in 16m17s
Node.js CI / build (20.x) (push) Successful in 11s
Node.js CI / build (22.x) (push) Successful in 11s
In some environments, such as MagicMirror modules, the WebSocket class is not defined. This is apparently a client-only class and generally only exists in browsers, but I'm confused how the unit tests were passing when run against just node. Either way, this means we have to disable the test again since ws is not compatible with jest-websocket-mock, and I haven't found an alternative mock server that is.
v0.4.0
2025-01-25 12:06:01 -06:00
829a90dd0e Update dependencies for vulns
All checks were successful
Node.js CI / build (18.x) (push) Successful in 12s
Node.js CI / build (20.x) (push) Successful in 11s
Node.js CI / build (22.x) (push) Successful in 12s
2025-01-21 19:28:13 -06:00
cc1a866233 Update changelog, version
All checks were successful
Node.js CI / build (18.x) (push) Successful in 12s
Node.js CI / build (20.x) (push) Successful in 11s
Node.js CI / build (22.x) (push) Successful in 11s
v0.3.0
2025-01-15 22:45:01 -06:00
f8e2aa0f3e Get basic test up and passing
This replaces the 'ws' library with built-in websockets so that we can mock a server and successfully connect to it. A simple test verifies that Unit is handling a message request and response as we expect it to.
2025-01-13 13:06:58 -06:00
6c79e35e04 Fix VSCode launch config 2025-01-13 12:25:02 -06:00
331cea7007 Update README.md
All checks were successful
Node.js CI / build (18.x) (push) Successful in 11s
Node.js CI / build (20.x) (push) Successful in 11s
Node.js CI / build (22.x) (push) Successful in 11s
2025-01-09 16:58:19 -06:00
7976348197 Pass error along with error event
All checks were successful
Node.js CI / build (18.x) (push) Successful in 11s
Node.js CI / build (20.x) (push) Successful in 10s
Node.js CI / build (22.x) (push) Successful in 11s
v0.2.2
2025-01-08 21:16:46 -06:00
2ffed2204b Fix timeouts and errors not emitting "close" v0.2.1 2025-01-08 21:11:45 -06:00
617c8df511 Add support for tests
I was trying to make a websocket test, but the "ws" library doesn't appear to be easily mocked and I prefer to use it over the built-in WebSocket. So we'll see what I can do in the future.
2025-01-08 21:04:50 -06:00
f657b8e8aa Minor formatting update
All checks were successful
Node.js CI / build (18.x) (push) Successful in 27s
Node.js CI / build (20.x) (push) Successful in 8s
Node.js CI / build (22.x) (push) Successful in 9s
2025-01-07 00:14:40 -06:00
d3c1a874f2 Don't package logs
These are only useful for development and tend to be a scratch area on my local machine anyway.
2025-01-06 17:54:11 -06:00
ddabc810c2 Copy linted files to their destinations 2025-01-05 17:00:07 -06:00
846157a094 Satisfy linter 2025-01-05 16:59:04 -06:00
3149e42e46 Attempt to populate package.jsons in a more portable way 2025-01-05 16:58:12 -06:00
516b3935d2 Update changelog, version v0.2.0 2025-01-05 16:45:02 -06:00
92d9341eca First pass at a real readme 2025-01-05 16:43:33 -06:00
1f3bf02518 Use GetRequest helper method
This ensures we populate `messageID` and is generally a good "best practice" to use in example code.
2025-01-05 16:43:18 -06:00
3d4d6b930b Minor type/doc update
I've seen this STATUS parameter have different values with some messages, so it no longer makes sense to attempt to lock in the type to one of these strings.
2025-01-05 16:20:49 -06:00
3e40e015d9 Add list-objects script
This can be used to find all the controllable circuits in your system.

When invoked with `npm run list-objects` or `node esm/list-objects.js` it will search for units, then request and format+display the objects to the user. There are a few arguments available:
* --controllerAddr=1.2.3.4
  * Specifies the IntelliCenter controller's address directly which skips the searching phase.
* --controllerPort=1234
  * Specifies the port to use when connecting to the controller (probably should never use this; does nothing if --controllerAddr is not specified)
* --multicastAddr=1.2.3.4
  * Specifies the address of the network interface to send the multicast search packet on (useful if you have multiple adapters/interfaces and the system is picking the wrong one; does nothing if --controllerAddr is specified)
* --onlyToggleable
  * Only displays objects which can be toggled on or off

Note that if you are invoking this with `npm run list-objects` then the arguments must be specified after an empty `--` so that they are given to the script rather than npm itself. Example: `npm run list-objects -- --controllerAddr=10.0.0.41 --onlyToggleable`
2025-01-05 16:20:49 -06:00
c445a844ee Split into commonjs and ESM outputs
This allows require() and import to work for even better compatibility between CJS and ESM consumers.

I dislike that this kills our ability for top-level awaits in example.ts, but seeing as how my primary use case for this library is a commonjs module, I think this is a fair trade-off.

Also changed "messages" to not encapsulate its export under the name "messages" to remove some repetition in importing "messages" and still needing to do "messages." to get the methods out. Now it's simple to import each message by name or group them under something like "messages" as desired on a per-library-user basis.

Refs:
* https://www.kravchyk.com/typescript-npm-package-json-exports/
* https://arethetypeswrong.github.io/
* https://evertpot.com/universal-commonjs-esm-typescript-packages/
2025-01-05 15:34:07 -06:00
861fec9565 Update changelog, add markdown linting v0.1.0 2025-01-05 12:25:08 -06:00
69c2c67336 Increase package version 2025-01-05 11:59:47 -06:00
50d71a2858 Add GetCircuitStatus message 2025-01-05 11:59:03 -06:00
abe9ba7d95 Rename Item to Object
The API all calls these objects so best to go with the flow.

This is a breaking change.
2025-01-05 11:56:53 -06:00
21d62549d3 Increase package version v0.0.2 2025-01-04 15:51:26 -06:00
9455ae224c Update vscode config 2025-01-04 15:51:19 -06:00
e8ebfe8e02 Add connected event
This enables event-based consumers to more easily react to connection completion.
2025-01-04 15:51:01 -06:00
3031bc2079 Update exports, rename example
This gives better control over importing in non-module environments and removes the example code as the default import which was running when loading up the library.
2025-01-04 15:50:24 -06:00
9e332038c6 Add ability to specify multicast interface
When you have multiple network adapters/interfaces, the system can choose the wrong one. This allows you to be explicit about which one you broadcast on.
2025-01-04 15:45:22 -06:00
033627d698 Add more docs, error handling 2025-01-04 13:15:08 -06:00
f59cc3438c Add connection events 2025-01-04 13:09:07 -06:00
25acdd9481 Add documentation v0.0.1 2025-01-04 12:27:44 -06:00
ab4898c20b Add pings, debug logs, socket cleanup to Unit
At some point I need to stress-test this to see how long the connection can stay open, and what happens when it goes down.
2025-01-04 12:05:29 -06:00
5ae6cac549 Add ability to subscribe for updates to properties
Using SubscribeToUpdates() will cause the Unit to trigger a "notify" event any time the subscribed property changes, containing the new value of the property.

I don't know how/if you can unsubscribe from something as I don't see the official app ever doing that.
2025-01-04 11:22:12 -06:00
40b3c2dc98 Add GetSchedule message 2025-01-04 10:47:12 -06:00
60e57afea2 Add more fields, documentation 2025-01-04 10:46:32 -06:00
834086160d Add directory to ignored files for formatter 2025-01-04 10:45:51 -06:00
905cb83310 Satisfy linter 2025-01-03 20:30:15 -06:00
e306a62e24 Add messages, cleanup
This adds a bunch of messages to retrieve and set various things on the controller. It also groups the messages under one export to simplify the process of using and discovering many of them from one location.

Some of these are WIP/probably not portable to other systems.

This also adds the ability to set multiple circuits at once.
2025-01-03 20:27:30 -06:00
7daf47ac18 Fleshing out more messages
Getting a feel for how the development experience is with this setup. With the previous idea of abstracting the request into a getSystemInfo() function on the Unit itself, the documentation for what to expect from GetSystemInfo either had to live in two places or be presented as a link to the canonical location. Neither felt great, so I think the caller can just call send(GetRequest()) themselves.

Also added the first "set" message which is capable of toggling a body or circuit.
2025-01-03 16:01:58 -06:00
ceb9299d03 Create Unit class to make queries easy 2025-01-03 14:58:31 -06:00
0c946505b0 Use existing variable for request type 2025-01-03 13:57:36 -06:00
c7e2ab7675 Initial request/response object structure
No idea if this will be the best way to represent this stuff long-term, but it's working at the moment. I have some reservations about attempting to list all the possible ResponseParam keys, but I'm already this far in and it would be nice if it worked out...
2025-01-03 10:57:54 -06:00
b186561d24 Finish Finder implementation
This can correctly find and return IntelliCenter units on the local network now.

Cleaned up a bunch of Finder code and added back in "debug" module logging.

Fixed up types in Dns module so we can use instanceof
2025-01-02 17:03:28 -06:00
4ccdf837d9 Give artifact unique name per job 2025-01-02 15:27:40 -06:00
a885e3fb2c Update dist files 2025-01-02 15:20:44 -06:00
74a91c2e13 Minor fixes
Add a field for the raw ipv4 address of an A record (encoded in an int)
Rename "remaining data" to "rdata" since that's what the dns spec calls it
Update Srv record rdata block to be handled the same as other records
Fix A record endOffset to have the correct value
2025-01-02 15:20:02 -06:00