Skip to content

Latest commit

 

History

History
505 lines (365 loc) · 20.7 KB

File metadata and controls

505 lines (365 loc) · 20.7 KB

Changelog

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.

[1.6.3] - 2026-04-26

Changed

  • Maximum charging current cap raised from 32A to 63A - The artificial cap of 32A in the config flow validation has been raised to 63A (Type 2 connector practical maximum for single-phase). The default remains 32A, but users with hardware/installations that support higher currents (single-phase up to ~14kW, 3-phase up to ~43kW) can now configure values above 32A via Options. The wallbox will reject via OCPP SetChargingProfile if the value exceeds its hardware capability.

Fixed

  • Charging Current Limit slider not respecting Options changes - The slider's maximum value and current value were read only from entry.data, ignoring entry.options. After updating the maximum current in Settings → Configure, the slider now correctly reflects the new ceiling on reload.

[1.6.2] - 2026-03-09

Added

  • RFID token and max current in Options flow - Users can now verify and edit the RFID token and maximum current after initial setup via Settings → Devices & Services → Configure, without needing to remove and re-add the integration (#10)
  • Transaction state recovery on connect - After HA restart, the integration now triggers a TransactionEvent from the wallbox to recover the active transaction ID and ID token, fixing Start/Stop buttons failing until a new charging event arrived
  • RFID token logging at startup - Configured RFID token is now logged (masked) at server startup for easier debugging

Removed

  • Energy Session sensor - Removed redundant sensor that always matched Energy Total

[1.6.1] - 2026-03-04

Fixed

  • Migration error on upgrade - Added missing async_migrate_entry handler for existing installations upgrading from v1.5.x
  • Options flow crash - Fixed OptionsFlow constructor conflicting with HA's built-in config_entry property

[1.6.0] - 2026-03-04

Added

  • Active meter polling during charging - Integration now proactively requests fresh meter values from the wallbox during active charging sessions via OCPP TriggerMessage, instead of relying solely on push-based TransactionEvent messages. This fixes sensors not updating on wallboxes that don't include meter_value in TransactionEvent (#7)
  • Configurable polling interval - New "Meter Polling Interval" option (5–60 seconds, default 10s) available during setup and in integration options for post-setup adjustment
  • Options flow - Users can now change the polling interval after initial setup via the integration's "Configure" button

Fixed

  • Sensors not updating during active charging - Some wallboxes send TransactionEvent without meter data, causing power, energy, current, and voltage sensors to remain stale until integration restart
  • Stop/Pause command failing on stale data - The pause command would skip sending SetChargingProfile(0A) when power showed 0W due to stale data. Now refreshes meter values before checking, and also verifies charging state

[1.5.1] - 2026-01-26

Added

  • NotifyEvent Handler - Added handler for OCPP 2.0.1 NotifyEvent messages
    • Prevents NotImplementedError spam in Home Assistant logs
    • Some wallboxes send this message frequently; now handled gracefully
    • Thanks to @eaglerbits for the contribution! (#4)

Fixed

  • Release Notes - Fixed "What's New" header not showing version number in GitHub releases

[1.5.0] - 2026-01-06

Added

  • Home Assistant Brands integration - Icons now served from official Home Assistant Brands repository
    • Added brand field to manifest.json to reference Brands CDN
    • Icons available at https://brands.home-assistant.io/_/bmw_wallbox/
    • Removed local icon files (icon.png, icon@2x.png, logo.png)
    • Integration now displays official BMW Wallbox branding across all Home Assistant interfaces

Changed

  • Integration icons now load from Home Assistant Brands CDN instead of local files
  • Improved consistency with other Home Assistant integrations

[1.4.1] - 2024-12-31

🚨 CRITICAL FIX: Stop/Pause Failsafe (NUKE)

Problem: When the wallbox rejected a pause/stop command, charging continued indefinitely with no fallback. This caused massive electricity costs when tariff changed from off-peak to peak.

Solution: Added automatic wallbox reboot as failsafe when pause/stop commands fail.

Fixed

  • CRITICAL: Stop charging now has failsafe reboot - If SetChargingProfile(0A) is rejected, times out, or throws an exception, the wallbox is automatically rebooted to force stop charging
    • Matches the existing failsafe behavior in async_start_charging()
    • Logs with 💣 emoji for visibility: 💣 NUKE OPTION: Pause rejected, rebooting wallbox to force stop!

Changed

  • async_pause_charging() now accepts allow_nuke: bool = True parameter
  • async_stop_charging() now accepts allow_nuke: bool = True parameter
  • Both methods now return an action field in the result dict (paused, nuked, nuke_failed, etc.)

Tests

  • Added 4 new tests for pause/stop NUKE failsafe behavior:
    • test_async_pause_charging_nuke_on_rejection
    • test_async_pause_charging_no_nuke_when_disabled
    • test_async_pause_charging_nuke_on_timeout
  • All 96 tests pass

[1.4.0] - 2024-12-14

🎚️ New Feature: Charging Current Limit Slider

Added a slider control to adjust the charging current limit (6A to max_current).

Added

  • Current Limit Slider - New number entity to set charging current (6A - 32A)
    • Works as a slider in the Home Assistant UI
    • When changed during active charging: immediately updates the wallbox
    • When changed while not charging: saves for next start/resume
    • Defaults to max_current from your integration config

Fixed

  • Bug: Forced 32A on Start - Previously, starting or resuming charging always forced 32A regardless of user preference
    • Now uses the value from the Current Limit slider
    • Respects your configured max_current setting

Changed

  • async_start_charging() now uses tracked current_limit instead of hardcoded 32A
  • async_resume_charging() now uses tracked current_limit as default (instead of 32.0)
  • async_set_current_limit() now stores the accepted value for future start/resume operations

Technical

  • Added current_limit field to coordinator.data (initialized from config's max_current)
  • Added NUMBER_CURRENT_LIMIT constant
  • Added Platform.NUMBER to registered platforms
  • New file: number.py with BMWWallboxCurrentLimitNumber entity

Tests

  • Added 8 new tests for the current limit number entity
  • All 93 tests pass

Documentation

  • Updated COORDINATOR.md with new method signatures and behavior
  • Updated ENTITIES.md with number entity details

[1.3.0] - 2024-12-14

🚨 Major Fix: Reliable Pause/Resume Charging

This release completely rewrites how the integration controls charging, fixing critical issues that made pause/resume unreliable or impossible.


The Problem We Solved

Issue 1: "Pause Charging" Button Always Rejected ❌

Symptoms:

  • Pressing "Stop/Pause Charging" resulted in Rejected response
  • Logs showed: SetChargingProfile response: Rejected
  • Charging continued despite pressing stop

Root Cause: The previous implementation used incorrect SetChargingProfile parameters. The wallbox requires specific profile settings including proper stack_level, transaction_id, and clearing existing profiles first.


Issue 2: Cannot Restart After Stopping 🔒

Symptoms:

  • RequestStopTransaction worked and stopped charging
  • But RequestStartTransaction was always Rejected afterwards
  • Only unplugging the cable or rebooting the wallbox would fix it

Root Cause: This is actually defined by the OCPP specification! After RequestStopTransaction, the charger enters "Finishing" state. From this state, it is NOT allowed to start a new transaction with an IdTag. This affects ALL OCPP-compliant chargers.

Source: Teltonika Community Discussion


Issue 3: Charging Starts but No Power Delivered ⚡️

Symptoms:

  • RequestStartTransaction returned Accepted
  • But power stayed at 0W
  • Car showed "Preparing" but never charged

Root Cause: The wallbox accepted the transaction but wasn't told to allow current flow. We now send SetChargingProfile(32A) immediately after starting a transaction to enable power delivery.


Issue 4: Car Ends Session When Paused 🔌

Symptoms:

  • Using SetChargingProfile(0A) to pause worked
  • But then the car detected 0A available and stopped the session
  • Transaction ended automatically

Root Cause: The wallbox had StopTxOnEVSideDisconnect enabled (default). When the car stops drawing power (because we set 0A), the wallbox ends the transaction. We now attempt to configure this setting to false on connect.


The Solution: EVCC-Style Charging Control 🔌

Named after the popular EVCC project, this approach controls charging by adjusting current limits instead of starting/stopping transactions:

User Action Old (Broken) Method New (Working) Method
Pause RequestStopTransaction → Stuck in "Finishing" SetChargingProfile(0A) → Transaction stays alive
Resume RequestStartTransaction → Rejected SetChargingProfile(32A) → Instant resume
Start (new) RequestStartTransaction → No power RequestStartTransaction + SetChargingProfile(32A)

Benefits:

  • ✅ No stuck transactions
  • ✅ Instant pause/resume
  • ✅ No wallbox reset needed
  • ✅ Perfect for solar charging (adjust current dynamically)
  • ✅ Works with BMW wallbox quirks

💣 NUKE Option: Last Resort Recovery

If all else fails, the integration can now automatically reboot the wallbox:

START pressed
    ↓
Try SetChargingProfile(32A) to resume existing transaction
    ↓ (if fails)
Try RequestStartTransaction + SetChargingProfile(32A)
    ↓ (if fails)
💣 NUKE: Reset(Immediate) → Wallbox reboots (~60 seconds)
    ↓
Charging auto-starts after reboot (if cable plugged in)

The NUKE is:

  • Enabled by default (can disable with allow_nuke=False)
  • Only triggers after ALL other methods fail
  • Takes ~60 seconds for wallbox to reboot
  • Charging usually auto-starts after reboot

New Features

  • Smart RFID handling - Uses your configured RFID token, or no_authorization if RFID is disabled
  • Transaction ID refresh - Queries wallbox via GetTransactionStatus before operations
  • Wallbox auto-configuration - Sets StopTxOnEVSideDisconnect=false on connect
  • Better logging - Detailed logs for debugging charging issues

Documentation Updates 📊

All documentation now includes Mermaid flowcharts for visual understanding:

  • COORDINATOR.md - Start charging decision tree, NUKE flow, data architecture
  • PATTERNS.md - Decision trees for all charging operations
  • TROUBLESHOOTING.md - Diagnostic flowcharts for:
    • SSL/connection errors
    • Command rejections
    • Stuck transactions
    • Quick diagnostic checklist

Test Suite Fixed ✅

All 85 tests now pass:

  • Button tests - Fixed entity ID mocking for Home Assistant
  • Config flow tests - Fixed integration loading in test environment
  • Coordinator tests - Fixed async task cleanup and timeout assertions
  • Sensor tests - Updated for new icon and attribute values

Technical Changes

New coordinator methods:

  • async_refresh_transaction_id() - Verify transaction is still active
  • async_configure_wallbox_for_pause_resume() - Set wallbox config on connect

Modified methods:

  • async_start_charging(allow_nuke=True) - Smart start with NUKE fallback
  • async_pause_charging() - EVCC-style pause via SetChargingProfile(0A)
  • async_resume_charging() - EVCC-style resume via SetChargingProfile(32A)
  • async_stop_charging() - Now calls async_pause_charging() internally

pytest configuration:

  • Added asyncio_mode = "auto" for proper async test support

[1.2.1] - 2024-12-13

Fixed

  • Energy sensors showing 0 - Fixed issue where Energy Total and Energy Session showed 0.00 after Home Assistant restart
  • Now automatically requests meter values when wallbox connects
  • Simplified energy tracking to use wallbox values directly

Changed

  • Removed unnecessary energy accumulation logic
  • Energy sensors now display values directly from wallbox

[1.2.0] - 2024-12-13

Changed

  • BREAKING: Removed period energy sensors - Daily, weekly, monthly, and yearly energy sensors have been removed
  • Use Home Assistant's built-in Utility Meter helper instead for period-based tracking
  • This provides better persistence, customizable reset times, and tariff support

Added

  • Documentation - Added comprehensive guide in README for setting up Utility Meter helpers
  • Step-by-step instructions for UI and YAML configuration
  • Examples for cost tracking with peak/off-peak tariffs

Why This Change?

The custom period sensors had persistence issues (values reset on HA restart). Home Assistant's Utility Meter is the recommended, battle-tested solution that:

  • ✅ Survives Home Assistant restarts
  • ✅ Allows custom reset times
  • ✅ Supports tariff tracking (peak/off-peak)
  • ✅ Requires no integration code maintenance

Migration Guide

After updating, set up Utility Meter helpers:

  1. Go to SettingsDevices & ServicesHelpers
  2. Click + Create HelperUtility Meter
  3. Select sensor.energy_total as input
  4. Choose cycle: Daily/Weekly/Monthly/Yearly

Or via YAML:

utility_meter:
  wallbox_energy_daily:
    source: sensor.energy_total
    cycle: daily

[1.1.2] - 2024-12-09

Fixed

  • Lint Configuration - Fixed TOML parse error by moving exclude field to correct section in pyproject.toml
  • Code formatting issues (whitespace on blank lines, import sorting)
  • Added appropriate lint rule exceptions for common patterns (unused test fixtures, OCPP-specific naming conventions)
  • Unused variable warnings in test files

[1.1.1] - 2024-12-08

Fixed

  • Energy Period Sensors Bug - Fixed critical issue where daily, weekly, monthly, and yearly energy sensors were all showing the same value (total energy) instead of their respective period consumption
  • Period sensors now correctly track energy consumed in their specific time periods
  • Removed incorrect addition of current session energy to period counters

Added

  • Comprehensive Linting Setup - Added Ruff, MyPy, and pre-commit hooks following Home Assistant best practices
  • Development Tools - Added Makefile with quick commands (make lint, make format, make test)
  • Code Quality Enforcement - CI now fails on formatting issues
  • Contributing Guide - Added CONTRIBUTING.md with development guidelines
  • Pre-commit Hooks - Automatic code formatting and validation on commit
  • Automated trailing whitespace and blank line cleanup

Changed

  • Improved GitHub Actions workflows with separate lint workflow
  • Enhanced release workflow to continue on HACS validation errors
  • Cleaned up all trailing whitespace and blank lines across codebase
  • Updated pyproject.toml with comprehensive tool configurations

Documentation

  • Added .ruff-format-on-save.md guide for editor integration
  • Added .github/DEVELOPMENT.md quick reference
  • Updated all development documentation

Technical

  • All Python files now have exactly 1 trailing newline (PEP 8 compliant)
  • Ruff configured with Home Assistant-compatible rules
  • MyPy strict type checking enabled
  • Pre-commit hooks for automated quality checks

1.1.0 - 2024-12-08

Added

  • Energy Daily Sensor - Automatically resets at midnight for daily consumption tracking
  • Energy Weekly Sensor - Automatically resets every Monday for weekly consumption tracking
  • Energy Monthly Sensor - Automatically resets on 1st of month for monthly billing cycles
  • Energy Yearly Sensor - Automatically resets on January 1st for annual consumption tracking
  • Period-based energy sensors with automatic time-based resets
  • last_reset attribute on all period sensors showing when counter was last reset
  • Comprehensive energy sensor documentation (ENERGY_SENSORS.md)

Fixed

  • Energy Total Sensor - Now properly accumulates energy across ALL charging sessions
  • Session end detection to prevent energy loss between charging sessions
  • Energy Dashboard integration - sensor no longer resets with each session
  • Cumulative energy tracking across wallbox restarts

Changed

  • Energy Total sensor now uses true cumulative tracking (never resets)
  • Period sensors include current session energy for real-time updates
  • Improved energy measurement accuracy with 0.1 kWh session detection threshold

Technical

  • Added _check_and_reset_period_counters() method for automatic period resets
  • Session end detection based on energy value drops
  • New coordinator data fields: energy_cumulative, last_session_energy, period counters
  • Reset timestamps tracked for each period (daily/weekly/monthly/yearly)
  • All period sensors use state_class: TOTAL_INCREASING for proper HA statistics

Documentation

  • Updated ENTITIES.md with energy sensor details and examples
  • Updated DATA_SCHEMAS.md with new cumulative tracking fields
  • Updated CONSTANTS.md with new sensor constants
  • Updated COORDINATOR.md with reset logic documentation
  • Added comprehensive ENERGY_SENSORS.md guide with:
    • Detailed usage instructions for each sensor
    • Energy Dashboard setup guide
    • Example automations and Lovelace cards
    • Advanced use cases (solar optimization, dynamic pricing, load balancing)
    • Troubleshooting section
    • Migration guide

Tests

  • Added comprehensive test coverage for all new energy sensors
  • Tests verify period calculations with and without active sessions
  • Tests verify last_reset attribute formatting
  • All existing tests continue to pass

1.0.1 - 2024-12-07

Added

  • Release process documentation (RELEASES.md)
  • Repository description and topics for better discoverability
  • HACS validation workflow for continuous integration

Fixed

  • Manifest.json key ordering to pass Hassfest validation
  • HACS.json now at repository root as required by HACS
  • Repository metadata for HACS compliance

Documentation

  • Comprehensive guide for creating new releases
  • Improved README with CI/CD badges
  • Better project structure and organization

1.0.0 - 2024-12-07

Added

  • Initial public release
  • OCPP 2.0.1 protocol support for BMW-branded wallboxes
  • 37 comprehensive sensors for monitoring
  • Real-time power, energy, current, and voltage monitoring
  • Per-phase measurements (L1, L2, L3) for 3-phase installations
  • Smart charging controls (start/stop, current limiting)
  • Binary sensors for charging and connection status
  • Start/Stop charging buttons
  • Current limit control (0-32A)
  • Energy Dashboard integration
  • WebSocket Secure (WSS) connection
  • SSL/TLS certificate support
  • HACS installation support
  • Config flow for easy setup
  • Comprehensive documentation
  • Test suite with pytest
  • English translations

Features

  • Smart Start/Stop: EVCC-style charging control without stuck transactions
  • Dynamic Current Limiting: Adjust charging current in real-time
  • Transaction Management: Proper handling of OCPP charging sessions
  • Connection Monitoring: Heartbeat and status tracking
  • Meter Values: Real-time and periodic energy measurements
  • Status Notifications: Connector and charging state updates
  • Boot Notification: Device info and firmware tracking

Technical

  • Acts as OCPP 2.0.1 Central System (server)
  • Supports OCPP messages: BootNotification, StatusNotification, Heartbeat, TransactionEvent, NotifyReport
  • Outgoing commands: RequestStartTransaction, RequestStopTransaction, SetChargingProfile, Reset
  • Local-only operation (no cloud required)
  • Async/await architecture for performance
  • Proper error handling and logging

Documentation

  • Complete README with installation and usage
  • Architecture documentation
  • OCPP handler documentation
  • Testing guide
  • Troubleshooting guide
  • Example automations for solar charging and dynamic limiting