signalkraft / myPyllant

A Python library to interact with the API behind the myVAILLANT app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to properly contribute API data?

hzulla opened this issue · comments

Hi there,

my Vaillant system comes with these components:

  • sensocomfort VRC 702
  • aguaflow (hot drinking water using the heating water tank as a heat source)
  • auroflow (solar thermal heating the water tank)
  • flexotherm (heat pump heating the water tank)

The home assistant integration is missing several sensors that are present in the myVaillant app.

I'd love to help adding those to your library. Can you add a guide on how to identify the strings you need for that and how to do the MITM thing?

Fwiw, running myPyllant.tests.generate_test_data returns nothing, no error message and no JSON result.

Running myPyllant.export results in

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/hanno/.local/lib/python3.10/site-packages/myPyllant/export.py", line 93, in <module>
    asyncio.run(main(**kwargs))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/hanno/.local/lib/python3.10/site-packages/myPyllant/export.py", line 63, in main
    async for system in api.get_systems():
  File "/home/hanno/.local/lib/python3.10/site-packages/myPyllant/api.py", line 262, in get_systems
    system = System(
  File "/home/hanno/.local/lib/python3.10/site-packages/myPyllant/models.py", line 161, in __init__
    self.circuits = [Circuit(system_id=self.id, **c) for c in self._merged_circuits]
  File "/home/hanno/.local/lib/python3.10/site-packages/myPyllant/models.py", line 161, in <listcomp>
    self.circuits = [Circuit(system_id=self.id, **c) for c in self._merged_circuits]
  File "/home/hanno/.local/lib/python3.10/site-packages/pydantic/main.py", line 150, in __init__
    __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Circuit
min_flow_temperature_setpoint
  Field required [type=missing, input_value={'system_id': '00000000-0...ack_mode_enabled': True}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.1.2/v/missing

(system_id value removed from trace)

@hzulla thanks for wanting to contribute. I made that missing field in your error message optional in the latest version, would you mind rerunning export + generate_test_data?

You should be able to contribute data by following the steps in https://github.com/signalkraft/myPyllant#contributing and then running generate_test_data. The README also explains where the test data pops up in the filesystem: https://github.com/signalkraft/myPyllant#contributing-test-data

@hzulla was there another folder with test data after running the command? The one you uploaded looks like the one I generated from my own setup.

If you pull the latest version and rerun the command, it'll now print the name of the folder.

Indeed, that's your directory from the git repo.

Calling python3 -m myPyllant.tests.generate_test_data [myuser] [mypw] germany vaillant

No error message. No directory being created.

@hzulla the latest version needs a --country argument and should output a path. Here is what it does on my machine (with the latest version on the main branch):

$ python3 -m myPyllant.tests.generate_test_data user password vaillant --country germany
Wrote test data to /home/user/Development/myPyllant/src/myPyllant/tests/json/56f4c513b87875849a089b83cafbe6fdd6020b55

Could you check again if you're on the latest one?

Okay, it's definitely helpful to actually read the instructions and do as told in there. Sorry for wasting your time.

Here's the actual output with the latest version of the software (with some serial numbers and UUIDs redacted).

d3a0d9a2f8d536dc37b3237c3a552cb74a4104e2.zip

hi @signalkraft my system also has issues. I attached my configuration too:
17732fb10772dccf2d0451bff2b4992c38d2c7ec.zip

Thanks a lot for the great work!

When I run the sample my output is:

pydantic_core._pydantic_core.ValidationError: 3 validation errors for Zone
desired_room_temperature_setpoint_cooling
  Field required [type=missing, input_value={'system_id': '8545c5f0-f...iated_circuit_index': 0}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/missing
quick_veto_start_date_time
  Field required [type=missing, input_value={'system_id': '8545c5f0-f...iated_circuit_index': 0}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/missing
quick_veto_end_date_time
  Field required [type=missing, input_value={'system_id': '8545c5f0-f...iated_circuit_index': 0}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/missing