error message:
Wait at least 2500ms during requests
I am struggeling since three days to get a python script running to read out some json data from a heating controller based in same subnet.
The script itself runs without any problems from the ssh session on the homeassistant host started as root or other user, but it fails when started using the command_line sensor:
`import requests
import json
import sys
Url = 'http://192.168.178.227:4321/Ccct/hk2'
resp = requests.get(Url)
f = open('log.txt', 'w')
f.write(f'{resp.status_code}\n')
f.write(resp.text)
f.close()
e = {}
try:
e = str(resp.json())
except Exception as ex:
e['time_prg'] = ex.args[0]
finally:
print(json.dumps(e))
sys.exit(0)`
if the script is running in the ssh session, it completes with the output:
"{'hk2': {'L_roomtemp_act': 0, 'L_roomtemp_set': 80, 'L_flowtemp_act': 191, 'L_flowtemp_set': 80, 'L_comfort': 0, 'L_state': 8, 'L_statetext': 'Betriebsart Aus', 'L_pump': 0, 'remote_override': 0, 'mode_auto': 0, 'time_prg': 0, 'temp_setback': 180, 'temp_heat': 220, 'temp_vacation': 150, 'name': 'Verein', 'oekomode': 0, 'autocomfort': -1, 'autocomfort_sunset': 0, 'autocomfort_sunrise': 0}}"
if it is executed by homeassistant I got return code 1, and log.txt contains:
401 Wait at least 2500ms during requests
I now tried to switch to curl. Using curl I had exactly the same problem:
curl -X GET http://192.168.178.227:4321/Ccct/hk2 -o curlout.txt
runs without any problem when executing in ssh, but fails with the output:
Wait at least 2500ms during requests
when executed by homeassistant.
How can I fix this behavior?
Any help is greatly appreciated!!
best regards
Peter