-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when API request responds without units #15
Comments
I have implemented a check in the example script if that list is empty. |
Thx a lot for your reponse :) This should not be a critic, but in the example script:
There is only a return, not a real error message, which is why I get the error message above in my first post from python right? Do you have any idea, why the list is empty in my case even though the portal is definitely showing 3 units? |
The response looks ok so far. Can you also post a screenshot of the payload next to the preview tab? |
The payload looks also as expected. "/rest/info/units", json.dumps({"limit": 10, "offset": 0, "filter": {}})) with this one: "/rest/info/units", json.dumps({"limit": 10, "offset": 0, "filter": {"msr3Filter": False}})) and try it again? |
That what I get. Thx a lot for your time. I am happy to assist you more, but please be careful with your precious time. It is not that important to me to get it running, but I am learning a lot :) Probably the difference between my login and the one of most people is that I have 3 BHKW, 2 in one location and the third one on a different instead of just one in one location? |
Locations and number of BHKWs shouldn't make a difference because its still the same list in the response. "/rest/info/units", json.dumps({"limit": 10, "offset": 0, "filter": {"connected": False, "search": None, "msr3Filter": False, "sortByLocation": True}})) |
$ python output_data.py
py-senertec: 2024-07-11 19:26:21 INFO Logging in..
py-senertec: 2024-07-11 19:26:21 INFO Login was successful.
py-senertec: 2024-07-11 19:26:21 INFO Initializing senertec platform...
Traceback (most recent call last):
File "/var/home/VENV_BHWK_Senertec_Dachs2API/output_data.py", line 106, in
start()
File "/var/home/VENV_BHWK_Senertec_Dachs2API/output_data.py", line 42, in start
if senertecClient.connectUnit(units[0].serial) is False:
~~~~~^^^
IndexError: list index out of range
I am not able to get any "names" for the units?
Even though there are 3 units shown on dachsconnect.senertec.com, see the following screenshot:
If you want I can create a pull request for better error messaging in case no units are returned by the API:
The text was updated successfully, but these errors were encountered: