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

Inconsistencies with the handling of bodyType in the bodies methods #76

Closed mottihoresh closed 2 months ago

mottihoresh commented 2 months ago

I have been playing around with setting the heat on and off, and I've discovered that the bodies.setHeatModeAsync does not work properly. it will only accept BodyIndex.SPA or BodyIndex.POOL which are either 1 or 0.

The bodies.setHeatModeAsync then calls the sendHeatModeMessage, unlike the two other methods sendCoolSetPointMessage and sendSetPointMessage the sendHeatModeMessage deducts 1 form the bodyType value. essentially, when using BodyIndex.SPA the data is set against the POOL, and it's impossible to set the SPA heat mode directly unless you call the sendHeatModeMessage method directly.

The following:

    client.bodies.setHeatModeAsync(BodyIndex.POOL, HeatModes.HEAT_MODE_HEATPUMP);
    client.bodies.setHeatModeAsync(BodyIndex.SPA, HeatModes.HEAT_MODE_HEATPUMP);

essentially translates to:

    client.controller.bodies.sendHeatModeMessage(-1, 3)
    client.controller.bodies.sendHeatModeMessage(0, 3)
parnic commented 2 months ago

Thanks for the report, I'll take a look.