dstrigl / HtREST

Heliotherm heat pump REST API server
Other
11 stars 0 forks source link

Error in getting param #277

Closed chrisch80 closed 1 year ago

chrisch80 commented 1 year ago

Hello,

thank you for the great tool.

Unfortunately I am getting the following error message if I call /api/v1/param/. All other calls seems to work fine.

Call: pi@htraspi:~ $ curl -X GET "http://192.168.77.14:8777/api/v1/param/" -H "accept: application/json" {"message": "invalid response for access of parameter 'BSZ Verdichter Schaltung WW' ['ERR,INVALID IDX']"}

In the log I can see the following: (htrest) pi@htraspi:~ $ htrest -d /dev/ttyUSB0 -b 19200 --host 192.168.77.14 --port 8777 --read-only Start Heliotherm heat pump REST API server v0.1.11. Namespace(device='/dev/ttyUSB0', baudrate=19200, host='192.168.77.14', port=8777, user='', bool_as_int=False, logging_config='/home/pi/venv/htrest/lib/python3.11/site-packages/htrest/logging.conf', debug=False, read_only=True, no_param_verification=False) 2023-10-16 17:26:16,382 INFO [htrest.app|create_app]: open connection to heat pump (<htheatpump.htheatpump.HtHeatpump object at 0x75993930>) 2023-10-16 17:26:16,468 INFO [htrest.app|create_app]: successfully connected to heat pump #101135 2023-10-16 17:26:16,551 INFO [htrest.app|create_app]: software version = 2.03N (20) 2023-10-16 17:26:16,595 INFO [htrest.app|create_app]: *** created Flask app <Flask 'htrest.app'> with config <Config {'ENV': 'production', 'DEBUG': False, 'TESTING': False, 'PROPAGATE_EXCEPTIONS': None, 'PRESERVE_CONTEXT_ON_EXCEPTION': None, 'SECRET_KEY': None, 'PERMANENT_SESSION_LIFETIME': datetime.timedelta(days=31), 'USE_X_SENDFILE': False, 'SERVER_NAME': None, 'APPLICATION_ROOT': '/', 'SESSION_COOKIE_NAME': 'session', 'SESSION_COOKIE_DOMAIN': None, 'SESSION_COOKIE_PATH': None, 'SESSION_COOKIE_HTTPONLY': True, 'SESSION_COOKIE_SECURE': False, 'SESSION_COOKIE_SAMESITE': None, 'SESSION_REFRESH_EACH_REQUEST': True, 'MAX_CONTENT_LENGTH': None, 'SEND_FILE_MAX_AGE_DEFAULT': None, 'TRAP_BAD_REQUEST_ERRORS': None, 'TRAP_HTTP_EXCEPTIONS': False, 'EXPLAIN_TEMPLATE_LOADING': False, 'PREFERRED_URL_SCHEME': 'http', 'JSON_AS_ASCII': True, 'JSON_SORT_KEYS': True, 'JSONIFY_PRETTYPRINT_REGULAR': False, 'JSONIFY_MIMETYPE': 'application/json', 'TEMPLATES_AUTO_RELOAD': None, 'MAX_COOKIE_SIZE': 4093, 'SWAGGER_UI_DOC_EXPANSION': 'list', 'RESTX_VALIDATE': True, 'RESTX_MASK_SWAGGER': False, 'ERROR_404_HELP': False, 'BUNDLE_ERRORS': True}> Map([<Rule '/api/v1/faultlist/size' (HEAD, OPTIONS, GET) -> api.faultlist_fault_list_size>, <Rule '/api/v1/faultlist/last' (HEAD, OPTIONS, GET) -> api.faultlist_last_fault>, <Rule '/api/v1/swagger.json' (HEAD, OPTIONS, GET) -> api.specs>, <Rule '/api/v1/faultlist/' (HEAD, OPTIONS, GET) -> api.faultlist_fault_list>, <Rule '/api/v1/fastquery/' (HEAD, OPTIONS, GET) -> api.fastquery_fast_query_list>, <Rule '/api/v1/datetime/' (HEAD, OPTIONS, PUT, GET) -> api.datetime_date_time>, <Rule '/api/v1/timeprog/' (HEAD, OPTIONS, GET) -> api.timeprog_time_progs>, <Rule '/api/v1/device/' (HEAD, OPTIONS, GET) -> api.device_device>, <Rule '/api/v1/param/' (HEAD, OPTIONS, PUT, GET) -> api.param_param_list>, <Rule '/api/v1/' (HEAD, OPTIONS, GET) -> api.doc>, <Rule '/api/v1/' (HEAD, OPTIONS, GET) -> api.root>, <Rule '/api/v1/faultlist/' (HEAD, OPTIONS, GET) -> api.faultlist_fault_entry>, <Rule '/api/v1/fastquery/' (HEAD, OPTIONS, GET) -> api.fastquery_fast_query>, <Rule '/api/v1/timeprog///' (HEAD, OPTIONS, PUT, GET) -> api.timeprog_time_prog_entry>, <Rule '/api/v1/timeprog/' (HEAD, OPTIONS, PUT, GET) -> api.timeprog_time_prog>, <Rule '/api/v1/param/' (HEAD, OPTIONS, PUT, GET) -> api.param_param>, <Rule '/swaggerui/' (HEAD, OPTIONS, GET) -> restx_doc.static>, <Rule '/static/' (HEAD, OPTIONS, GET) -> static>])

I have the following packages installed:

(htrest) pi@htraspi:~ pip3 list Package Version


aioserial 1.3.0 aniso8601 9.0.1 attrs 23.1.0 click 8.1.7 Flask 2.1.3 Flask-BasicAuth 0.2.0 flask-restx 0.5.1 htheatpump 1.3.2 htrest 0.1.11 itsdangerous 2.1.2 Jinja2 3.1.2 jsonschema 4.19.1 jsonschema-specifications 2023.7.1 MarkupSafe 2.1.3 pip 23.0.1 pyserial 3.5 pytz 2023.3.post1 referencing 0.30.2 rpds-py 0.10.6 setuptools 66.1.1 six 1.16.0 Werkzeug 2.1.2

My software version: pi@htraspi:~ $ curl -X GET "http://192.168.77.14:8777/api/v1/device/" -H "accept: application/json" {"property_id": 101135, "serial_number": 10xxxx, "software_version": "2.03N"}

I don't use my heliotherm heatpump for hot water. I use it only for heating. For hot water I have a other heatpump. Could it be the reason, the following message looks somehow to that: {"message": "invalid response for access of parameter 'BSZ Verdichter Schaltung WW' ['ERR,INVALID IDX']"}

thank you and best regards, Chris

chrisch80 commented 1 year ago

Seems I realy don't have all parameters which are defined in /api/v1/param/

working: pi@htraspi:~ $ curl -X GET "http://192.168.17.14:8777/api/v1/param/WW%20Normaltemp." -H "accept: application/json" {"value": 43}

not working: pi@htraspi:~ $ curl -X GET "http://192.168.17.14:8777/api/v1/param/BSZ%20Verdichter%20Schaltung%20WW" -H "accept: application/json" {"message": "invalid response for access of parameter 'BSZ Verdichter Schaltung WW' ['ERR,INVALID IDX']"}

Can I somewhere define by myself which parameters should be asked using /api/v1/param/? Or does it anyway make sense to use always /api/v1/param/ to just get 1 single parameter. How does htrest work with the heliotherm by using /api/v1/param/? Getting the parameters all at once or with 1 access or asking parameter after parameter (1 access for each parameter)?

dstrigl commented 1 year ago

Hi Chris, just use the script "htcomplparams" to get a full list of all supported datapoints of the heatpump. See also here: https://loxwiki.atlassian.net/wiki/spaces/LOX/pages/1583089663/Heliotherm+Open+Source (under "Vollständige Liste aller verfügbaren Parameter der eigenen Heliotherm Wärmepumpe")

chrisch80 commented 1 year ago

Hello,

great thx, it is working fine now.

What I did: I created with htcomplparams --device /dev/ttyUSB0 --csv a list and copied it to ~/.htheatpump/htparams.csv. Now all parameters are working.

br Christoph

chrisch80 commented 1 year ago

Ticket can be closed.