All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Poll interval not respected: Inverter data was published as fast as the
Modbus read completed (~5-8s) instead of respecting the configured poll interval
- Root cause:
poll_intervalwas read from config but never applied in the main loop — the previous ~20-30s cycle time was an accidental side effect of broken TCP teardown in v1.8.3 (now fixed), which unintentionally throttled the loop - Added
cycle_starttimestamp andasyncio.sleep(remaining)after each successful cycle to wait out the configured interval - Duplicate
error_trackerinstantiation removed (dead code) ImportErrorfallback for pymodbus marked with# pragma: no cover
- Root cause:
- Fixed
auto_detect_slave_id→modbus_auto_detect_slave_idattribute name mismatch in 7 test locations - Added
test_main_loop_waits_poll_intervalto verify poll interval sleep behavior
- Auto Slave ID Detection:
Request cancelled outside libraryerror for subsequent Slave IDs (2, 100) after a failed first attempt (#15)- Added
INTER_ATTEMPT_DELAY(2s) between attempts to allow TCP teardown - Added timeout to
client.stop()to prevent blocking on broken clients CancelledErrornow correctly propagates instead of being swallowed
- Added
- CI Pipeline: Full migration to
uv(replacespip)- Benefits: 40% faster builds, reproducible environments (
uv.lock) - Jobs affected: Lint, Test, Type-Check, Config-Validation
- Example:
- name: uv sync & test run: | curl -LsSf https://astral.sh/uv/install.sh | sh uv sync --dev --frozen uv run pytest tests/
- Benefits: 40% faster builds, reproducible environments (
| Job | pip | uv | Δ |
|---|---|---|---|
| Test | 45s | 26s | -42% |
| Type Check | 12s | 4s | -67% |
| Total | 120s | 72s | -40% |
- Slave ID 0 Auto-Detection Issue: Removed broadcast address from auto-detection sequence
- Root cause: Slave ID 0 is reserved as broadcast address in Modbus specification (write-only, no responses expected)
- Impact: Home Assistant 2025.1+ enforces Modbus specification more strictly, causing timeouts during auto-detection
- Solution: Updated auto-detection sequence from
[0, 1, 2, 100]to[1, 2, 100] - Benefits:
- Eliminates timeout errors on HA 2025.1+
- Faster auto-detection (one less attempt)
- Compliant with Modbus specification
- Fixes compatibility with Home Assistant 2025.1 and later versions
Before:
SLAVE_IDS_TO_TRY = # Slave ID 0 caused timeouts [github](https://github.com/arboeh/huABus)After:
SLAVE_IDS_TO_TRY = # Slave ID 0 removed [community.home-assistant](https://community.home-assistant.io/t/app-huabus-huawei-solar-modbus-to-mqtt-sun2-3-5-000-mqtt-home-assistant-auto-discovery/958230)Affected Versions:
- Home Assistant 2025.1 and later with stricter Modbus handling
Workaround (if using older addon version):
modbus:
auto_detect_slave_id: false
slave_id: 2 # Use your actual Slave IDThanks to HANT for the detailed bug report! 🙏
-
Automatic Slave ID Detection: No more guessing! The addon now automatically detects the correct Slave ID
- Tries common values (0, 1, 2, 100) and uses the first working one
- New config option:
modbus_auto_detect_slave_id(enabled by default) - UI toggle in add-on configuration for easy enable/disable
- Fallback to manual Slave ID if auto-detection disabled
- Detailed logging shows which Slave IDs were tried
- Eliminates "Timeout while waiting for connection" errors for new users
-
Dynamic Register Count Display: Startup logs now show exact number of registers being read
- Calculated dynamically from
ESSENTIAL_REGISTERSconstant - Example:
INFO - Registers: 63 essential
- Calculated dynamically from
-
Improved Error Messages: More helpful guidance for common connection issues
- Connection errors now suggest trying different Slave IDs
- Better context in log messages (shows attempted Slave ID)
- Clearer distinction between timeout and connection refused errors
-
Configuration UI: Reorganized for better user experience
- Auto-detect option prominently displayed
- Manual Slave ID clearly marked as "only used when auto-detection disabled"
- Better descriptions with practical examples
- MQTT Auto-Configuration: Restored automatic credential detection from Home Assistant MQTT service
- Feature was accidentally removed in previous development iterations
- Now properly uses Home Assistant MQTT service credentials when available
- Falls back to custom credentials from config if specified
- Clear logging indicates whether using HA service or custom config
Logging Examples:
# With auto-detection:
INFO - Inverter: 192.168.1.100:502 (Slave ID: auto-detect)
INFO - Trying Slave ID 0... ⏸️
INFO - Trying Slave ID 1... ✅
INFO - Connected (Slave ID: 1)
# Manual configuration:
INFO - Inverter: 192.168.1.100:502 (Slave ID: 1)
INFO - Connected (Slave ID: 1)
Configuration:
# New option (default: true)
modbus_auto_detect_slave_id: true
# Only used when auto_detect = false
slave_id: 1Backward Compatibility:
- Existing configurations without
modbus_auto_detect_slave_iddefault totrue - Existing
slave_idvalues preserved and used when auto-detection disabled - No configuration migration needed
Performance:
- Auto-detection adds 0-3 seconds to startup (depends on how many IDs tried)
- Once connected, no performance difference
When to Disable Auto-Detection:
- You know your exact Slave ID and want faster startup
- You use a non-standard Slave ID not in the auto-detect list
- For debugging purposes