Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (#79): skip power state for non supported device for get & set thermostat mode #88

Closed
wants to merge 1 commit into from

Conversation

nyirsh
Copy link
Contributor

@nyirsh nyirsh commented Jan 1, 2024

Related to issue #79

The issue was caused by handlePowerGet not being able to retrieve the device power state on unsupported devices.
The solution proposed by @zouma45 was only implemented on handleTargetStateSet but that function was also called by handleTargetStateGet, so I did implement it in there too.
I also made the flag isPowerSupported global to prevent handlePowerGet being called unnecessarily.

I did test this by directly modifying the scripts on my homebridge instance and reporting the same changes on the repo but I never coded a plugin for homebridge so I don't know if there is a better way to handle the isPowerSupported flag.

@nyirsh nyirsh requested a review from joeyhage as a code owner January 1, 2024 17:17
@nyirsh nyirsh changed the title fix: skip power state for non supported device for get & set thermostat mode (#81) fix (#79): skip power state for non supported device for get & set thermostat mode Jan 1, 2024
@joeyhage
Copy link
Owner

joeyhage commented Jan 1, 2024

Thanks for submitting a pull request, @nyirsh! I'm reviewing it now.

@@ -132,7 +133,15 @@ export default class ThermostatAccessory extends BaseAccessory {
}

async handleTargetStateGet(): Promise<number> {
Copy link
Contributor

@zouma45 zouma45 Jan 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to add the the try catch part for getState indeed, thanks for the update :), looks good to me, I am testing your code on my device too

joeyhage added a commit that referenced this pull request Jan 1, 2024
Copy link
Owner

@joeyhage joeyhage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged these changes in #90 which was released in v2.0.7

@joeyhage joeyhage closed this Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants