python-openevse-http 0.3.4__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_openevse_http-0.4.0/.github/dependabot.yml +16 -0
- python_openevse_http-0.4.0/.github/release-drafter.yml +103 -0
- python_openevse_http-0.4.0/.github/workflows/autolabeler.yml +41 -0
- python_openevse_http-0.4.0/.github/workflows/links.yml +27 -0
- python_openevse_http-0.4.0/.github/workflows/publish-to-pypi.yml +46 -0
- python_openevse_http-0.4.0/.github/workflows/release-drafter.yml +23 -0
- python_openevse_http-0.4.0/.github/workflows/test.yml +87 -0
- python_openevse_http-0.4.0/.gitignore +102 -0
- python_openevse_http-0.4.0/.pre-commit-config.yaml +50 -0
- python_openevse_http-0.4.0/.yamllint +60 -0
- python_openevse_http-0.4.0/EXTERNAL_SESSION.md +141 -0
- {python_openevse_http-0.3.4/python_openevse_http.egg-info → python_openevse_http-0.4.0}/PKG-INFO +1 -1
- python_openevse_http-0.4.0/codecov.yml +7 -0
- python_openevse_http-0.4.0/example_external_session.py +67 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/openevsehttp/commands.py +86 -26
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/openevsehttp/const.py +2 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/pyproject.toml +6 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0/python_openevse_http.egg-info}/PKG-INFO +1 -1
- python_openevse_http-0.4.0/python_openevse_http.egg-info/SOURCES.txt +67 -0
- python_openevse_http-0.4.0/requirements.txt +1 -0
- python_openevse_http-0.4.0/requirements_lint.txt +4 -0
- python_openevse_http-0.4.0/requirements_test.txt +11 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/setup.py +1 -2
- python_openevse_http-0.4.0/tests/__init__.py +1 -0
- python_openevse_http-0.4.0/tests/common.py +10 -0
- python_openevse_http-0.4.0/tests/conftest.py +248 -0
- python_openevse_http-0.4.0/tests/fixtures/github_v2.json +74 -0
- python_openevse_http-0.4.0/tests/fixtures/github_v4.json +211 -0
- python_openevse_http-0.4.0/tests/fixtures/v2_json/config.json +43 -0
- python_openevse_http-0.4.0/tests/fixtures/v2_json/status.json +35 -0
- python_openevse_http-0.4.0/tests/fixtures/v4_json/config-broken-semver.json +66 -0
- python_openevse_http-0.4.0/tests/fixtures/v4_json/config-broken.json +65 -0
- python_openevse_http-0.4.0/tests/fixtures/v4_json/config-dev.json +67 -0
- python_openevse_http-0.4.0/tests/fixtures/v4_json/config-extra-version.json +66 -0
- python_openevse_http-0.4.0/tests/fixtures/v4_json/config-new.json +108 -0
- python_openevse_http-0.4.0/tests/fixtures/v4_json/config-unknown-semver.json +66 -0
- python_openevse_http-0.4.0/tests/fixtures/v4_json/config.json +67 -0
- python_openevse_http-0.4.0/tests/fixtures/v4_json/schedule.json +30 -0
- python_openevse_http-0.4.0/tests/fixtures/v4_json/status-broken.json +49 -0
- python_openevse_http-0.4.0/tests/fixtures/v4_json/status-new.json +80 -0
- python_openevse_http-0.4.0/tests/fixtures/v4_json/status.json +52 -0
- python_openevse_http-0.4.0/tests/fixtures/websocket.json +68 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/tests/test_commands.py +180 -0
- python_openevse_http-0.4.0/tox.ini +35 -0
- python_openevse_http-0.3.4/python_openevse_http.egg-info/SOURCES.txt +0 -31
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/LICENSE +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/README.md +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/openevsehttp/__init__.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/openevsehttp/__main__.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/openevsehttp/client.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/openevsehttp/exceptions.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/openevsehttp/managers.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/openevsehttp/properties.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/openevsehttp/sensors.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/openevsehttp/utils.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/openevsehttp/websocket.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/python_openevse_http.egg-info/dependency_links.txt +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/python_openevse_http.egg-info/not-zip-safe +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/python_openevse_http.egg-info/requires.txt +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/python_openevse_http.egg-info/top_level.txt +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/setup.cfg +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/tests/test_client.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/tests/test_external_session.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/tests/test_main_edge_cases.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/tests/test_managers.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/tests/test_mixins.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/tests/test_properties.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/tests/test_sensors.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/tests/test_shaper.py +0 -0
- {python_openevse_http-0.3.4 → python_openevse_http-0.4.0}/tests/test_websocket.py +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "pip" # See documentation for possible values
|
|
9
|
+
directory: "/" # Location of package manifests
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "daily"
|
|
12
|
+
|
|
13
|
+
- package-ecosystem: "github-actions"
|
|
14
|
+
directory: "/"
|
|
15
|
+
schedule:
|
|
16
|
+
interval: "daily"
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
name-template: "$RESOLVED_VERSION"
|
|
2
|
+
tag-template: "$RESOLVED_VERSION"
|
|
3
|
+
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
|
|
4
|
+
sort-direction: ascending
|
|
5
|
+
categories:
|
|
6
|
+
- title: "💥 Breaking Change 💥"
|
|
7
|
+
labels:
|
|
8
|
+
- "breaking-change"
|
|
9
|
+
- "breaking change"
|
|
10
|
+
- title: "✨ New Features ✨"
|
|
11
|
+
labels:
|
|
12
|
+
- "enhancement"
|
|
13
|
+
- "feature"
|
|
14
|
+
- title: "🐛 Bug Fixes 🐛"
|
|
15
|
+
labels:
|
|
16
|
+
- "fix"
|
|
17
|
+
- "bugfix"
|
|
18
|
+
- "bug"
|
|
19
|
+
- title: "⚡ Performance ⚡"
|
|
20
|
+
labels:
|
|
21
|
+
- "performance"
|
|
22
|
+
- title: "🔧 Maintenance 🔧"
|
|
23
|
+
labels:
|
|
24
|
+
- "chore"
|
|
25
|
+
- "documentation"
|
|
26
|
+
- "maintenance"
|
|
27
|
+
- "repo"
|
|
28
|
+
- "dependencies"
|
|
29
|
+
- "github_actions"
|
|
30
|
+
- "refactor"
|
|
31
|
+
- "style"
|
|
32
|
+
- "build"
|
|
33
|
+
- "revert"
|
|
34
|
+
- title: "🎓 Code Quality 🎓"
|
|
35
|
+
labels:
|
|
36
|
+
- "code-quality"
|
|
37
|
+
- "CI"
|
|
38
|
+
- "test"
|
|
39
|
+
autolabeler:
|
|
40
|
+
- label: "breaking-change"
|
|
41
|
+
title:
|
|
42
|
+
- '/^[a-z]+(\([^)]+\))?!:/i'
|
|
43
|
+
- label: "feature"
|
|
44
|
+
title:
|
|
45
|
+
- '/^feat(\([^)]+\))?:/i'
|
|
46
|
+
- label: "bugfix"
|
|
47
|
+
title:
|
|
48
|
+
- '/^fix(\([^)]+\))?:/i'
|
|
49
|
+
- label: "refactor"
|
|
50
|
+
title:
|
|
51
|
+
- '/^refactor(\([^)]+\))?:/i'
|
|
52
|
+
- label: "code-quality"
|
|
53
|
+
title:
|
|
54
|
+
- '/^test(\([^)]+\))?:/i'
|
|
55
|
+
- label: "CI"
|
|
56
|
+
title:
|
|
57
|
+
- '/^ci(\([^)]+\))?:/i'
|
|
58
|
+
- label: "chore"
|
|
59
|
+
title:
|
|
60
|
+
- '/^chore(\([^)]+\))?:/i'
|
|
61
|
+
- label: "documentation"
|
|
62
|
+
title:
|
|
63
|
+
- '/^docs(\([^)]+\))?:/i'
|
|
64
|
+
- label: "style"
|
|
65
|
+
title:
|
|
66
|
+
- '/^style(\([^)]+\))?:/i'
|
|
67
|
+
- label: "performance"
|
|
68
|
+
title:
|
|
69
|
+
- '/^perf(\([^)]+\))?:/i'
|
|
70
|
+
- label: "revert"
|
|
71
|
+
title:
|
|
72
|
+
- '/^revert(\([^)]+\))?:/i'
|
|
73
|
+
- label: "build"
|
|
74
|
+
title:
|
|
75
|
+
- '/^build(\([^)]+\))?:/i'
|
|
76
|
+
version-resolver:
|
|
77
|
+
major:
|
|
78
|
+
labels:
|
|
79
|
+
- "breaking-change"
|
|
80
|
+
- "breaking change"
|
|
81
|
+
minor:
|
|
82
|
+
labels:
|
|
83
|
+
- "feature"
|
|
84
|
+
- "enhancement"
|
|
85
|
+
patch:
|
|
86
|
+
labels:
|
|
87
|
+
- "bug"
|
|
88
|
+
- "fix"
|
|
89
|
+
- "bugfix"
|
|
90
|
+
- "performance"
|
|
91
|
+
- "refactor"
|
|
92
|
+
- "style"
|
|
93
|
+
- "build"
|
|
94
|
+
- "chore"
|
|
95
|
+
- "documentation"
|
|
96
|
+
- "CI"
|
|
97
|
+
- "test"
|
|
98
|
+
- "code-quality"
|
|
99
|
+
- "revert"
|
|
100
|
+
default: patch
|
|
101
|
+
template: |
|
|
102
|
+
## What’s Changed
|
|
103
|
+
$CHANGES
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Autolabeler
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
- synchronize
|
|
8
|
+
- reopened
|
|
9
|
+
pull_request_target:
|
|
10
|
+
types:
|
|
11
|
+
- opened
|
|
12
|
+
- synchronize
|
|
13
|
+
- reopened
|
|
14
|
+
|
|
15
|
+
permissions: {}
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
group: ${{ format('al-{0}-pr-{1}', github.event_name, github.event.pull_request.number) }}
|
|
19
|
+
cancel-in-progress: true
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
autolabel:
|
|
23
|
+
name: Autolabel PR
|
|
24
|
+
# Run on pull_request_target for forks, pull_request for
|
|
25
|
+
# same-repo PRs to prevent duplicate runs.
|
|
26
|
+
if: >
|
|
27
|
+
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.fork) ||
|
|
28
|
+
(github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork)
|
|
29
|
+
permissions:
|
|
30
|
+
contents: read
|
|
31
|
+
pull-requests: write
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
timeout-minutes: 3
|
|
34
|
+
steps:
|
|
35
|
+
- uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
|
|
36
|
+
with:
|
|
37
|
+
egress-policy: audit
|
|
38
|
+
|
|
39
|
+
- uses: release-drafter/release-drafter/autolabeler@693d20e7c1ce1a81d3a41962f85914253b518449 # v7
|
|
40
|
+
env:
|
|
41
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Links
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main", "dev"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main", "dev"]
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: "0 0 * * 1"
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
linkChecker:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
|
|
19
|
+
with:
|
|
20
|
+
egress-policy: audit
|
|
21
|
+
|
|
22
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
23
|
+
|
|
24
|
+
- name: Link Checker
|
|
25
|
+
uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2
|
|
26
|
+
with:
|
|
27
|
+
args: --verbose --no-progress './**/*.md'
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Publish releases to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published, prereleased]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
tag:
|
|
9
|
+
description: 'Tag/Ref to build and publish'
|
|
10
|
+
required: false
|
|
11
|
+
default: ''
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build-and-publish:
|
|
18
|
+
name: Builds and publishes releases to PyPI
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
id-token: write
|
|
23
|
+
steps:
|
|
24
|
+
- uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
|
|
25
|
+
with:
|
|
26
|
+
egress-policy: audit
|
|
27
|
+
|
|
28
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
29
|
+
with:
|
|
30
|
+
ref: ${{ inputs.tag || github.ref }}
|
|
31
|
+
fetch-depth: 0
|
|
32
|
+
|
|
33
|
+
- name: Install uv
|
|
34
|
+
uses: astral-sh/setup-uv@1edb52594c857e2b5b13128931090f0640537287 # v5.3.0
|
|
35
|
+
with:
|
|
36
|
+
enable-cache: true
|
|
37
|
+
version: "0.10.9"
|
|
38
|
+
|
|
39
|
+
- name: Set up Python
|
|
40
|
+
run: uv python install 3.14
|
|
41
|
+
|
|
42
|
+
- name: Build package
|
|
43
|
+
run: uv build
|
|
44
|
+
|
|
45
|
+
- name: Publish release to PyPI
|
|
46
|
+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Release Drafter
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
pull-requests: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
update_release_draft:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
|
|
17
|
+
with:
|
|
18
|
+
egress-policy: audit
|
|
19
|
+
|
|
20
|
+
# Drafts your next Release notes as Pull Requests are merged into "main"
|
|
21
|
+
- uses: release-drafter/release-drafter@693d20e7c1ce1a81d3a41962f85914253b518449 # v7
|
|
22
|
+
env:
|
|
23
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint
|
|
2
|
+
|
|
3
|
+
name: Test
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
- dev
|
|
10
|
+
pull_request:
|
|
11
|
+
branches:
|
|
12
|
+
- main
|
|
13
|
+
- dev
|
|
14
|
+
|
|
15
|
+
permissions: read-all
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
prek:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
|
|
22
|
+
with:
|
|
23
|
+
egress-policy: audit
|
|
24
|
+
|
|
25
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
26
|
+
- name: Set up Python
|
|
27
|
+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.14"
|
|
30
|
+
- name: Install prek
|
|
31
|
+
run: pip install prek==0.4.0
|
|
32
|
+
- name: Run prek
|
|
33
|
+
run: prek run --all-files --skip no-commit-to-branch
|
|
34
|
+
build:
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
needs: prek
|
|
37
|
+
strategy:
|
|
38
|
+
matrix:
|
|
39
|
+
python-version:
|
|
40
|
+
- "3.13"
|
|
41
|
+
- "3.14"
|
|
42
|
+
|
|
43
|
+
steps:
|
|
44
|
+
- uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
|
|
45
|
+
with:
|
|
46
|
+
egress-policy: audit
|
|
47
|
+
|
|
48
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
49
|
+
with:
|
|
50
|
+
fetch-depth: 2
|
|
51
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
52
|
+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
|
|
53
|
+
with:
|
|
54
|
+
python-version: ${{ matrix.python-version }}
|
|
55
|
+
- name: Install dependencies
|
|
56
|
+
run: |
|
|
57
|
+
python -m pip install --upgrade pip
|
|
58
|
+
pip install tox tox-gh-actions
|
|
59
|
+
- name: Test with tox
|
|
60
|
+
run: tox
|
|
61
|
+
- name: Upload coverage data
|
|
62
|
+
if: ${{ matrix.python-version == '3.14' }}
|
|
63
|
+
uses: "actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a" # v7
|
|
64
|
+
with:
|
|
65
|
+
name: coverage-data
|
|
66
|
+
path: "coverage.xml"
|
|
67
|
+
|
|
68
|
+
coverage:
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
needs: build
|
|
71
|
+
steps:
|
|
72
|
+
- uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
|
|
73
|
+
with:
|
|
74
|
+
egress-policy: audit
|
|
75
|
+
|
|
76
|
+
- name: Check out the repository
|
|
77
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
78
|
+
with:
|
|
79
|
+
fetch-depth: 2
|
|
80
|
+
- name: Download coverage data
|
|
81
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
|
82
|
+
with:
|
|
83
|
+
name: coverage-data
|
|
84
|
+
- name: Upload coverage report
|
|
85
|
+
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6
|
|
86
|
+
with:
|
|
87
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Hide sublime text stuff
|
|
2
|
+
*.sublime-project
|
|
3
|
+
*.sublime-workspace
|
|
4
|
+
|
|
5
|
+
# Hide some OS X stuff
|
|
6
|
+
.DS_Store
|
|
7
|
+
.AppleDouble
|
|
8
|
+
.LSOverride
|
|
9
|
+
Icon
|
|
10
|
+
|
|
11
|
+
# Thumbnails
|
|
12
|
+
._*
|
|
13
|
+
|
|
14
|
+
# IntelliJ IDEA
|
|
15
|
+
.idea
|
|
16
|
+
*.iml
|
|
17
|
+
|
|
18
|
+
# pytest
|
|
19
|
+
.pytest_cache
|
|
20
|
+
.cache
|
|
21
|
+
|
|
22
|
+
# GITHUB Proposed Python stuff:
|
|
23
|
+
*.py[cod]
|
|
24
|
+
|
|
25
|
+
# C extensions
|
|
26
|
+
*.so
|
|
27
|
+
|
|
28
|
+
# Packages
|
|
29
|
+
*.egg
|
|
30
|
+
*.egg-info
|
|
31
|
+
dist
|
|
32
|
+
build
|
|
33
|
+
eggs
|
|
34
|
+
.eggs
|
|
35
|
+
parts
|
|
36
|
+
bin
|
|
37
|
+
var
|
|
38
|
+
sdist
|
|
39
|
+
develop-eggs
|
|
40
|
+
.installed.cfg
|
|
41
|
+
lib
|
|
42
|
+
lib64
|
|
43
|
+
pip-wheel-metadata
|
|
44
|
+
|
|
45
|
+
# Logs
|
|
46
|
+
*.log
|
|
47
|
+
pip-log.txt
|
|
48
|
+
|
|
49
|
+
# Unit test / coverage reports
|
|
50
|
+
.coverage
|
|
51
|
+
.tox
|
|
52
|
+
coverage.xml
|
|
53
|
+
nosetests.xml
|
|
54
|
+
htmlcov/
|
|
55
|
+
test-reports/
|
|
56
|
+
test-results.xml
|
|
57
|
+
test-output.xml
|
|
58
|
+
|
|
59
|
+
# Translations
|
|
60
|
+
*.mo
|
|
61
|
+
|
|
62
|
+
# Mr Developer
|
|
63
|
+
.mr.developer.cfg
|
|
64
|
+
.project
|
|
65
|
+
.pydevproject
|
|
66
|
+
|
|
67
|
+
.python-version
|
|
68
|
+
|
|
69
|
+
# emacs auto backups
|
|
70
|
+
*~
|
|
71
|
+
*#
|
|
72
|
+
*.orig
|
|
73
|
+
|
|
74
|
+
# venv stuff
|
|
75
|
+
pyvenv.cfg
|
|
76
|
+
pip-selfcheck.json
|
|
77
|
+
venv
|
|
78
|
+
.venv
|
|
79
|
+
Pipfile*
|
|
80
|
+
share/*
|
|
81
|
+
Scripts/
|
|
82
|
+
|
|
83
|
+
# vimmy stuff
|
|
84
|
+
*.swp
|
|
85
|
+
*.swo
|
|
86
|
+
tags
|
|
87
|
+
ctags.tmp
|
|
88
|
+
|
|
89
|
+
# vagrant stuff
|
|
90
|
+
virtualization/vagrant/setup_done
|
|
91
|
+
virtualization/vagrant/.vagrant
|
|
92
|
+
virtualization/vagrant/config
|
|
93
|
+
|
|
94
|
+
# Visual Studio Code
|
|
95
|
+
.vscode/*
|
|
96
|
+
!.vscode/cSpell.json
|
|
97
|
+
!.vscode/extensions.json
|
|
98
|
+
!.vscode/tasks.json
|
|
99
|
+
|
|
100
|
+
# Typing
|
|
101
|
+
.mypy_cache
|
|
102
|
+
*.pyc
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# .pre-commit-config.yaml
|
|
2
|
+
default_install_hook_types: [pre-commit, pre-push]
|
|
3
|
+
|
|
4
|
+
repos:
|
|
5
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
6
|
+
rev: v0.9.7
|
|
7
|
+
hooks:
|
|
8
|
+
- id: ruff
|
|
9
|
+
args: [--fix]
|
|
10
|
+
- id: ruff-format
|
|
11
|
+
|
|
12
|
+
- repo: https://github.com/codespell-project/codespell
|
|
13
|
+
rev: v2.4.1
|
|
14
|
+
hooks:
|
|
15
|
+
- id: codespell
|
|
16
|
+
args:
|
|
17
|
+
- --ignore-words-list=hass,alot,datas,dof,dur,farenheit,hist,iff,ines,ist,lightsensor,mut,nd,pres,referer,ser,serie,te,technik,ue,uint,visability,wan,wanna,withing,iam,incomfort
|
|
18
|
+
- --skip="./.*,*.csv,*.json"
|
|
19
|
+
- --quiet-level=2
|
|
20
|
+
exclude_types: [csv, json]
|
|
21
|
+
|
|
22
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
23
|
+
rev: v5.0.0
|
|
24
|
+
hooks:
|
|
25
|
+
- id: trailing-whitespace
|
|
26
|
+
- id: end-of-file-fixer
|
|
27
|
+
- id: check-yaml
|
|
28
|
+
- id: debug-statements
|
|
29
|
+
- id: check-docstring-first
|
|
30
|
+
- id: no-commit-to-branch
|
|
31
|
+
args: [--branch=main]
|
|
32
|
+
- id: check-executables-have-shebangs
|
|
33
|
+
stages: [manual]
|
|
34
|
+
|
|
35
|
+
- repo: https://github.com/adrienverge/yamllint.git
|
|
36
|
+
rev: v1.35.1
|
|
37
|
+
hooks:
|
|
38
|
+
- id: yamllint
|
|
39
|
+
|
|
40
|
+
- repo: https://github.com/prettier/prettier
|
|
41
|
+
rev: 2.0.4
|
|
42
|
+
hooks:
|
|
43
|
+
- id: prettier
|
|
44
|
+
stages: [manual]
|
|
45
|
+
|
|
46
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
47
|
+
rev: v1.15.0
|
|
48
|
+
hooks:
|
|
49
|
+
- id: mypy
|
|
50
|
+
files: ^openevsehttp/.+\.py$
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
ignore: |
|
|
2
|
+
release-drafter.yml
|
|
3
|
+
rules:
|
|
4
|
+
braces:
|
|
5
|
+
level: error
|
|
6
|
+
min-spaces-inside: 0
|
|
7
|
+
max-spaces-inside: 1
|
|
8
|
+
min-spaces-inside-empty: -1
|
|
9
|
+
max-spaces-inside-empty: -1
|
|
10
|
+
brackets:
|
|
11
|
+
level: error
|
|
12
|
+
min-spaces-inside: 0
|
|
13
|
+
max-spaces-inside: 0
|
|
14
|
+
min-spaces-inside-empty: -1
|
|
15
|
+
max-spaces-inside-empty: -1
|
|
16
|
+
colons:
|
|
17
|
+
level: error
|
|
18
|
+
max-spaces-before: 0
|
|
19
|
+
max-spaces-after: 1
|
|
20
|
+
commas:
|
|
21
|
+
level: error
|
|
22
|
+
max-spaces-before: 0
|
|
23
|
+
min-spaces-after: 1
|
|
24
|
+
max-spaces-after: 1
|
|
25
|
+
comments:
|
|
26
|
+
level: error
|
|
27
|
+
require-starting-space: true
|
|
28
|
+
min-spaces-from-content: 2
|
|
29
|
+
comments-indentation:
|
|
30
|
+
level: error
|
|
31
|
+
document-end:
|
|
32
|
+
level: error
|
|
33
|
+
present: false
|
|
34
|
+
document-start:
|
|
35
|
+
level: error
|
|
36
|
+
present: false
|
|
37
|
+
empty-lines:
|
|
38
|
+
level: error
|
|
39
|
+
max: 1
|
|
40
|
+
max-start: 0
|
|
41
|
+
max-end: 1
|
|
42
|
+
hyphens:
|
|
43
|
+
level: error
|
|
44
|
+
max-spaces-after: 1
|
|
45
|
+
indentation:
|
|
46
|
+
level: error
|
|
47
|
+
spaces: 2
|
|
48
|
+
indent-sequences: true
|
|
49
|
+
check-multi-line-strings: false
|
|
50
|
+
key-duplicates:
|
|
51
|
+
level: error
|
|
52
|
+
line-length: disable
|
|
53
|
+
new-line-at-end-of-file:
|
|
54
|
+
level: error
|
|
55
|
+
new-lines:
|
|
56
|
+
level: error
|
|
57
|
+
type: unix
|
|
58
|
+
trailing-spaces:
|
|
59
|
+
level: error
|
|
60
|
+
truthy: disable
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# External Session Management
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The `python-openevse-http` library now supports passing an external `aiohttp.ClientSession` to the `OpenEVSE` class. This allows you to manage the session lifecycle yourself and share sessions across multiple API clients.
|
|
6
|
+
|
|
7
|
+
## Benefits
|
|
8
|
+
|
|
9
|
+
- **Session Reuse**: Share a single session across multiple OpenEVSE instances or other aiohttp-based clients
|
|
10
|
+
- **Custom Configuration**: Configure session settings like timeouts, connectors, and SSL verification
|
|
11
|
+
- **Resource Management**: Better control over connection pooling and resource cleanup
|
|
12
|
+
- **Integration**: Easier integration with existing applications that already manage aiohttp sessions
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
### With External Session
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
import aiohttp
|
|
20
|
+
from openevsehttp import OpenEVSE
|
|
21
|
+
|
|
22
|
+
async def main():
|
|
23
|
+
# Create your own session with custom settings
|
|
24
|
+
timeout = aiohttp.ClientTimeout(total=30)
|
|
25
|
+
async with aiohttp.ClientSession(timeout=timeout) as session:
|
|
26
|
+
# Pass the session to OpenEVSE
|
|
27
|
+
charger = OpenEVSE("openevse.local", session=session)
|
|
28
|
+
|
|
29
|
+
# Use the charger normally
|
|
30
|
+
await charger.update()
|
|
31
|
+
print(f"Status: {charger.status}")
|
|
32
|
+
|
|
33
|
+
# Clean up
|
|
34
|
+
await charger.ws_disconnect()
|
|
35
|
+
# Session will be closed by the context manager
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Without External Session (Backward Compatible)
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from openevsehttp import OpenEVSE
|
|
42
|
+
|
|
43
|
+
async def main():
|
|
44
|
+
# The library creates and manages its own sessions
|
|
45
|
+
charger = OpenEVSE("openevse.local")
|
|
46
|
+
|
|
47
|
+
# Use the charger normally
|
|
48
|
+
await charger.update()
|
|
49
|
+
print(f"Status: {charger.status}")
|
|
50
|
+
|
|
51
|
+
await charger.ws_disconnect()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Sharing a Session
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import aiohttp
|
|
58
|
+
from openevsehttp import OpenEVSE
|
|
59
|
+
|
|
60
|
+
async def main():
|
|
61
|
+
async with aiohttp.ClientSession() as session:
|
|
62
|
+
# Use the same session for multiple chargers
|
|
63
|
+
charger1 = OpenEVSE("charger1.local", session=session)
|
|
64
|
+
charger2 = OpenEVSE("charger2.local", session=session)
|
|
65
|
+
|
|
66
|
+
# Both chargers use the same session
|
|
67
|
+
await charger1.update()
|
|
68
|
+
await charger2.update()
|
|
69
|
+
|
|
70
|
+
await charger1.ws_disconnect()
|
|
71
|
+
await charger2.ws_disconnect()
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## API Changes
|
|
75
|
+
|
|
76
|
+
### `OpenEVSE.__init__()`
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
def __init__(
|
|
80
|
+
self,
|
|
81
|
+
host: str,
|
|
82
|
+
user: str = "",
|
|
83
|
+
pwd: str = "",
|
|
84
|
+
session: aiohttp.ClientSession | None = None,
|
|
85
|
+
) -> None:
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Parameters:**
|
|
89
|
+
- `host` (str): The hostname or IP address of the OpenEVSE charger
|
|
90
|
+
- `user` (str, optional): Username for authentication
|
|
91
|
+
- `pwd` (str, optional): Password for authentication
|
|
92
|
+
- `session` (aiohttp.ClientSession | None, optional): External session to use for HTTP requests. If not provided, the library will create temporary sessions as needed.
|
|
93
|
+
|
|
94
|
+
### `OpenEVSEWebsocket.__init__()`
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
def __init__(
|
|
98
|
+
self,
|
|
99
|
+
server,
|
|
100
|
+
callback,
|
|
101
|
+
user=None,
|
|
102
|
+
password=None,
|
|
103
|
+
session: aiohttp.ClientSession | None = None,
|
|
104
|
+
):
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Parameters:**
|
|
108
|
+
- `server`: The server URL
|
|
109
|
+
- `callback`: Callback function for websocket events
|
|
110
|
+
- `user` (optional): Username for authentication
|
|
111
|
+
- `password` (optional): Password for authentication
|
|
112
|
+
- `session` (aiohttp.ClientSession | None, optional): External session to use for websocket connections. If not provided, a new session will be created.
|
|
113
|
+
|
|
114
|
+
## Important Notes
|
|
115
|
+
|
|
116
|
+
1. **Session Lifecycle**: When you provide an external session, you are responsible for closing it. The library will NOT close externally provided sessions.
|
|
117
|
+
|
|
118
|
+
2. **Backward Compatibility**: This change is fully backward compatible. Existing code that doesn't provide a session will continue to work exactly as before.
|
|
119
|
+
|
|
120
|
+
3. **Websocket Sessions**: The websocket connection will also use the provided session, ensuring consistent session management across all HTTP and WebSocket operations.
|
|
121
|
+
|
|
122
|
+
4. **Thread Safety**: If you're using the same session across multiple OpenEVSE instances, ensure you're following aiohttp's thread safety guidelines.
|
|
123
|
+
|
|
124
|
+
## Migration Guide
|
|
125
|
+
|
|
126
|
+
If you want to migrate existing code to use external sessions:
|
|
127
|
+
|
|
128
|
+
**Before:**
|
|
129
|
+
```python
|
|
130
|
+
charger = OpenEVSE("openevse.local")
|
|
131
|
+
await charger.update()
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**After:**
|
|
135
|
+
```python
|
|
136
|
+
async with aiohttp.ClientSession() as session:
|
|
137
|
+
charger = OpenEVSE("openevse.local", session=session)
|
|
138
|
+
await charger.update()
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
No other changes are required!
|