feat: add fountain working mode commands to FOUNTAIN_COMMAND#56
Merged
Jezza34000 merged 1 commit intoJezza34000:mainfrom Apr 1, 2026
Merged
Conversation
Add missing BLE byte sequences for MODE_NORMAL, MODE_SMART, MODE_STANDARD and MODE_INTERMITTENT to FOUNTAIN_COMMAND. These actions were already defined in FountainAction but had no corresponding byte sequence in FOUNTAIN_COMMAND, making it impossible to change the working mode via send_ble_command(). Byte format: [cmd=220, type=1, length=3, start_data=0, power=1, mode, op_type=1] - MODE_NORMAL / MODE_STANDARD: mode byte = 1 - MODE_SMART / MODE_INTERMITTENT: mode byte = 2 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
aavdberg
added a commit
to aavdberg/homeassistant_petkit
that referenced
this pull request
Mar 31, 2026
… mode - Remove FOUNTAIN_COMMAND.update() patch from __init__.py. The working mode commands (MODE_NORMAL, MODE_SMART, MODE_STANDARD, MODE_INTERMITTENT) are now part of pypetkitapi directly (see Jezza34000/py-petkit-api#56). - Remove 'battery' (mode 3) from FOUNTAIN_WORKING_MODE_CTW3 and all translations. Battery mode is a hardware/power-source state entered automatically when running on battery; it cannot be set by the user via BLE. Selecting it would silently do nothing. Removed from const.py and en/nl/uk translation files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds missing BLE command mappings so PyPetkit can switch supported fountains between working modes via send_ble_command().
Changes:
- Added
MODE_NORMAL,MODE_SMART,MODE_STANDARD, andMODE_INTERMITTENTentries toFOUNTAIN_COMMAND. - Mapped each mode action to its corresponding BLE byte sequence (aligned with existing POWER_ON/OFF structure).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Jezza34000
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
\FountainAction\ already defines \MODE_NORMAL, \MODE_SMART, \MODE_STANDARD\ and \MODE_INTERMITTENT, but none of these had a corresponding entry in \FOUNTAIN_COMMAND. This made it impossible to change the working mode of W4/W5/CTW2/CTW3 fountains via \send_ble_command().
Changes
Added four entries to \FOUNTAIN_COMMAND\ in \command.py:
Byte format
[cmd=220, type=1, length=3, start_data=0, power=1, mode_byte, op_type=1]\
This was verified against the BLE protocol used by PetkitW5BLEMQTT and matches the existing POWER_ON/OFF command structure.
This PR is needed to support the water fountain working mode select entity in the Home Assistant integration (homeassistant_petkit PR #202).