Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 199 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

test*
.hist
.test/
*.7z

*.pyc
*.map
*.dblite
*.elf
*.bin
*.hex
*.axf
*.exe
*.pdb
*.idb
*.ilk
*.old
*.crf
build
Debug
output
rtthread
settings
documentation/html
*~
*.o
*.obj
*.bak
*.dep
*.lib
*.a
*.i
*.d
*.dfinish
*.su
#source insight 4 project files
*.si4project
tools/kconfig-frontends/kconfig-mconf
packages
dist
rt-studio-project
cconfig.h
GPUCache

#cscope files
cscope.*
ncscope.*

#ctag files
tags

.idea
.vscode
*.code-workspace
*.eide.*
.history
CMakeLists.txt
cmake-build-debug
*.mk
debug.txt
80 changes: 55 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OCPP

[中文](./README_ZH.md) | English

## Introduction

This is based on QuecPython.
Expand Down Expand Up @@ -80,7 +82,7 @@ if __name__ == "__main__":

## Project Files Description

```
```shell
|-- code
|-- ocpp
|-- v16
Expand All @@ -103,26 +105,30 @@ if __name__ == "__main__":
|-- requirements.txt
|-- v16_server_demo.py
|-- docs
|-- docs/en
|-- docs/en/API_Reference.md
|-- docs/zh
|-- docs/zh/API说明手册.md
|-- OCPP_1.6_documentation_2019_12-2.zip
```

- `code` floder is incloud all OCPP client codes.
+ `code/ocpp` floder is incloud ocpp procotal codes.
+ `code/ocpp/v16/call.py` is incloud all request data format.
+ `code/ocpp/v16/call_result.py` is incloud all response data format.
+ `code/ocpp/v16/datatypes.py` is incloud some data format for part of request data.
+ `code/ocpp/v16/enums.py` is incloud some enumes of request / response data.
+ `code/ocpp/charge_point.py` is charge point class.
+ `code/tools` floder is incloud some auxiliary function module.
+ `code/tools/logging.py` is log module.
+ `code/tools/uuid.py` is uuid module.
+ `code/tools/uwebsocket.py` is client of websocket module.
+ `code/ocpp/v16_client_qpy_demo.py` is incloud all charge point request demo of ocpp.
- `code/ocpp` floder is incloud ocpp procotal codes.
- `code/ocpp/v16/call.py` is incloud all request data format.
- `code/ocpp/v16/call_result.py` is incloud all response data format.
- `code/ocpp/v16/datatypes.py` is incloud some data format for part of request data.
- `code/ocpp/v16/enums.py` is incloud some enumes of request / response data.
- `code/ocpp/charge_point.py` is charge point class.
- `code/tools` floder is incloud some auxiliary function module.
- `code/tools/logging.py` is log module.
- `code/tools/uuid.py` is uuid module.
- `code/tools/uwebsocket.py` is client of websocket module.
- `code/ocpp/v16_client_qpy_demo.py` is incloud all charge point request demo of ocpp.
- `demo` floder is incloud OCPP server demo based on Cpython.
+ `demo/requirements.txt` is incloud dependency packages of OCPP server demo running environment.
+ `demo/v16_server_demo.py` is OCPP server demo code based on Cpython.
- `demo/requirements.txt` is incloud dependency packages of OCPP server demo running environment.
- `demo/v16_server_demo.py` is OCPP server demo code based on Cpython.
- `docs` floder is incloud OCPP protocal documents.
+ `docs/OCPP_1.6_documentation_2019_12-2.zip` is OCPP v1.6 protocal documents.
- `docs/OCPP_1.6_documentation_2019_12-2.zip` is OCPP v1.6 protocal documents.

## How To Use

Expand All @@ -132,15 +138,15 @@ if __name__ == "__main__":

#### 1. Install environments

1. Operating System: Window or Linux.
- Operating System: Window or Linux.

2. Language: Python (Python-3.11.2).
- Language: Python (Python-3.11.2).

3. Dependency packages: `pip install -r demo/requirements.txt`.
- Dependency packages: `pip install -r demo/requirements.txt`.

#### 2. Config server and running demo

1. Change your server port in `demo/v16_server_demo.py`.
- Change your server port in `demo/v16_server_demo.py`.

```python
async def main():
Expand All @@ -154,7 +160,7 @@ async def main():
await server.wait_closed()
```

2. Running `python demo/v16_server_demo.py`. When output `INFO:root:WebSocket Server Started`, the server is started.
- Running `python demo/v16_server_demo.py`. When output `INFO:root:WebSocket Server Started`, the server is started.

```python
>>> python v16_server_demo.py
Expand All @@ -163,15 +169,15 @@ INFO:websockets.server:server listening on 0.0.0.0:31499
INFO:root:WebSocket Server Started
```

### Running OCPP Client.
### Running OCPP Client

#### 1. Running environment

You need to use our QuecPython module.

#### 2. Config client and running demo

1. Config your server host and port in `code/ocpp/v16_client_qpy_demo.py`
- Config your server host and port in `code/ocpp/v16_client_qpy_demo.py`

```python
if __name__ == "__main__":
Expand All @@ -187,16 +193,40 @@ if __name__ == "__main__":
utime.sleep_ms(200)
```

2. Download code to QuecPython module
- Download code to QuecPython module

**Note:**

> You can find documents in [QuecPython Document Center](https://python.quectel.com/doc/Getting_started/en/index.html) for how to download python code and running python demo in our QuecPython module
> You can find documents in [QuecPython Document Center](https://python.quectel.com/doc/Getting_started/en/index.html) for how to download python code and running python demo in our QuecPython module

You can download full `code` floder to our QuecPython module and run `v16_client_qpy_demo.py` to test ocpp Charging Station / Charge point.
You can download full `code` floder to our QuecPython module and run `v16_client_qpy_demo.py` to test OCPP Charging Station / Charge point.

You can see log `Connected to central system.` in our QPYcom REPL, than the `BootNotification` message is sented to server.

**Note:**

> You can refer to `code.ocpp.v16_client_qpy_demo.py` to write client requests that conform to business logic.

## Usage

- [API Reference Manual](./docs/en/API_Reference.md)
- [Client Example Code](./code/v16_client_qpy_demo.py)
- [Server Example Code](./demo/v16_server_demo.py)

## Contribution

We welcome contributions to improve this project! Please follow these steps to contribute:

1. Fork the repository.
2. Create a new branch (`git checkout -b feature/your-feature`).
3. Commit your changes (`git commit -m 'Add your feature'`).
4. Push to the branch (`git push origin feature/your-feature`).
5. Open a Pull Request.

## License

This project is licensed under the Apache License. See the [LICENSE](./LICENSE) file for details.

## Support

If you have any questions or need support, please refer to the [QuecPython documentation](https://python.quectel.com/doc/en) or open an issue in this repository.
43 changes: 43 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# OCPP

中文 | [English](./README.md)

## 介绍

随着新能源产业在技术上及产业化上的不断进步,以及在政策的激励下,新能源汽车开始慢慢普及,然而充电设施的不完善、不规范、标准不统一等因素制约着新能源汽车产业的发展。在此背景下,OCPP(开放充电协议)便应运而生,其目的在于解决充电桩和充电管理系统间的互联互通。

OCPP(全称Open Charge Point Protocol,开放充电协议)的技术编委会是位于荷兰的OCA(全称Open Charge Alliance,开放充电联盟)。该联盟主要负责推进开放充电协议OCPP和开放智能充电协议OSCP。该联盟发起方是荷兰的ElaadNL,该公司从2009年开始在荷兰运营3000多个充电站点

开放充电协议 (OCPP) 是一个全球开放性的通讯标准,主要用于解决私营的充电网络间通讯产生的各种困难。OCPP支持充电站点与各供应商中央管理系统间的无缝通讯管理。在过去的很多年内,私营充电网络的封闭特性已经给大量电动汽车车主和地产管理者造成很多无谓的挫折感,引发整个行业对一个开放模型的广泛呼吁。

该协议的第一个版本是 OCPP 1.5而2017年OCPP 已经在 49 个国家应用于 40,000 多个充电设施,因此实质上它已经成为充电设施网络通讯的行业标准。目前OCA 已经在 1.5 的标准之后继续推出了 OCPP 1.6 和 OCPP 2.0 标准。

该项目基于 QuecPython 进行开发使用。

Python 包实现了开放充电点协议(OCPP)的 JSON 版本。目前支持 OCPP 1.6(勘误表 v4)。

该库的目的是提供构建充电站/充电点的构建块。 **该库不提供完整的解决方案,因为任何实现都是特定于其预期用途的**。应检查该库中的文档,因为这些文档提供了有关如何最好地构建完整解决方案的指导。

## 用法

- [API 参考手册](./docs/zh/API参考手册.md)
- [客户端示例代码](./code/v16_client_qpy_demo.py)
- [服务端示例代码](./demo/v16_server_demo.py)

## 贡献

我们欢迎对本项目的改进做出贡献!请按照以下步骤进行贡献:

1. Fork 此仓库。
2. 创建一个新分支(`git checkout -b feature/your-feature`)。
3. 提交您的更改(`git commit -m 'Add your feature'`)。
4. 推送到分支(`git push origin feature/your-feature`)。
5. 打开一个 Pull Request。

## 许可证

本项目使用 Apache 许可证。详细信息请参阅 [LICENSE](./LICENSE) 文件。

## 支持

如果您有任何问题或需要支持,请参阅 [QuecPython 文档](https://python.quectel.com/doc) 或在本仓库中打开一个 issue。
Loading