Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ“Œ Pull Request: Refactor & Enhance dbus-opendtu #227

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5053731
rename and refactor dbus-opendtu
0x7878 Nov 11, 2024
3f24b5e
add basic test wip
0x7878 Nov 11, 2024
d21f513
Refactor test_dbus-opendtu.py to remove unused mock_constants paramet…
0x7878 Nov 11, 2024
6c2c3a7
since paths is used as constant I moved it
0x7878 Nov 11, 2024
1e1190b
Refactor imports in dbus_opendtu.py
0x7878 Nov 12, 2024
9642657
Refactor test_dbus-opendtu.py to remove unused mock_constants paramet…
0x7878 Nov 12, 2024
52e3275
Refactor code to remove unused paths
0x7878 Nov 12, 2024
f531c41
Refactor code to remove unused paths parameter in DbusService constru…
0x7878 Nov 14, 2024
5790d95
Refactor test_dbus-opendtu.py to use register_services instead of reg…
0x7878 Nov 14, 2024
0e4e41d
Refactor code to use register_services instead of register_service
0x7878 Nov 14, 2024
a8e3014
Refactor code to use get_DbusServices instead of register_services
0x7878 Nov 14, 2024
bbf7e7d
Refactor logging statement to use info level instead of critical
0x7878 Nov 14, 2024
d2ac513
move code to add sign_of_life_all_services function and use it to sen…
0x7878 Nov 14, 2024
f806c56
Refactor file paths to use underscore instead of hyphen in dbus_opend…
0x7878 Nov 14, 2024
f7367b1
remove dependency and move code the main function (update routine)
0x7878 Nov 14, 2024
2bb1f02
Add constants instead of hardcoded values
0x7878 Nov 15, 2024
6a43f11
move tests in proper folder
0x7878 Nov 15, 2024
1ca51d2
move functions to helpers instead of constants; add unit tests and im…
0x7878 Nov 15, 2024
6370a8e
Add coverage configuration and script
0x7878 Nov 16, 2024
3645b52
Refactor code and improve error handling
0x7878 Nov 16, 2024
a52c72d
Add more tests
0x7878 Nov 16, 2024
1807484
Completed Coverage for dbus_opendtu.py: 96%
0x7878 Nov 17, 2024
2294c0e
Merge branch 'main' of github.com:henne49/dbus-opendtu into feature-a…
0x7878 Nov 17, 2024
9d4dc24
Refactor _get_serial method in dbus_service.py
0x7878 Nov 17, 2024
ad73463
Refactor _get_name and _get_status_url methods in dbus_service.py
0x7878 Nov 17, 2024
25104b3
wip working fetch
0x7878 Nov 17, 2024
dc11282
Change number of Inverters in ahoy_0.5.93_live.json
0x7878 Nov 18, 2024
671e87f
Added template and inverter tests
0x7878 Nov 18, 2024
dda5731
Move early fail condition to the right position
0x7878 Nov 18, 2024
ee69fd3
Refactored _read_config_dtu method and removed unreachable code
0x7878 Nov 18, 2024
c6c094f
adjust tests
0x7878 Nov 18, 2024
dff4727
Add test to verify that number_of_inverters are set
0x7878 Nov 18, 2024
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
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# .coveragerc to control coverage.py
[run]
omit =
*/dist-packages/*
tests/*
28 changes: 9 additions & 19 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.formatting.provider": "autopep8",
"autopep8.args": [
"--max-line-length",
"120"
],
"editor.formatOnSave": true,
"python.testing.unittestArgs": [
"-v",
"-s",
".",
"-p",
"test_*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
}
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"autopep8.args": ["--max-line-length", "120"],
"editor.formatOnSave": true,
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
"python.testing.unittestArgs": ["-v", "-s", "./tests", "-p", "test_*"]
}
29 changes: 29 additions & 0 deletions constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
'''Global constants'''

from helpers import _kwh, _a, _w, _v

DTUVARIANT_AHOY = "ahoy"
DTUVARIANT_OPENDTU = "opendtu"
DTUVARIANT_TEMPLATE = "template"
PRODUCTNAME = "henne49_dbus-opendtu"
CONNECTION = "TCP/IP (HTTP)"


VICTRON_PATHS = {
"/Ac/Energy/Forward": {
"initial": None,
"textformat": _kwh,
}, # energy produced by pv inverter
"/Ac/Power": {"initial": None, "textformat": _w},
"/Ac/L1/Voltage": {"initial": None, "textformat": _v},
"/Ac/L2/Voltage": {"initial": None, "textformat": _v},
"/Ac/L3/Voltage": {"initial": None, "textformat": _v},
"/Ac/L1/Current": {"initial": None, "textformat": _a},
"/Ac/L2/Current": {"initial": None, "textformat": _a},
"/Ac/L3/Current": {"initial": None, "textformat": _a},
"/Ac/L1/Power": {"initial": None, "textformat": _w},
"/Ac/L2/Power": {"initial": None, "textformat": _w},
"/Ac/L3/Power": {"initial": None, "textformat": _w},
"/Ac/L1/Energy/Forward": {"initial": None, "textformat": _kwh},
"/Ac/L2/Energy/Forward": {"initial": None, "textformat": _kwh},
"/Ac/L3/Energy/Forward": {"initial": None, "textformat": _kwh},
"/Ac/Out/L1/I": {"initial": None, "textformat": _a},
"/Ac/Out/L1/V": {"initial": None, "textformat": _v},
"/Ac/Out/L1/P": {"initial": None, "textformat": _w},
"/Dc/0/Voltage": {"initial": None, "textformat": _v},
}
157 changes: 0 additions & 157 deletions dbus-opendtu.py

This file was deleted.

Loading
Loading