hansliss / regofetcher

Scripts to fetch data from IVT REGO2000, Bosch ProControl and Buderus Gateway Logamatic KM200
4 stars 3 forks source link

Exception #3

Closed DrKTM closed 2 years ago

DrKTM commented 2 years ago

Hi, I would like to have a data from my IVT AIR X Heat pump with REGO2000. I changed in config.ini: devicepassword, user password, host, rundir, mail, errorcodes, htmltemplate (I use "/home/openhabian/regofetcher-master"). I try: openhabian@openhabian:~/regofetcher-master $ python3 getRegoData.py -c config.ini -s myrego -x -p "/,/dhwCircuits,/heatingCircuits" with result: /home/openhabian/.local/lib/python3.7/site-packages/quik.py:377: FutureWarning: Possible nested set at position 8 KEYVALSEP = re.compile(r'[ \t]:[[ \t](.*)$', re.S) Trying /heatingCircuits Caught exception Trying /dhwCircuits Caught exception Trying / Caught exception

Could you help me with it, please?

hansliss commented 2 years ago

This issue needs some more output from the script, and I won't be able to test it on my own equipment. Could you please pull the latest version and try again? I've added a stack trace and error printout for that exception handler.

DrKTM commented 2 years ago

there is output: /home/openhabian/.local/lib/python3.7/site-packages/quik.py:377: FutureWarning: Possible nested set at position 8 KEYVALSEP = re.compile(r'[ \t]:[[ \t](.*)$', re.S) Trying /heatingCircuits Caught exception! Traceback (most recent call last): File "/usr/lib/python3.7/urllib/request.py", line 1324, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "/usr/lib/python3.7/http/client.py", line 1260, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.7/http/client.py", line 1030, in _send_output self.send(msg) File "/usr/lib/python3.7/http/client.py", line 970, in send self.connect() File "/usr/lib/python3.7/http/client.py", line 942, in connect (self.host,self.port), self.timeout, self.source_address) File "/usr/lib/python3.7/socket.py", line 727, in create_connection raise err File "/usr/lib/python3.7/socket.py", line 716, in create_connection sock.connect(sa) OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "getRegoData.py", line 95, in main res = json.loads(get(host, sp, key).decode()) File "getRegoData.py", line 61, in get response = fetchData(host, path) File "getRegoData.py", line 25, in fetchData resp = opener.open(url) File "/usr/lib/python3.7/urllib/request.py", line 525, in open response = self._open(req, data) File "/usr/lib/python3.7/urllib/request.py", line 543, in _open '_open', req) File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(*args) File "/usr/lib/python3.7/urllib/request.py", line 1352, in http_open return self.do_open(http.client.HTTPConnection, req) File "/usr/lib/python3.7/urllib/request.py", line 1326, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 113] No route to host>

hansliss commented 2 years ago

Ah, much better. The Rego isn't reachable from the computer you are running the script on, hence the "No route to host". Make sure the hostname/ip address is correct, and make sure you can communicate with it.

DrKTM commented 2 years ago

ohhh, my mistake. Router has assigned an address other than the one in DHCP static table (I dont know why) So connection is running, URLs.txt is updated by your settings command.

Could you help me with next problem, please?

openhabian@openhabian:~/regofetcher-master $ python3 getRegoData.py -c config.ini -s myrego -x -p "/dhwCircuits/dhw1/charge -m value" /home/openhabian/.local/lib/python3.7/site-packages/quik.py:377: FutureWarning: Possible nested set at position 8 KEYVALSEP = re.compile(r'[ \t]:[[ \t](.)$', re.S) Trying /dhwCircuits/dhw1/charge -m value Caught exception! Traceback (most recent call last): File "getRegoData.py", line 95, in main res = json.loads(get(host, sp, key).decode()) File "getRegoData.py", line 61, in get response = fetchData(host, path) File "getRegoData.py", line 25, in fetchData resp = opener.open(url) File "/usr/lib/python3.7/urllib/request.py", line 525, in open response = self._open(req, data) File "/usr/lib/python3.7/urllib/request.py", line 543, in _open '_open', req) File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(args) File "/usr/lib/python3.7/urllib/request.py", line 1352, in http_open return self.do_open(http.client.HTTPConnection, req) File "/usr/lib/python3.7/urllib/request.py", line 1324, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "/usr/lib/python3.7/http/client.py", line 1260, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib/python3.7/http/client.py", line 1271, in _send_request self.putrequest(method, url, **skips) File "/usr/lib/python3.7/http/client.py", line 1123, in putrequest raise InvalidURL(f"URL can't contain control characters. {url!r} " http.client.InvalidURL: URL can't contain control characters. '/dhwCircuits/dhw1/charge -m value' (found at least ' ')

hansliss commented 2 years ago

Yes, you put quotes around the entire last set of parameters, which makes that whole string a single parameter. Try python3 getRegoData.py -c config.ini -s myrego -x -p "/dhwCircuits/dhw1/charge" -m value ... although the quotes aren't really necessary at all here.

hansliss commented 2 years ago

I'm sorry, I just realized you just copied the commands from README.md, and that those examples were actually incorrect. Beyond the quotes, they also used "-x" incorrectly - it should not be there. Also, one of them used -m and -S together which is not how it's meant to work. I've fixed the examples now. Sorry about that!

DrKTM commented 2 years ago

Thanks! And I hope my last problem: openhabian@openhabian:~/regofetcher-master $ python3 getRegoData.py -c config.ini -s myrego -p /dhwCircuits/dhw1/charge /home/openhabian/.local/lib/python3.7/site-packages/quik.py:377: FutureWarning: Possible nested set at position 8 KEYVALSEP = re.compile(r'[ \t]:[[ \t](.*)$', re.S) N/A

N/A is returned for all urls which I tried. (/dhwCircuits/dhw1/actualTemp, /heatingCircuits/hc1/status , /system/brand, /gateway/DateTime, ...) and JSon dump is not created...

hansliss commented 2 years ago

What's the result of the "-x" command from the README? The first of the example commands, that is.

DrKTM commented 2 years ago

OSError: [Errno 113] No route to host STRANGE! The IVT IP module has new IP address! It does not accept static IP address table! grrrr..... So, I put new IP into config.ini and all is working now!

DrKTM commented 2 years ago

THANK YOU VERY MUCH!