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

CeilingFan Light support and modifications to existing Light classes #194

Merged
merged 17 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion custom_components/echonetlite/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@
from pychonet.lib.const import ENL_CUMULATIVE_POWER, ENL_INSTANTANEOUS_POWER
from pychonet.lib.epc_functions import DATA_STATE_CLOSE, DATA_STATE_OPEN
from pychonet.CeilingFan import (
ENL_BUZZER,
ENL_FANSPEED_PERCENT,
ENL_FAN_DIRECTION,
ENL_FAN_LIGHT_BRIGHTNESS,
ENL_FAN_LIGHT_COLOR_TEMP,
ENL_FAN_LIGHT_MODE,
ENL_FAN_LIGHT_NIGHT_BRIGHTNESS,
ENL_FAN_LIGHT_STATUS,
ENL_FAN_OSCILLATION,
)

Expand Down Expand Up @@ -1190,7 +1196,17 @@
# Home Air Conditioner
0x30: {ENL_HVAC_MODE, ENL_HVAC_SET_TEMP, ENL_HVAC_SILENT_MODE},
# Ceiling fan
0x3A: {ENL_FANSPEED_PERCENT, ENL_FAN_DIRECTION, ENL_FAN_OSCILLATION},
0x3A: {
ENL_FANSPEED_PERCENT,
ENL_FAN_DIRECTION,
ENL_FAN_OSCILLATION,
ENL_FAN_LIGHT_STATUS,
ENL_FAN_LIGHT_MODE,
ENL_FAN_LIGHT_BRIGHTNESS,
ENL_FAN_LIGHT_COLOR_TEMP,
ENL_FAN_LIGHT_NIGHT_BRIGHTNESS,
ENL_BUZZER,
},
},
0x02: {
0x60: {ENL_OPENING_LEVEL, ENL_BLIND_ANGLE, ENL_OPENCLOSE_STATUS},
Expand Down
10 changes: 7 additions & 3 deletions custom_components/echonetlite/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
from pychonet.lib.const import ENL_STATUS

from pychonet.lib.eojx import EOJX_CLASS
from pychonet.CeilingFan import (
ENL_FANSPEED_PERCENT,
ENL_FAN_DIRECTION,
ENL_FAN_OSCILLATION,
)
from homeassistant.components.fan import FanEntity, FanEntityFeature
from homeassistant.const import (
PRECISION_WHOLE,
Expand All @@ -13,9 +18,6 @@
DATA_STATE_ON,
DOMAIN,
ENL_FANSPEED,
ENL_FANSPEED_PERCENT,
ENL_FAN_DIRECTION,
ENL_FAN_OSCILLATION,
)

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -71,6 +73,8 @@ def __init__(self, connector, config):
self._attr_should_poll = True
self._attr_available = True

self._attr_speed_count = getattr(self._connector._instance, "SPEED_COUNT", 100)

self._set_attrs()
self.update_option_listener()

Expand Down
Loading
Loading