Skip to main content

Python client library for EV-Meter electric vehicle chargers via MQTT

Project description

EV-Meter Client

A Python client library for EV-Meter electric vehicle chargers that communicate via MQTT using the BLEWIFI protocol.

PyPI version Python versions License: MIT

Features

  • Async MQTT client for EV-Meter chargers
  • Binary protocol parsing for BLEWIFI messages
  • Comprehensive data models with 25+ fields
  • Real-time monitoring of charging sessions
  • 3-phase electrical measurements (voltage, current, power)
  • Energy tracking (session and lifetime totals)
  • Diagnostic information (warnings, errors, WiFi status)

Installation

pip install evmeter-client

Quick Start

import asyncio
from evmeter_client import EVMeterClient, EVMeterConfig

async def main():
    # Configure with your charger details
    config = EVMeterConfig(
        user_id="your-user-id-hex-string"
    )
    
    # Create client and connect
    client = EVMeterClient(config)
    await client.connect()
    
    try:
        # Get charger status
        status = await client.get_charger_status("YOUR_CHARGER_ID")
        print(f"Charger Status: {status.charger_state}")
        print(f"EV Status: {status.ev_status}")
        print(f"Power: {status.power_kw} kW")
        
        # Get detailed metrics
        metrics = await client.get_charger_metrics("YOUR_CHARGER_ID")
        print(f"Session Energy: {metrics.session_energy_kwh} kWh")
        print(f"Voltage L1: {metrics.voltage_l1} V")
        print(f"Current L1: {metrics.current_l1} A")
        
    finally:
        await client.disconnect()

# Run the example
asyncio.run(main())

Configuration

The library connects to the EV-Meter MQTT broker with hardcoded settings:

config = EVMeterConfig(
    user_id="your-hex-user-id",  # Required: Your unique user ID
    mqtt_host="mqtt.evmeter.com",  # Fixed
    mqtt_port=1883,  # Fixed
    mqtt_username="deviceEV",  # Fixed
    mqtt_password="ng4GycjMmuvpSJU6"  # Fixed
)

Only the user_id needs to be configured - get this from your EV-Meter app or MQTT logs.

Data Models

ChargerStatus

  • charger_state: Current charger state (IDLE, CHARGING, ERROR, etc.)
  • ev_status: EV connection status (NOT_CONNECTED, CONNECTED, WANTS_TO_CHARGE, etc.)
  • charging_state: Detailed charging state (1_PHASE, 3_PHASE, WAITING, etc.)
  • power_kw: Real-time power consumption
  • session_energy_kwh: Current session energy
  • total_energy_kwh: Lifetime energy total
  • warnings: Warning count
  • errors: Error count

ChargerMetrics

  • 3-Phase Electrical: Individual and average voltage/current for all phases
  • Energy: Session and total energy with precise measurements
  • Configuration: Set current limit, circuit breaker rating
  • System: Temperature, WiFi RSSI, firmware versions
  • Diagnostics: EVSE status, ping latency, peer serial number

Protocol

The library implements the BLEWIFI protocol used by EV-Meter chargers:

  • Command Topic: /BLEWIFI/Chargers/{charger_id}
  • Response Topic: /BLEWIFI/users/{user_id}
  • Binary Payloads: Custom binary format with comprehensive working info

Error Handling

from evmeter_client.exceptions import EVMeterError, EVMeterTimeoutError

try:
    status = await client.get_charger_status("CHARGER_ID")
except EVMeterTimeoutError:
    print("Charger didn't respond in time")
except EVMeterError as e:
    print(f"EV-Meter error: {e}")

Development

# Clone the repository
git clone https://github.com/yourusername/evmeter-client.git
cd evmeter-client

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black .
ruff check .

Home Assistant Integration

This library is used by the EV-Meter Home Assistant integration to provide comprehensive monitoring of EV-Meter chargers in Home Assistant.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Changelog

v1.0.0

  • Initial release
  • Full BLEWIFI protocol support
  • Comprehensive data models
  • Async MQTT client
  • Real-time monitoring capabilities

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evmeter_client-1.0.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evmeter_client-1.0.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file evmeter_client-1.0.0.tar.gz.

File metadata

  • Download URL: evmeter_client-1.0.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for evmeter_client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 237f1c0865aa5d315d8298f047d1349bcb39e878ee5bcea06b8e035b9650074a
MD5 79df4457f616519cd0cf3f4eabf8e6fd
BLAKE2b-256 879e44a57a18f027104022a93befdc99fe62503f196fa74ed167a2cae0bd0865

See more details on using hashes here.

File details

Details for the file evmeter_client-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: evmeter_client-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for evmeter_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f1d99cffd7ec8e78be1d0cbed4ca4bed4522c6035bc1eaac7b64243d4c7236b
MD5 cf2c67822dbe02533614f2b1fa4fc098
BLAKE2b-256 e68c69730caff06e7028acc61bf186b192c1bc1a08d53464542168e2ce930187

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page