bosch-thermostat / bosch-thermostat-client-python

Python3 asyncio package to talk to Bosch thermostat devices.
Apache License 2.0
23 stars 20 forks source link

After upgrading of Ubuntu this can't process multiple --path arguments #44

Closed JosefRypacek closed 1 month ago

JosefRypacek commented 1 month ago

Hi, I'm using this tool for a month and it was working fine for me on Ubuntu 22.04. Yesterday I had to upgrade to Ubuntu 24.04 and now I'm not able to retrieve more than one measurement at a time. Not sure if it can be cause by update of Python version or something else.

python3 -m venv bosch-thermostat-client
source bosch-thermostat-client/bin/activate
pip install bosch-thermostat-client
python3 --version
Python 3.12.3

bosch_cli --version
Using slower stringprep, consider compiling the faster cython/libidn one.
bosch_cli, version 0.26.0

Only the last one measurement is returned.

bosch_cli query --host <IP> --token <TOKEN> --password <PASS> --protocol HTTP --device IVT -p /heatSources/hs1/actualModulation -p /system/healthStatus
Using slower stringprep, consider compiling the faster cython/libidn one.
2024-09-07 13:32:34 INFO (MainThread) [bosch_thermostat_client.bosch_cli] Connecting to <IP> with 'HTTP'
2024-09-07 13:32:35 INFO (MainThread) [bosch_thermostat_client.bosch_cli] Query succeed: ('/heatSources/hs1/actualModulation', '/system/healthStatus')
{
    "allowedValues": [
        "error",
        "maintenance",
        "ok"
    ],
    "id": "/system/healthStatus",
    "recordable": 0,
    "type": "stringValue",
    "value": "ok",
    "writeable": 0
}
slovdahl commented 1 month ago

Maybe you were using an older version of the library on Ubuntu 22.04? The current version requires Python 3.11, and Ubuntu 22.04 comes with Python 3.10.

JosefRypacek commented 1 month ago

You are right about Ubuntu 22.04 and I don't know what version I had on Ubuntu 22.04. But it worked correctly. Now I installed it using pip again into new venv as shown above and it reports version 0.26.0 and prints output only for the last path even there is a log with both paths parsed (Query succeed: ('/heatSources/hs1/actualModulation', '/system/healthStatus')).

// EDIT: I modified the file and added following print. It seems I have correct version, but the output is not shown.

async def _runquery(gateway, path):
    _LOGGER.debug("Trying to connect to gateway.")
    results = []
    for p in path:
        print ("path: " + p)
2024-09-09 21:03:13 INFO (MainThread) [__main__] Connecting to <IP> with 'HTTP'
path: /heatSources/hs1/actualModulation
path: /system/healthStatus
2024-09-09 21:03:14 INFO (MainThread) [__main__] Query succeed: ('/heatSources/hs1/actualModulation', '/system/healthStatus')
{
    "allowedValues": [
        "error",
        "maintenance",
        "ok"
    ],
    "id": "/system/healthStatus",
    "recordable": 0,
    "type": "stringValue",
    "value": "ok",
    "writeable": 0
}

// EDIT 2: How it could print all results when this code prints only the last result? I changed it to results and it works now. What am I missing?

Very likely broken by this change: https://github.com/bosch-thermostat/bosch-thermostat-client-python/commit/e1db5be2a85c226f7d3014a208edbde6749d0d48

pszafer commented 1 month ago

It's typo. Thanks for catch!