parnic / node-screenlogic

Pentair ScreenLogic Javascript library using Node.JS
https://www.npmjs.com/package/node-screenlogic
MIT License
52 stars 14 forks source link

Timeout / Parameter Failure on setCircuitAsync #72

Closed halfhp closed 1 year ago

halfhp commented 1 year ago

Hello and thanks so much for putting this library together! Really amazing work!

I am attempting to turn a circuit on and getting a timeout: (I used getAllCircuitNamesAsync to look up the circuitId)

client.circuits.setCircuitStateAsync(72, 1)

The timeout error result I think might be a red herring though as I see the following in the debug logs:

  sl:unit [0] sending set circuit state command: controllerId: 0, circuitId: 72, circuitState: 1... +0ms
  sl:unit received 31 message of length 8 +9ms
  sl:unit   it is a parameter failure. +0ms

I've tried multiple circuits with the same result. I've also tried using both the local and remote connection approaches but this does not appear to make a difference. I am however able to successfully turn the pool light on and off using sendLightCommandAsync so I know that at some level things are working.

I checked the version of my equipment using getVersionAsync:

POOL: 5.2 Build 736.0 Rel

This isn't the latest version of the firmware but it is a version listed in this project's notes as one of the tested versions. Having said that I am wondering if maybe this version is only partially supported? I'd update my firmware but I am on a Mac and the screenlogic firmware updater unfortunately doesnt work on any remotely recent version of the Mac OS.

Any ideas what might be going on?

parnic commented 1 year ago

This is what the readme says about the circuit id property:

SLSetCircuitStateMessage

Passed as an argument to the emitted circuitStateChanged event.

Properties

Does that help?

halfhp commented 1 year ago

Thanks for the response!

I just took a quick look and I see how to get SLControllerConfigData but not quite sure where to retrieve SLControllerConfig. I might be blind but I couldnt find details about that in the readme.

It's probably the wrong object but checking out SLControllerConfigData, I see a circuitArray property which show a spa circuitId consistent with what I was previously using:

Screenshot 2023-06-27 at 9 14 56 AM

EDIT: I did a quick check in the library source and it looks like there is no bodyArray property or SLControllerConfig object. Might these have been renamed at some point? I looked in the commit history and could not find any such change, but perhaps I am looking in the wrong place.

EDIT2: I am officially an idiot. I was using nameIndex not circuitId. After fixing that it's working! Thanks so much for your help!

parnic commented 1 year ago

Glad you figured it out! I'll get the docs updated to clarify :)