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

Added fan modes #28

Merged
merged 5 commits into from
Feb 24, 2022
Merged

Added fan modes #28

merged 5 commits into from
Feb 24, 2022

Conversation

nprez83
Copy link
Contributor

@nprez83 nprez83 commented Feb 24, 2022

Proposed Changes

Added fan modes to be able to implement fan control in main integration

Related Issues

Checklist

  • Change has been tested and works on my device(s).

Added fan allowed modes to be able to implement fan control in lyric integration.
The way it is currently it never passes mode, only fanMode.
@timmo001 timmo001 merged commit 104690e into timmo001:master Feb 24, 2022
@nprez83
Copy link
Contributor Author

nprez83 commented Mar 7, 2022

Quick question @timmo001, I was trying to test the code changes I've made to the climate.py file in my lyric integration to enable fan control, but I'm still getting the error stating LyricDevice does not have a fan property, which is what this PR should have accomplished. I'm still new to pull requests etc. so just wondering how to go about getting my updated climate.py to access the updated aiolyric. Thanks in advance.

@amokrunner
Copy link

@nprez83 , have you already updated the HA lyric integration to work with this? I was hacking at it until I saw this and wonder if maybe it's already been done. Thanks!

@amokrunner amokrunner mentioned this pull request Jun 22, 2022
@nprez83
Copy link
Contributor Author

nprez83 commented Jun 23, 2022

Hi @amokrunner, I had the code ready to go, but wasn't able to implement it as the aiolyric version hadn't been yet bumped to include the changes above, so the properties associated with fan modes were not yet available for lyric objects. Not sure if the aiolyric version has gotten bumped to this yet or not. Here are the changes I had ready to implement. Happy to throw in a PR once we confirm that the aiolyric version has been updated. I looked at the changelogs for 2022.4-6 and did not see that change listed.

  1. Add the following flags to the climate.const import statement:
    ATTR_FAN_MODE,
    FAN_AUTO,
    FAN_ON,
    FAN_DIFFUSE,
    SUPPORT_FAN_MODE,
  1. Add SUPPORT_FAN_MODE flag to SUPPORT_FLAGS_LCC definition for both TCC and LCC devices

  2. Add the following code after the HVAC_ACTIONS definition:

LYRIC_FAN_AUTO = "Auto"
LYRIC_FAN_ON = "On"
LYRIC_FAN_CIRCULATE = "Circulate"

LYRIC_FAN_MODES = {
    FAN_AUTO: LYRIC_FAN_AUTO,
    FAN_ON: LYRIC_FAN_ON,
    FAN_DIFFUSE: LYRIC_FAN_CIRCULATE,
}

FAN_MODES = {
    LYRIC_FAN_AUTO: FAN_AUTO,
    LYRIC_FAN_ON: FAN_ON,
    LYRIC_FAN_CIRCULATE: FAN_DIFFUSE,
}
  1. Add the following code within the init
        # Setup supported fan modes
        if LYRIC_FAN_AUTO in device.fan.allowedModes:
            self._fan_modes.append(FAN_AUTO)

        if LYRIC_FAN_ON in device.fan.allowedModes:
            self._fan_modes.append(FAN_ON)

        if LYRIC_FAN_CIRCULATE in device.fan.allowedModes:
            self._fan_modes.append(FAN_DIFFUSE)"""
  1. Add the following properties:
    @property
    def fan_mode(self) -> str:
        """Return the hvac mode."""
        return FAN_MODES[self.device.fan.changeableValues.mode]

    @property
    def fan_modes(self) -> list[str]:
        """List of available fan modes."""
        return self._fan_modes

  1. Lastly, define async_set_fan_mode:
    async def async_set_fan_mode(self, fan_mode: str) -> None:
        """Set fan mode."""
        _LOGGER.debug("Fan mode from frontend: %s", fan_mode)
        _LOGGER.debug("Fan mode passed to lyric: %s", LYRIC_FAN_MODES[fan_mode])
        try:
            await self._update_fan(
                self.location,
                self.device,
                mode=LYRIC_FAN_MODES[fan_mode]
            )
        except LYRIC_EXCEPTIONS as exception:
            _LOGGER.error(exception)
        await self.coordinator.async_refresh()

@nprez83
Copy link
Contributor Author

nprez83 commented Jul 3, 2022

I just saw that 2022.7 comes with python 3.10, which I believe will have the updated version of aiolyric, including the changes related to fan modes. Once that happens I'll test out the changes I delineated above and will submit a PR.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants