Comments (8)
Hi @K1ngjulien!
I appreciate your support :)
I think documenting it could be one thing, but since documentation tends to deteriorate over time, I'd rather stick to proper tests. So if you're familiar with pytest
you could contribute some api test cases. Even when they are mocked, imho they provide enough insight into the API than we could achieve by simultaneously have to maintain both the documentation and the tests.
For "reverse engineering" the API use, as you already pointed out, Chrome's DevTools on the smartmeter portal.
I create already a ticket for specific test cases we didn't cover yet: #113
Since the API is not open, I fear it could change faster than we could adapt code and documentation. So better just change test cases for that matter.
If you coincidentally have access to a PV sensor, we are still missing test code for that as well. :)
Thanks in advance for any contribution what so ever.
from wienernetzesmartmeter.
Wiener Netze changing the API on us is not really something i would fear (unless it has happened before). It looks to me like they're propperly versioning their endpoint urls.
I'll have a look what I can do and probably write some api docs at least for myself :)
If you coincidentally have access to a PV sensor, we are still missing test code for that as well. :)
Funny you mention that... we have PV on our roof, but wien energie has been stealing all our unused electricity since they installed the smart meters and won't give us an "einspeisezählpunkt" for our 10 year old installation...
My neighbor seems to have finally gotten one, so I'll have to talk to him how he did that and maybe then i could help with the PV api :)
Are there any major differences between a normal zählpunkt and an einspeisezählpunkt for pv? or do you get more than just the energy meter measurements once you're selling to the grid?
from wienernetzesmartmeter.
Also: Do I just copy my code to homeassistant/custom_components/wnsm
for development?
from wienernetzesmartmeter.
Wiener Netze changing the API on us is not really something i would fear (unless it has happened before). It looks to me like they're propperly versioning their endpoint urls.
It happened before, and afaik they are not versioning it (at least I am not aware of proper versioning)
I'll have a look what I can do and probably write some api docs at least for myself :)
If you write it any way, then please contribute it to the Wiki :)
If you coincidentally have access to a PV sensor, we are still missing test code for that as well. :)
Funny you mention that... we have PV on our roof, but wien energie has been stealing all our unused electricity since they installed the smart meters and won't give us an "einspeisezählpunkt" for our 10 year old installation...
I'd suggest switching to another service provider. Wien Energie is not giving you that, as they probably don't want to buy electricity from you. But there are other good options available for selling. Wiener Netze has to provide the infrastructure in this case, i.e. the smart meter.
My neighbor seems to have finally gotten one, so I'll have to talk to him how he did that and maybe then i could help with the PV api :) Are there any major differences between a normal zählpunkt and an einspeisezählpunkt for pv? or do you get more than just the energy meter measurements once you're selling to the grid?
No major differences, but potentially some difference in the way it is reported in smart meter webportal. See #51 for more information
from wienernetzesmartmeter.
Also: Do I just copy my code to
homeassistant/custom_components/wnsm
for development?
tests go here please: https://github.com/DarwinsBuddy/WienerNetzeSmartmeter/tree/main/tests/it
there is already a test_api.py
. For coverage you can look into the corresponding test.yaml
workflow in .github/actions
from wienernetzesmartmeter.
Also: Do I just copy my code to
homeassistant/custom_components/wnsm
for development?
if you want to develop on it and fiddle around, I can recommend my set up:
I checked out homeassistant-core, set up a dev container in vscode there and symlinked this repository into homeassistant/custom_components/wnsm
as you suggested ;)
from wienernetzesmartmeter.
there seems to be some issue with pytest-homeassistant-custom-component
python3 -m venv .venv
source .venv/bin/activate
pip install -r tests/requirements.txt
setup and pip install work just fine but when i run the tests (even just pytest alone without any parameters) i get the following output:
[~/code/WienerNetzeSmartmeter (venv:.venv) (main:1) (1)]: pytest --cov=wnsm tests --cov-report html --cov-report xml --cov-report term
Traceback (most recent call last):
File "/home/julian/code/WienerNetzeSmartmeter/.venv/bin/pytest", line 8, in <module>
sys.exit(console_main())
^^^^^^^^^^^^^^
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/_pytest/config/__init__.py", line 190, in console_main
code = main()
^^^^^^
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/_pytest/config/__init__.py", line 148, in main
config = _prepareconfig(args, plugins)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/_pytest/config/__init__.py", line 329, in _prepareconfig
config = pluginmanager.hook.pytest_cmdline_parse(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 55, in _multicall
gen.send(outcome)
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/_pytest/helpconfig.py", line 103, in pytest_cmdline_parse
config: Config = outcome.get_result()
^^^^^^^^^^^^^^^^^^^^
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1058, in pytest_cmdline_parse
self.parse(args)
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1346, in parse
self._preparse(args, addopts=addopts)
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1229, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 287, in load_setuptools_entrypoints
plugin = ep.load()
^^^^^^^^^
File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
module = import_module(match.group('module'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/_pytest/assertion/rewrite.py", line 168, in exec_module
exec(co, module.__dict__)
File "/home/julian/code/WienerNetzeSmartmeter/.venv/lib/python3.11/site-packages/pytest_homeassistant_custom_component/plugins.py", line 116, in <module>
from .asyncio_legacy import legacy_coroutine
ModuleNotFoundError: No module named 'pytest_homeassistant_custom_component.asyncio_legacy'
looking in venv/lib/python3.11/site-packages/pytest-homeassistant-custom-component/
the file asyncio_legacy.py
is indeed missing 🤔
I manually upgraded with pip install pytest-homeassistant-custom-component==0.13.28
and that seems to run pytest perfectly fine and the asyncio_legacy
module can also be found in the site-package folder
Is this something you've encountered before? Might be worth a version bump in case the tests are just working because the have an old version cached 😅
from wienernetzesmartmeter.
I'd suggest switching to another service provider. Wien Energie is not giving you that, as they probably don't want to buy electricity from you. But there are other good options available for selling. Wiener Netze has to provide the infrastructure in this case, i.e. the smart meter.
yeah but the problem is, before we can switch to something like OeMAG, we need Wiener Netze to give us the damn zählpunktnummer :D
from wienernetzesmartmeter.
Related Issues (20)
- Energy Dashboard shows feeding without actually feeding in place HOT 31
- Problem with 29.02. HOT 2
- Subsequent update to statistics after initial import is not working HOT 5
- wnsm: Error on device update HOT 7
- No statistics are imported the day after the consumtion HOT 1
- Subsequent update to statistics after initial import is still not working HOT 12
- Multiple contracts causes issue with live sensor HOT 19
- two Smartmeters under the same contract. consumption and production HOT 3
- HomeAssistantType was used from wnsm, this is a deprecated alias which will be removed in HA Core 2025.5 HOT 2
- Keine Verbindung seit neuem Einspeisepunkt HOT 16
- ig
- Change password for integration HOT 2
- Unnamed error in wnsm/live_sensor.py:68 HOT 2
- Startup time of WienerNetzeSmartmeter HOT 2
- Statistics Zählpunk liefert keine Daten mehr HOT 4
- Protokollfehler - Please file an issue with this error immer um 22:00 HOT 7
- Incompatibillity HA 2025.1
- Returned energy data missing HOT 2
- Hourly Data (statistics) with no data since 24.6. HOT 4
- Add new anlage-typ in api/constants.py HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wienernetzesmartmeter.