Skip to content

Commit 40230b2

Browse files
committed
determine state based on supply and exact air rpm
1 parent 970b1ea commit 40230b2

File tree

1 file changed

+11
-8
lines changed
  • custom_components/easycontrols

1 file changed

+11
-8
lines changed

custom_components/easycontrols/fan.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
VARIABLE_PARTY_MODE,
2424
VARIABLE_PARTY_MODE_FAN_STAGE,
2525
VARIABLE_PARTY_MODE_DURATION,
26-
VARIABLE_PERCENTAGE_FAN_SPEED,
26+
VARIABLE_SUPPLY_AIR_RPM,
27+
VARIABLE_EXTRACT_AIR_RPM,
2728
VARIABLE_STANDBY_MODE
2829
)
2930

@@ -42,7 +43,8 @@ def __init__(self, hass, controller: ThreadSafeController, name: str):
4243
self._controller = controller
4344
self._name = name
4445
self._fan_stage = None
45-
self._percentage_fan_speed = None
46+
self._supply_air_rpm = None
47+
self._extract_air_rpm = None
4648
self._attributes = {}
4749

4850
@property
@@ -89,7 +91,8 @@ def speed(self):
8991

9092
@property
9193
def is_on(self):
92-
return not self._percentage_fan_speed is None and self._percentage_fan_speed > 0
94+
return ((not self._supply_air_rpm is None and self._supply_air_rpm > 0) or
95+
(not self._extract_air_rpm is None and self._extract_air_rpm > 0))
9396

9497
async def async_set_speed(self, speed: str):
9598
self._controller.set_variable(
@@ -125,7 +128,8 @@ def start_party_mode(self, speed: str, duration: int):
125128
return
126129

127130
self._controller.set_variable(
128-
VARIABLE_PARTY_MODE_FAN_STAGE, self.speed_list.index(speed) + 1, "{:d}"
131+
VARIABLE_PARTY_MODE_FAN_STAGE, self.speed_list.index(
132+
speed) + 1, "{:d}"
129133
)
130134
self._controller.set_variable(
131135
VARIABLE_PARTY_MODE_DURATION, duration, "{:d}"
@@ -135,10 +139,8 @@ def start_party_mode(self, speed: str, duration: int):
135139
)
136140

137141
async def async_update(self):
138-
self._percentage_fan_speed = float(
139-
self._controller.get_variable(
140-
VARIABLE_PERCENTAGE_FAN_SPEED, 8, float)
141-
)
142+
self._supply_air_rpm = self._controller.get_variable(VARIABLE_SUPPLY_AIR_RPM, 8, float)
143+
self._extract_air_rpm = self._controller.get_variable(VARIABLE_EXTRACT_AIR_RPM, 8, float)
142144
self._fan_stage = int(
143145
self._controller.get_variable(VARIABLE_FAN_STAGE, 1, int))
144146

@@ -184,6 +186,7 @@ async def async_update(self):
184186
"operation_mode": operation_mode
185187
}
186188

189+
187190
async def async_setup_entry(hass, entry, async_add_entities):
188191
_LOGGER.info("Setting up Helios EasyControls fan device.")
189192

0 commit comments

Comments
 (0)