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

Adding Climate and Fan Support #20

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

granvillebarker
Copy link

Adding fan controller support.

Copy link
Owner

@lawtancool lawtancool 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 these changes! Please see my review comments

@@ -37,7 +37,7 @@ async def async_setup_entry(

for item in items_of_category:
try:
if item["type"] == CONTROL4_ENTITY_TYPE and item["id"]:
Copy link
Owner

Choose a reason for hiding this comment

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

What does this do? Why do we need to check for "fan" inside the light integration?

Copy link
Author

Choose a reason for hiding this comment

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

The fan controllers get detected as lights, that's what made me tackle fan controllers. They would add a bunch of errors to my logs.

Copy link
Owner

Choose a reason for hiding this comment

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

Ah that makes sense, could you add a short comment in the code here just explaining that so it doesn't get accidentally removed in the future?

@@ -213,8 +213,9 @@ def __init__(
)
self._device_class = device_class
self._extra_state_attributes["alarm_zone_id"] = alarm_zone_id
self._extra_state_attributes["ContactState"] = bool(
Copy link
Owner

Choose a reason for hiding this comment

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

What do these changes do? They seem unrelated to fan/climate support. Could you separate these changes out into a different PR?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I have many more changes to the binary_sensor, I have found several different messages sent by different c4 binary sensors around the house. I am not good with git, but I will try!

Comment on lines +353 to +355
# _LOGGER.debug( "Emergency Found: %s",
# self._extra_state_attributes["HVAC_MODES_LIST"],
# )
Copy link
Owner

Choose a reason for hiding this comment

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

Could you remove commented out code here and elsewhere in this PR

Copy link
Author

Choose a reason for hiding this comment

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

Yes

try:
if self.hvac_mode == HVACMode.HEAT_COOL:
if low_temp and high_temp:
if high_temp - low_temp < MIN_TEMP_RANGE:
Copy link
Owner

Choose a reason for hiding this comment

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

Why do we need to enforce a MIN_TEMP_RANGE in Home Assistant? Does Control4 not enforce this on the device side?

@property
def percentage_step(self) -> float:
"""Return the step size for percentage."""
return 25
Copy link
Owner

Choose a reason for hiding this comment

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

Do all fans have a 25% step size?

Copy link
Author

Choose a reason for hiding this comment

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

Probably not, all the control4 fan controllers I have have 4 preset modes. I will dig a little and see what more I can find out here.

Copy link
Owner

Choose a reason for hiding this comment

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

It would be ideal if we could determine this from the Control4 API response, if they provide that information in the device info

import logging
from typing import Any

from pyControl4.fan import C4Fan
Copy link
Owner

@lawtancool lawtancool Dec 19, 2023

Choose a reason for hiding this comment

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

I realized that pyControl4 doesn't currently have a fan class. Please open a PR there with the fan changes as well. We will need to merge the pyControl4 changes before this integration can be merged.

https://github.com/lawtancool/pyControl4

@lawtancool
Copy link
Owner

Hey @granvillebarker are you still able to work on this PR?

@lawtancool lawtancool changed the title Adding Fan Suppport Adding Climate and Fan Support Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants