Skip to content

TWCManager v1.4.0

Latest

Choose a tag to compare

@ngardiner ngardiner released this 26 Oct 12:41
· 288 commits to main since this release

TWCManager 1.4.0 is a major release: a new architecture for chargers and vehicle commands, BLE as a first-class vehicle interface, Gen3 Wall Connector support, and the Fleet API work from 1.3.4.

Highlights

  • Gen3 Wall Connector support - TWCManager controls Gen3 TWCs by emulating their Neurio energy meter over Modbus. See Controller_Gen3TWCs.
  • Charger abstraction - Gen2 TWCs, Gen3 TWCs and Tesla API vehicles are managed through one EVSEController/EVSEInstance interface, with one power distributor across them.
  • BLE first - charge start/stop, charge limit, and charge and location state over BLE, falling back to the Fleet API only when BLE is unavailable.
  • Vehicle command policy - commandPolicy (prefer_ble, ble_only, api_only) restricts state-changing commands to BLE or the API, capping billed Fleet API command spend. Set it on the Settings page, or as a hard override in config.json.
  • Owner and Fleet tokens side by side - reads use the free Owner API, commands use the Fleet API, and TeslaMate token sync can stay on beside a Fleet login. The Settings page shows each token's status, with a Remove token button.
  • Responsive RS485 loop - vehicle commands run on their own worker thread and policy is evaluated on its own thread, so BLE retries and slow API calls no longer stall the TWC heartbeat.
  • Graceful shutdown - on SIGTERM, TWCManager saves settings and sends pending stop-charging commands before it exits.
  • Fewer paid Fleet API calls - no charge-rate commands to a car a TWC is serving, no resending an unchanged rate, at most one start/stop per car per minute, a 3-minute pre-wake delay and a 30-minute wake backoff.
  • Tesla API 401 handling - a 401 on a vehicle command refreshes an expired token and retries once; a dead token is cleared so commands fall back to BLE (#689).
  • BLE pairing status - the vehicle page shows whether a pairing request was sent, failed or completed, and tells you to tap your key card to approve the key.

Security: legacy PHP web interface removed

The legacy PHP web interface (html/index.php) and its lighttpd/PHP install are gone. The PHP versions TWCManager's Makefile installed for it (php7.0/7.3/7.4-cgi) are end of life and affected by PHP2Shell (CVE-2026-109618, CVE-2026-109619), unauthenticated remote code execution via php-cgi. make webinstall is now an alias of make install.

If you ever installed the legacy web interface (make webinstall, or lighttpd serving index.php), upgrading does not remove it. Remove it yourself:

sudo systemctl disable --now lighttpd
sudo apt-get purge 'php*' lighttpd
sudo rm /var/www/html/index.php

Use the built-in web interface instead (HTTPControl, port 8080 by default). Its Debug page can send RS-485 commands.

Upgrade notes

  • Tesla tokens - saved tokens migrate to separate Owner and Fleet settings on first start. Downgrading afterwards loses the Owner API token.
  • Owner API login removed - log in with the Fleet API, sync tokens from TeslaMate, or paste a token. Owner API tokens are used for reads, and for commands only to cars Tesla lists with command_signing: off.
  • Docker - update your own docker-compose.yml from contrib/docker/docker-compose-v1.4.0.yml. Images are now also tagged with their minor line, so you can pin twcmanager/twcmanager:v1.4 to follow 1.4.x releases:
    • if you use TeslaBLE and are upgrading from 1.3.3 or earlier, add CAP_SYS_PTRACE to cap_add and the /proc/1/ns/:/rootns volume (tesla-control now runs in the host network namespace)
    • add stop_grace_period: 90s, so Docker does not kill TWCManager while it sends pending stop commands on shutdown
  • Scheduled charging - TWCManager no longer starts a car that is waiting on its own Scheduled Charging or Departure timer. Set respectVehicleSchedule to false to restore the old behaviour.
  • Fleet API wake (new since 1.3.3) - TWCManager waits 3 minutes before waking a car, so it can start charging from the TWC on its own. Set wakeDelayMins to 0 to wake immediately.
  • tesla-control - found through PATH only; the /home/twcmanager fallback is gone.
  • Python - tested on Python 3.8 to 3.11.
  • IPv4-only hosts - the web interface listens on IPv6 and falls back to IPv4 when IPv6 is disabled (#721).
  • defaultVoltage - set it to the voltage of one phase (e.g. 230 on a 3-phase 400V supply). Charge rates now follow the voltage the TWC measures, so a 3-phase install with defaultVoltage set to the line-to-line voltage no longer charges faster than the policy asks (#715).

Thanks

@MikeBishop for the TWC abstraction layer, the BLE command, state and charge limit work, the vehicle command thread, two-slot tokens, the Docker image fixes and a long run of Fleet API fixes; @tmark00 for #714 and #716; @dehsgr for reporting #721.

Changes

See CHANGELOG.md for the full list.