Skip to content

Handle zone climate turnoff when mode is Heat or Cool only#360

Open
JDcongote wants to merge 1 commit intokamaradclimber:mainfrom
JDcongote:fix350
Open

Handle zone climate turnoff when mode is Heat or Cool only#360
JDcongote wants to merge 1 commit intokamaradclimber:mainfrom
JDcongote:fix350

Conversation

@JDcongote
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Owner

@kamaradclimber kamaradclimber left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

I made a few small comments.

Also I'm concerned about this not playing nicely with the retry logic added in recent patches.
Have you been able to test this locally?

async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
if hvac_mode == HVACMode.HEAT:
# If operating mode is 0 (system is off), turn on main power first
if self._operating_mode == OperatingMode(0):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This block of code is repeated twice, I think we should factorize it outside of the conditional.

0,
False,
"utf-8",
)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

my experience is that heatpump needs a bit of time to accept commands after turning up. I suggest to add an async sleep instruction (2s should be sufficient)

if new_operating_mode == OperatingMode(0):
# Turn off the entire system via main power switch
_LOGGER.debug(
f"{self._climate_type()} Turning off zone {self.zone_id} would leave no valid mode, turning off main power instead"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

nitpick: I would suggest to phrase it in a way that does not suppose understanding of the underlying issue this PR is fixing.
What would you think of:

Removing last active mode for zone {zone_id}, turning off main power

?

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.

2 participants