Skip to content

AP300: add number platform and controls support - #234

Open
happytechca wants to merge 1 commit into
Patrick762:mainfrom
happytechca:ap300-device
Open

AP300: add number platform and controls support#234
happytechca wants to merge 1 commit into
Patrick762:mainfrom
happytechca:ap300-device

Conversation

@happytechca

Copy link
Copy Markdown

Summary

Adds Home Assistant support for AP300 device controls introduced in bluetti-bt-lib PR #61:

  • New number platform (number.py): slider entities for battery SOC range start/end (0–100%), with validation guard preventing start ≥ end
  • Platform.NUMBER added to PLATFORMS list in __init__.py
  • Translations (en/de/pt): added ctrl_charge_from_grid switch, ctrl_working_mode select with state labels, soc_range_start/soc_range_end number entities
  • FieldCategory: added CTRL_WORKING_MODE, CTRL_CHARGE_FROM_GRID, BATTERY_SOC_RANGE_START, BATTERY_SOC_RANGE_END to CONFIGS list

Dependencies

  • Requires bluetti-bt-lib PR #61 for NumberField, WorkingMode enum, and the expanded AP300 device model
  • Control writes on encrypted devices (like AP300) require bluetti-bt-lib PR #59 (encrypted write support) and PR #60 (persistent BLE connection)

Notes

  • The number platform follows the same write pattern as existing switch/select platforms (BleakScanner → establish_connection → DeviceWriter)
  • SOC range validation raises ServiceValidationError with a descriptive message if the user tries to set invalid ranges
  • Tested on a real AP300 device

🧪 Testing with full AP300 support (before PRs are merged)

If you have an AP300 and want to test the full working integration (sensors + controls including encrypted writes and persistent BLE connection), you can use the combined test branches. These include the work from PRs #59, #60, and #61 all together.

Step-by-step instructions

1. Install the custom integration via HACS

  1. Open Home Assistant → HACSIntegrations
  2. Click the three dots (⋮) in the top right → Custom repositories
  3. Add this repository URL:
    https://github.com/happytechca/hassio-bluetti-bt
    
    Category: Integration
  4. Click Add, then find Bluetti BT in HACS and click Download
  5. When prompted for a version/branch, select the ap300-combined branch

2. Restart Home Assistant

Go to SettingsSystemRestart

3. Add your Bluetti device

  1. Go to SettingsDevices & ServicesAdd Integration
  2. Search for Bluetti BT
  3. Select your AP300 from the discovered devices

What you get

  • All AP300 sensors (power, voltage, current, frequency, time remaining)
  • Switch controls (AC/DC output, ECO modes, power lifting, charge from grid)
  • Select controls (charging mode, working mode, display timeout)
  • Number sliders (battery SOC range min/max with validation)
  • Encrypted BLE writes with persistent connection (fast command response)

Reverting back

To go back to the official version once the PRs are merged:

  1. In HACS, remove the custom repository
  2. Install the official Bluetti BT integration from HACS

🤖 Generated with Claude Code

Adds support for AP300 device controls in the HA integration:

- New number platform (number.py) with slider entities for
  battery SOC range start/end, including validation guard
  that prevents setting start >= end (and vice versa)
- Platform.NUMBER added to PLATFORMS list
- Translations for new controls in en/de/pt:
  switch: ctrl_charge_from_grid
  select: ctrl_working_mode (with state labels)
  number: soc_range_start, soc_range_end
- FieldCategory: added CTRL_WORKING_MODE, CTRL_CHARGE_FROM_GRID,
  BATTERY_SOC_RANGE_START, BATTERY_SOC_RANGE_END to CONFIGS

Depends on bluetti-bt-lib AP300 device model PR for NumberField
and WorkingMode enum support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants