-
Notifications
You must be signed in to change notification settings - Fork 35
Fix Hydrojet V02 bubbles handling #115
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ venv | |
| .coverage | ||
| .idea | ||
| node_modules | ||
| tests/LOGS/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,10 +126,14 @@ def normalize_aws_state(device_state: dict[str, Any]) -> dict[str, Any]: | |
| # V02 wave_state actual values: 0=OFF, 40=MEDIUM, 100=HIGH | ||
| # Map to V01 Airjet format (0/50/100) for AIRJET_V01_BUBBLES_MAP compatibility | ||
| # Note: Hydrojet uses 40 for MEDIUM, so no mapping needed there | ||
|
Comment on lines
127
to
128
|
||
| _LOGGER.debug("🔵 normalize_aws_state: INPUT wave_state=%s", wave_state) | ||
| if wave_state == 40: | ||
| wave_normalized = 50 # Map V02 MEDIUM (40) → V01 Airjet MEDIUM (50) | ||
| else: | ||
| wave_normalized = wave_state # 0 and 100 are same in both | ||
| _LOGGER.debug( | ||
| "🔵 normalize_aws_state: OUTPUT wave_normalized=%s", wave_normalized | ||
| ) | ||
|
|
||
| # Build normalized dict, only including fields with actual values | ||
| # This prevents None values from overwriting existing data during merges | ||
|
|
@@ -848,6 +852,8 @@ async def airjet_v01_spa_set_bubbles( | |
| Physical button cycles: OFF → HIGH → MEDIUM → OFF | ||
| Try sending absolute values first (simplest approach). | ||
| """ | ||
| _LOGGER.debug("🔵 airjet_v01_spa_set_bubbles: input level=%s", level) | ||
|
|
||
| # Map BubblesLevel enum to V02 wave_state values | ||
| value_map = { | ||
| BubblesLevel.OFF: 0, | ||
|
|
@@ -856,9 +862,45 @@ async def airjet_v01_spa_set_bubbles( | |
| } | ||
|
|
||
| target_value = value_map.get(level) | ||
| if target_value is not None: | ||
| await self.set_device_state(device_id, {"wave_state": target_value}) | ||
| _LOGGER.debug("Set bubbles to %s (wave_state=%d)", level.name, target_value) | ||
| _LOGGER.debug("🔵 airjet_v01_spa_set_bubbles: target_value=%s", target_value) | ||
|
|
||
| if target_value is None: | ||
| return | ||
|
|
||
| # Some V02 Hydrojet devices ignore a direct MEDIUM (40) command when currently OFF. | ||
| # Physical button cycles: OFF -> HIGH -> MEDIUM -> OFF. To reliably reach MEDIUM | ||
| # from OFF, send a HIGH (100) toggle first, wait briefly, then send MEDIUM (40). | ||
| try: | ||
| cached = self._state_cache.get(device_id) | ||
| current_wave = None | ||
| if cached and isinstance(cached.attrs, dict): | ||
| current_wave = cached.attrs.get("wave") | ||
| except Exception: | ||
| current_wave = None | ||
|
|
||
| # If requesting MEDIUM but currently OFF, perform a toggle sequence | ||
| if target_value == 40 and (current_wave is None or int(current_wave) == 0): | ||
| _LOGGER.debug( | ||
| "🔵 airjet_v01_spa_set_bubbles: current_wave=%s, sending toggle sequence HIGH->MEDIUM", | ||
| current_wave, | ||
| ) | ||
| # Send HIGH first | ||
| await self.set_device_state(device_id, {"wave_state": 100}) | ||
|
Comment on lines
+870
to
+888
|
||
| # Give device a short moment to apply | ||
| try: | ||
| await asyncio.sleep(1) | ||
| except Exception: | ||
| pass | ||
| # Now send MEDIUM | ||
| await self.set_device_state(device_id, {"wave_state": 40}) | ||
| _LOGGER.debug( | ||
| "🔵 Set bubbles to %s (wave_state=%d after toggle)", level.name, 40 | ||
| ) | ||
| return | ||
|
|
||
| # Default: send the requested absolute value | ||
| await self.set_device_state(device_id, {"wave_state": target_value}) | ||
| _LOGGER.debug("🔵 Set bubbles to %s (wave_state=%d)", level.name, target_value) | ||
|
|
||
| async def hydrojet_spa_set_bubbles( | ||
| self, device_id: str, level: BubblesLevel | ||
|
|
@@ -867,6 +909,10 @@ async def hydrojet_spa_set_bubbles( | |
|
|
||
| V02 uses same toggle approach as Airjet V02. | ||
| """ | ||
| _LOGGER.debug( | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A lot of log messages have been added in this PR. This appears to be to aid "debugging by print statements" in the absence of a proper debugger connection. Furthermore, they all contain emojis, which is inconsistent with the existing style, and strongly hints at an unreviewed AI generated change. Please can these be stripped back to an appropriate level. |
||
| "🔵 hydrojet_spa_set_bubbles: delegating to airjet_v01_spa_set_bubbles with level=%s", | ||
| level, | ||
| ) | ||
| # V02 uses toggle approach (same as Airjet V02) | ||
| await self.airjet_v01_spa_set_bubbles(device_id, level) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this specific to your environment? I don't recall ever seeing this generated.