Skip to content

peerb/PorscheBar

Repository files navigation

PorscheBar

A macOS menu bar app that shows your Porsche vehicle's battery level, range, and status at a glance.

Features

  • Battery percentage and range displayed in the menu bar
  • Vehicle info card with image, mileage, and lock status
  • Switch between front, side, rear, and top vehicle views
  • Multi-vehicle support with vehicle switcher
  • Configurable auto-refresh interval (1-30 minutes)
  • Biometric authentication (Touch ID) on refresh
  • Automatic captcha solving via Vision OCR
  • Credentials and tokens stored securely in Keychain

Requirements

  • macOS 13.0+ (Apple Silicon or Intel)
  • Porsche ID account with Porsche Connect subscription

Download

Grab the latest PorscheBar.app.zip from Releases, unzip it, and drag to Applications.

On first launch, macOS will show "cannot be opened because the developer cannot be verified." To bypass this: right-click the app, select Open, then click Open in the dialog.

Usage

  1. Launch the app -- it appears as a battery icon in the menu bar
  2. Enter your Porsche ID credentials when prompted
  3. Approve Keychain access with "Always Allow" (first launch only)
  4. Click the battery icon to see vehicle details
  5. Use "Refresh Now" or wait for auto-refresh

Building from Source

Requires Xcode Command Line Tools (xcode-select --install).

# Clone both repos side by side
git clone https://github.com/peerb/PorscheBar.git
git clone https://github.com/peerb/SwiftPorscheConnect.git

cd PorscheBar

# Optional: create a self-signed certificate to avoid Keychain prompts
# on every launch during development (one-time setup)
./setup-signing.sh

# Build and run
./build.sh
open PorscheBar.app

If setup-signing.sh fails, create the certificate manually in Keychain Access:

  1. Menu: Keychain Access > Certificate Assistant > Create a Certificate...
  2. Name: PorscheBar Development, Identity Type: Self Signed Root, Certificate Type: Code Signing
  3. Double-click the certificate > Trust > Code Signing: Always Trust

Running Tests

swiftc -swift-version 5 -target arm64-apple-macosx13.0 \
    Sources/Models.swift Sources/KeychainHelper.swift Sources/BatteryIcon.swift \
    Tests/Tests.swift \
    -framework Security -framework AppKit -framework CoreGraphics \
    -o /tmp/PorscheBarTests && /tmp/PorscheBarTests

Project Structure

Sources/
  main.swift              # App entry point, menu building, dialogs
  RefreshController.swift # Refresh lifecycle, timer, biometric auth
  PorscheAPIClient.swift  # API client singleton, image downloads, captcha
  Models.swift            # Constants, error types, data URI helper
  KeychainHelper.swift    # Keychain CRUD operations
  KeychainTokenStore.swift# OAuth token storage in Keychain
  VehicleCardView.swift   # Vehicle info card (NSView)
  VehicleIcons.swift      # Vehicle icon scaling for menu
  BatteryIcon.swift       # Battery percentage icon renderer
Tests/
  Tests.swift             # Unit tests (34 tests)
Resources/
  AppIcon.icns            # App icon
PorscheBar.app/           # Bundle template (Info.plist)
build.sh                  # Build script (swiftc, no Xcode required)
setup-signing.sh          # Code signing certificate setup
ARCHITECTURE.md           # Architecture decision records

Architecture

The app follows a clean separation between coordination and UI:

  • RefreshController owns the refresh lifecycle (timer, biometric auth, data fetching, error state) and communicates with the UI via a delegate protocol
  • AppDelegate is a thin UI shell: status item, menu building, modal dialogs, and delegate callbacks
  • PorscheAPIClient bridges the async SwiftPorscheConnect library, manages cached vehicle data and images
  • All API calls use async/await end-to-end, with MainActor.run at the UI boundary

See ARCHITECTURE.md for detailed decision records, including:

  • Why pure Swift (no Python dependency)
  • Token storage in Keychain
  • OAuth2 auth flow with captcha handling
  • Async/await over completion handlers
  • Self-signed certificate for Keychain trust

Disclaimer

This project is not affiliated with, endorsed by, or connected to Porsche AG.

License

MIT -- see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors