Open mulles opened 1 month ago
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:
# connect to first unit
if senertecClient.connectUnit(units[0].serial) is False:
return
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?
Can you check the "units" response in the browser debugging network tab? If you refresh the site with your 3 units you should get it. It should look like this (demo account):
Looks like the data is available:
Please give me a hint, in case I did not erease all sensitive data :)
The response looks ok so far. Can you also post a screenshot of the payload next to the preview tab?
With pleasure:
The payload looks also as expected. The only difference is that py-senertec uses an empty filter with limit: 10, offset: 0. Maybe the filter value msr3Filter which is false has a default value of true in the system if it's not present. That would be my only idea because the msrTyp of your energy units is 2 and not 3. Can you try to replace this line of code of the library (client.py, Line 381):
"/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?
$ python output_data.py
py-senertec: 2024-07-11 22:37:31 INFO Logging in..
py-senertec: 2024-07-11 22:37:31 INFO Login was successful.
py-senertec: 2024-07-11 22:37:31 INFO Initializing senertec platform...
No energy units were found
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. It has to do something with the payload I think. Can you also try this complete filter:
"/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: