{"id":21634,"library":"ocpp","title":"OCPP - Open Charge Point Protocol","description":"Python package implementing the JSON version of the Open Charge Point Protocol (OCPP). Supports OCPP 1.6, 2.0.1, and 2.1 via schema generation. Current version 2.1.0, requires Python >=3.11, release cadence is irregular with major version bumps.","status":"active","version":"2.1.0","language":"python","source_language":"en","source_url":"https://github.com/mobilityhouse/ocpp","tags":["OCPP","EV charging","WebSocket","protocol"],"install":[{"cmd":"pip install ocpp","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for WebSocket transport","package":"websockets","optional":false},{"reason":"Required for HTTP client (used in some examples)","package":"httpx","optional":true},{"reason":"Used for data validation in newer versions","package":"pydantic","optional":true}],"imports":[{"note":"Wrong: v16 submodule does not export ChargePoint directly","wrong":"from ocpp.v16 import ChargePoint","symbol":"ChargePoint","correct":"from ocpp import ChargePoint"},{"note":"V16 charge point","wrong":"","symbol":"ChargePointV16","correct":"from ocpp.v16 import ChargePoint as ChargePointV16"},{"note":"call is in version-specific submodule","wrong":"from ocpp import call","symbol":"call","correct":"from ocpp.v16 import call"},{"note":"call_result is in version-specific submodule","wrong":"from ocpp import call_result","symbol":"call_result","correct":"from ocpp.v16 import call_result"}],"quickstart":{"code":"import asyncio\nimport logging\nfrom ocpp import ChargePoint\nfrom ocpp.v16 import call\n\nlogging.basicConfig(level=logging.INFO)\n\nclass ChargePointClient(ChargePoint):\n    async def send_boot_notification(self):\n        request = call.BootNotificationPayload(\n            charge_point_vendor='vendor',\n            charge_point_model='model'\n        )\n        response = await self.call(request)\n        logging.info(f\"Boot response: {response}\")\n\nasync def main():\n    cp = ChargePointClient('id', None)\n    await cp.send_boot_notification()\n\nasyncio.run(main())","lang":"python","description":"Minimal example creating a charge point client and sending a BootNotification."},"warnings":[{"fix":"Upgrade to Python >=3.11 and adjust imports: Payload classes are now in ocpp.v16.call and ocpp.v16.call_result instead of ocpp.v16.datatypes.","message":"In v2.0.0, the library dropped support for Python <3.11 and renamed several internal classes.","severity":"breaking","affected_versions":">=2.0.0,<2.1.0"},{"fix":"Use websockets library to connect and pass the socket to ChargePoint constructor.","message":"WebSocket connection is not part of the library; you must provide your own transport (e.g., websockets).","severity":"gotcha","affected_versions":"all"},{"fix":"Use BootNotification instead of BootNotificationPayload (still works but will be removed).","message":"The 'Payload' suffix on call/call_result classes is deprecated in favor of un-suffixed names.","severity":"deprecated","affected_versions":">=1.0.0-rc.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use: from ocpp import ChargePoint","cause":"Trying to import ChargePoint from wrong module. In v2, ChargePoint is in ocpp namespace, not ocpp.v16.","error":"ImportError: cannot import name 'ChargePoint' from 'ocpp'"},{"fix":"Check pip list; if version >=2.0.0, use from ocpp.v16 import call","cause":"Installed ocpp version 2.0.0+ which may have restructured modules. Actually v16 still exists but make sure correct imports.","error":"ModuleNotFoundError: No module named 'ocpp.v16'"},{"fix":"Ensure you pass a websocket connection: cp = ChargePoint(id, websocket) and use await cp.call(...)","cause":"Not passing a WebSocket connection to ChargePoint constructor or not awaiting call.","error":"AttributeError: 'ChargePoint' object has no attribute 'call'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}