Skip to main content

API Client for Alfen Eve EV charging units.

Installation

As a CLI tool:

$ pip install alfeneve[cli]

As a library:

$ pip install alfeneve

Configuration

The CLI tool uses omniconf . This allows you to provide any CLI argument using a file or through the environment (or a combination).

Directly as arguments:

$ alfen-eve --alfen-endpoint https://192.168.1.23 --alfen-username admin --alfen-password foo

Using a YAML file (make sure to install PyYAML, or use omniconf[yaml]):

$ cat settings.yaml
alfen:
  endpoint: https://192.168.1.23
  username: admin
  password: foo

 $ alfen-eve --yaml-filename settings.yaml

Using environment variables:

$ ALFEN_ENDPOINT=https://192.168.1.23 ALFEN_USERNAME=admin ALFEN_PASSWORD=foo alfen-eve

API Credentials

Alfen ships a tool to allow you to configure your Alfen charging unit called ACE Service Installer (or just Service Installer). This tool requires a Service Account that you can request from Alfen.

The API doesn’t actually use this account directly though. It seems that the API credentials are hard-coded, and the Service Installer either ships with this password, or can infer or request this password from Alfen. Regardless, you can use the Service Installer tool to sniff out the credentials.

At this time this process is a bit involved, and requires you to know how to insert yourself as a proxy between the Service Installer and your charging unit on Windows. The broad steps are as follows (using mitmproxy):

  1. Install mitmproxy.

  2. Start mitmproxy at least once to generate the certificates: mitmproxy –listen-port 8090.

  3. Install the mitmproxy certificate as Trusted Root Certificate (you can find it in the .mitmproxy folder in your User Account).

  4. Start mitmproxy mitmproxy –listen-port 8090 –insecure and set it as the OS Global Proxy using Internet Options.

  5. If all is configured properly, you can now start the Service Installer and login using your Service Account.

  6. Connect to your Alfen charger, and look in the mitmproxy window. There should be a request to /api/login. You can find the username and password in this request.

  7. Configure these credentials as specified above.

  8. Make sure to remove mitmproxy as your OS Global Proxy.

Examples

Use as a CLI tool:

$ alfen-eve --mode categories
category
----------
generic
generic2
accelero
temp
states
meter1
meter4
leds
ocpp
display
comm
MbusTCP

$ alfen-eve --mode properties --properties-category meter4
name                                   value  id       cat
-----------------------------  -------------  -------  ------
OD_sensOptionalEnergyMeter4      5            5217_0   meter4
OD_sensEnergyMeterType4          1            5218_0   meter4
meter4_voltageL1N              225.1          5221_3   meter4
meter4_voltageL2N              225.7          5221_4   meter4
meter4_voltageL3N              228.6          5221_5   meter4
...

Use as a library:

from alfeneve.alfen import Alfen
from pprint import pprint

with Alfen("https://192.168.1.23", ("admin", "foo")) as eve:

    cats = eve.categories()
    pprint(cats)
    # ['generic',
    #  'generic2',
    #  'accelero',
    #  'temp',
    #  'states',
    #  'meter1',
    #  'meter4',
    #  'leds',
    #  'ocpp',
    #  'display',
    #  'comm',
    #  'MbusTCP']

    properties = eve.properties(category="generic")
    pprint(list(properties))
    # [<AlfenProperty(name=OD_manufacturerDeviceName, value=NG910, id=1008_0, cat=generic)>,
    #  <AlfenProperty(name=OD_manufacturerHardwareVersion, value=G0, id=1009_0, cat=generic)>,
    #  <AlfenProperty(name=OD_manufacturerSoftwareVersion, value=4.8.0-3168, id=100A_0, cat=generic)>,
    #  ... ]

License

MIT

Metadata

Release files for alfeneve 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alfeneve 0.6.1
File Size Uploaded
alfeneve-0.6.1.tar.gz 15.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for alfeneve 0.6.1
File Interpreter ABI Platform
alfeneve-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.4 kB

Release files / alfeneve-0.6.1.tar.gz

Download URL alfeneve-0.6.1.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9f8eaef9d5ae2c640a947dd6bcc9c92c046ec20872860d7d114ce01950732a8f
BLAKE2b-256 checksum
How to use checksums
a9eb5619a73844f188683115a6ed14729abcc690ea3e88e39105242ada554cc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.26.0 setuptools/58.0.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

Release files / alfeneve-0.6.1-py3-none-any.whl

Download URL alfeneve-0.6.1-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1622ad01a72d223fffe05358cfdb54093fed9040b5267a9a6df801b034b24e0
BLAKE2b-256 checksum
How to use checksums
02e6c16b0941df9e5c2fd08a384b32ea3d7bf5a7b477b6b50f59263d0f0578f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.26.0 setuptools/58.0.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page