wallento / sungrow-websocket

Python Library to acees the websocket interface of Sungrow inverters
MIT License
7 stars 3 forks source link

KeyError: 'data_name' #8

Open qrti opened 1 month ago

qrti commented 1 month ago

data = sg.get_data() is executed every some seconds, it works fine but sometimes execution stops with this traceback:

Traceback (most recent call last):
  File "d:\User\Python\sunGrow\test.py", line 45, in <module>
    data = sg.get_data()
           ^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Programs\Python\Python312\Lib\site-packages\sungrow_websocket\__init__.py", line 198, in get_data
    return asyncio.run(self.get_data_async())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Programs\Python\Python312\Lib\site-packages\sungrow_websocket\__init__.py", line 141, in get_data_async
    name = item["data_name"]
           ~~~~^^^^^^^^^^^^^
KeyError: 'data_name'