Skip to main content

goe – Python API client for go-e Chargers and go-e Controllers

The goe package provides easy access to the HTTP APIs of electric vehicle chargers and controllers by go-e.

$ uvx goe --host 192.168.178.148 charger charging_status

ChargingStatus(allowed_to_charge_now=True,
               allowed_current_now=6,
               power_average_30s=1255.236,
               car_state=<CarState.Idle: 1>,
               error=None,
               cable_lock=<CableLockState.Locked: 3>,
               state_detail=<ChargingStateDetail.ChargingBecausePvSurplus: 12>,
               energy_since_connected=12344.07,
               energies=ChargingEnergies(voltage=PerPhaseValuesWithN(phase_1=233.12, phase_2=233.12, phase_3=234.36, neutral=2.17),
                                         current=PerPhaseValues(phase_1=0, phase_2=0, phase_3=0),
                                         power=PerPhaseValuesWithN(phase_1=0, phase_2=0, phase_3=0, neutral=0),
                                         power_total=0,
                                         power_factor=PerPhaseValuesWithN(phase_1=0, phase_2=0, phase_3=0, neutral=0)),
               number_of_phases=1)

Features

  • use local and cloud API connections using the same interface
  • no dependencies – Python standard library only
  • powerful command-line interface
  • filtered queries for faster queries and reduced server load
  • extensible and hackable

Status

As of now, there is only one developer and one known user. It works for me, but I focus on the features that I need. Please submit issues and / or pull requests if you miss something.

See Status.md for details about which keys are supported by the components API. The JSON API of course supports all API keys, by design.

High-Level Charger / Controller API Clients

This package contains high-level, easy-to-use API clients for both the go-e Charger v2 HTTP API and the go-e Controller HTTP API.

Building upon the JSON API, these

  • parse the raw JSON result into typed Python objects with self-explaining names
  • group the queryable status into components (e.g.: "WiFi", "charging status", "sensor values") that can be queried individually

Charger Example

>>> from goe.charger import GoEChargerClient
>>>  # create a Charger local API client
>>> charger = GoEChargerClient.local('192.168.1.2')
>>> charger.get_meta()  # query device info
MetaData(serial_number='123456',
         friendly_name='my Wallbox',
         firmware_version='055.7')

>>> status = charger.get_status()  # query current charging data
>>> energies = status.energies
>>> print(energies.power)
PerPhaseWithN(phase_1=1239, phase_2=1190, phase_3=1540, neutral=0)

Controller Example

>>> from goe.controller import GoEControllerClient
>>>  # create a Controller cloud API client
>>> controller = GoEControllerClient.cloud(serial_number='123456', cloud_api_key='secret')
>>> controller.get_meta()
MetaData(serial_number='123456',
         friendly_name='My Controller',
         firmware_version='1.0.6')

>>> categories = controller.get_categories()  # by-category sensor values
>>> print(categories[:2])
[(CategoryStatus(name='Home',
                 power=248.6361,
                 energy_in=114684.6,
                 energy_out=7826.659,
                 current=PerPhaseValuesWithN(phase_1=13.85199, phase_2=12.94702, phase_3=13.27633, neutral=None)),
  CategoryStatus(name='Grid',
                 power=-4486.617,
                 energy_in=47386.92,
                 energy_out=483994.9,
                 current=PerPhaseValuesWithN(phase_1=6.473037, phase_2=6.319575, phase_3=6.584583, neutral=None))
  ]

Querying Multiple Components at Once

The high-level API lets you query for multiple components at once, resulting in only a single call to the device or cloud API:

>>> voltages, currents, meta = controller.get_many([Voltages, Currents, MetaData])

JSON API

The JSON API client provides unified access to both the local and cloud HTTP APIs of any go-e Charger or go-e Controller.

It returns the raw JSON data returned from the API, which gives users the maximum flexibility. For most use cases, the higher-level structured APIs (see below) are more convenient.

>>> from goe.json_client import LocalJsonClient, CloudJsonClient
>>> local_client = LocalJsonClient('192.168.1.1')
>>> local_client.query()
{'alw': False, 'acu': None, 'adi': True, 'dwo': None, 'tpa': 0, [...]}

>>> cloud_client = CloudJsonClient(serial_number='123456', device='controller', cloud_api_key='secret')
>>> cloud_client.query()
{'alw': False, 'acu': None, 'adi': True, 'dwo': None, 'tpa': 0, [...]}

You can ( and should) restrict the amount of data returend by specifying a set of supported API keys (controller, charger) to query for:

>>> local_client.query(keys=['sse', 'fna'])
{'sse': '123456', 'fna': 'my go-e Wallbox (car port)'}

Extending

It is easy to extend or customize the components used by the high-level APIs, e.g. if some API keys are not (yet) implemented by this library or if the predefined grouping of API keys into components does not fit your needs.

To create a custom component, subclass ComponentBase like this:

@dataclass
class MyComponent(ComponentBase):
    @classmethod
    def keys(cls):
      return 'iaw', 'awe'  # API keys to fetch for this component
    
    @classmethod
    def name(cls):
      return 'my_component'

    is_awesome: bool
    awesomeness: int

    @classmethod
    def parse(cls, result: JsonResult) -> MyComponent:
        return MyComponent(result['iaw'], result['awe'])

and use like this:

>>> client: GoEJsonClient = ...
>>> my_component = MyComponent.query(client)

Metadata

Release files for goe 0.3.2

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

Source distribution (sdist)

Source distribution for goe 0.3.2
File Size Uploaded
goe-0.3.2.tar.gz 25.0 kB Details

Built distribution (wheel)

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

Total release size: 39.5 kB

Release files / goe-0.3.2.tar.gz

Download URL goe-0.3.2.tar.gz
Size 25.0 kB
Tags Source
SHA-256 checksum
How to use checksums
04526600e7317d6f21957b7c1b642a57c2b19d5d666fbe6dc112de6dccd0f10e
BLAKE2b-256 checksum
How to use checksums
94a7999d7da727c9dd804724ddce39aac20c16af40e97b2fea35eb43c3432799
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / goe-0.3.2-py3-none-any.whl

Download URL goe-0.3.2-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50b629481916a56bd429e7bb2e5446087364de727d146aabfadde766663f85a8
BLAKE2b-256 checksum
How to use checksums
b112c1b62129958de41c1dc5fd82e6c1f68664e797bbc9778e26218eb5414079
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.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