bstillitano / homebridge-actron-neo

Homebridge plugin for Actron Neo Controller
Apache License 2.0
2 stars 1 forks source link

Failed to return correct currentMode of fanMode if Continuous Fan is on #17

Open Char1ei opened 1 month ago

Char1ei commented 1 month ago

Sample debug logs: Failed To Get Master Current Fan Mode -> LOW+CONT

Issue: the switch statement is not functioning correctly due to the use of the || operator. """ case FanMode.AUTO || FanMode.AUTO_CONT: currentMode = 100; break; """

Potential Fixing: """ case FanMode.AUTO: case FanMode.AUTO_CONT: currentMode = 100; break; """

Thanks.

bstillitano commented 1 month ago

@Char1ei, || is a valid OR operator is it not? I'm not what you might call a typescript expert, so are you able to explain for me why you think this is wrong? You're also welcome to create a PR if you think you have a fix for your error.

In my testing, fan modes are working fine and I'm not seeing that error on my end. Do you have some repro steps?

Char1ei commented 1 month ago

@bstillitano ,The case statements can include only constants. It cannot be a variable or an expression.

bstillitano commented 1 month ago

Ok, thank you, I wasn’t aware of that. It’s strange to me that it runs at all in that case, coming from a Swift background.

Did you want to raise a PR with a fix or wanting me to do it? I’m asking as, if you do it, you’ll get contributor recognition on the repository. Either way I’m happy with your preference.

On Mon, 19 Aug 2024 at 9:16 pm, Lei ZHAO @.***> wrote:

@bstillitano https://github.com/bstillitano ,The case statements can include only constants. It cannot be a variable or an expression.

— Reply to this email directly, view it on GitHub https://github.com/bstillitano/homebridge-actron-neo/issues/17#issuecomment-2296326294, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJVMONW3IMIPUZAUA7MMMBTZSHHZ3AVCNFSM6AAAAABMPQ44Q2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJWGMZDMMRZGQ . You are receiving this because you were mentioned.Message ID: @.***>

Char1ei commented 1 month ago

All good, you could fix it directly.