python-openevse-http 0.3.3__tar.gz → 0.3.5__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.
Files changed (70) hide show
  1. python_openevse_http-0.3.5/.github/dependabot.yml +16 -0
  2. python_openevse_http-0.3.5/.github/release-drafter.yml +103 -0
  3. python_openevse_http-0.3.5/.github/workflows/autolabeler.yml +41 -0
  4. python_openevse_http-0.3.5/.github/workflows/links.yml +27 -0
  5. python_openevse_http-0.3.5/.github/workflows/publish-to-pypi.yml +35 -0
  6. python_openevse_http-0.3.5/.github/workflows/release-drafter.yml +23 -0
  7. python_openevse_http-0.3.5/.github/workflows/test.yml +87 -0
  8. python_openevse_http-0.3.5/.gitignore +102 -0
  9. python_openevse_http-0.3.5/.pre-commit-config.yaml +50 -0
  10. python_openevse_http-0.3.5/.yamllint +60 -0
  11. python_openevse_http-0.3.5/EXTERNAL_SESSION.md +141 -0
  12. {python_openevse_http-0.3.3/python_openevse_http.egg-info → python_openevse_http-0.3.5}/PKG-INFO +1 -1
  13. python_openevse_http-0.3.5/codecov.yml +7 -0
  14. python_openevse_http-0.3.5/example_external_session.py +67 -0
  15. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/openevsehttp/client.py +7 -27
  16. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/openevsehttp/commands.py +24 -42
  17. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/openevsehttp/const.py +2 -0
  18. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/openevsehttp/properties.py +3 -4
  19. python_openevse_http-0.3.5/openevsehttp/utils.py +29 -0
  20. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/pyproject.toml +6 -0
  21. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5/python_openevse_http.egg-info}/PKG-INFO +1 -1
  22. python_openevse_http-0.3.5/python_openevse_http.egg-info/SOURCES.txt +67 -0
  23. python_openevse_http-0.3.5/requirements.txt +1 -0
  24. python_openevse_http-0.3.5/requirements_lint.txt +4 -0
  25. python_openevse_http-0.3.5/requirements_test.txt +11 -0
  26. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/setup.py +1 -2
  27. python_openevse_http-0.3.5/tests/__init__.py +1 -0
  28. python_openevse_http-0.3.5/tests/common.py +10 -0
  29. python_openevse_http-0.3.5/tests/conftest.py +248 -0
  30. python_openevse_http-0.3.5/tests/fixtures/github_v2.json +74 -0
  31. python_openevse_http-0.3.5/tests/fixtures/github_v4.json +211 -0
  32. python_openevse_http-0.3.5/tests/fixtures/v2_json/config.json +43 -0
  33. python_openevse_http-0.3.5/tests/fixtures/v2_json/status.json +35 -0
  34. python_openevse_http-0.3.5/tests/fixtures/v4_json/config-broken-semver.json +66 -0
  35. python_openevse_http-0.3.5/tests/fixtures/v4_json/config-broken.json +65 -0
  36. python_openevse_http-0.3.5/tests/fixtures/v4_json/config-dev.json +67 -0
  37. python_openevse_http-0.3.5/tests/fixtures/v4_json/config-extra-version.json +66 -0
  38. python_openevse_http-0.3.5/tests/fixtures/v4_json/config-new.json +108 -0
  39. python_openevse_http-0.3.5/tests/fixtures/v4_json/config-unknown-semver.json +66 -0
  40. python_openevse_http-0.3.5/tests/fixtures/v4_json/config.json +67 -0
  41. python_openevse_http-0.3.5/tests/fixtures/v4_json/schedule.json +30 -0
  42. python_openevse_http-0.3.5/tests/fixtures/v4_json/status-broken.json +49 -0
  43. python_openevse_http-0.3.5/tests/fixtures/v4_json/status-new.json +80 -0
  44. python_openevse_http-0.3.5/tests/fixtures/v4_json/status.json +52 -0
  45. python_openevse_http-0.3.5/tests/fixtures/websocket.json +68 -0
  46. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/tests/test_client.py +1 -1
  47. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/tests/test_commands.py +49 -1
  48. python_openevse_http-0.3.5/tox.ini +35 -0
  49. python_openevse_http-0.3.3/python_openevse_http.egg-info/SOURCES.txt +0 -30
  50. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/LICENSE +0 -0
  51. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/README.md +0 -0
  52. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/openevsehttp/__init__.py +0 -0
  53. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/openevsehttp/__main__.py +0 -0
  54. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/openevsehttp/exceptions.py +0 -0
  55. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/openevsehttp/managers.py +0 -0
  56. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/openevsehttp/sensors.py +0 -0
  57. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/openevsehttp/websocket.py +0 -0
  58. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/python_openevse_http.egg-info/dependency_links.txt +0 -0
  59. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/python_openevse_http.egg-info/not-zip-safe +0 -0
  60. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/python_openevse_http.egg-info/requires.txt +0 -0
  61. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/python_openevse_http.egg-info/top_level.txt +0 -0
  62. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/setup.cfg +0 -0
  63. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/tests/test_external_session.py +0 -0
  64. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/tests/test_main_edge_cases.py +0 -0
  65. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/tests/test_managers.py +0 -0
  66. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/tests/test_mixins.py +0 -0
  67. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/tests/test_properties.py +0 -0
  68. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/tests/test_sensors.py +0 -0
  69. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/tests/test_shaper.py +0 -0
  70. {python_openevse_http-0.3.3 → python_openevse_http-0.3.5}/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,35 @@
1
+ name: Publish releases to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published, prereleased]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build-and-publish:
13
+ name: Builds and publishes releases to PyPI
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
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
21
+ - name: Set up Python 3.9
22
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
23
+ with:
24
+ python-version: 3.9
25
+ - name: Install wheel
26
+ run: >-
27
+ pip install wheel
28
+ - name: Build
29
+ run: >-
30
+ python3 setup.py sdist bdist_wheel
31
+ - name: Publish release to PyPI
32
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
33
+ with:
34
+ user: __token__
35
+ password: ${{ secrets.PYPI_TOKEN }}
@@ -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!
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python_openevse_http
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: Python wrapper for OpenEVSE HTTP API
5
5
  Home-page: https://github.com/firstof9/python-openevse-http
6
6
  Download-URL: https://github.com/firstof9/python-openevse-http
@@ -0,0 +1,7 @@
1
+ comment: false
2
+ coverage:
3
+ status:
4
+ project:
5
+ default:
6
+ target: 90
7
+ threshold: 0.09