mawoka-myblock / apsystemsapi-ha

10 stars 4 forks source link

Unknown error after setup #1

Closed Schmandre closed 11 months ago

Schmandre commented 11 months ago

Hey,

first, thank you for your work. I think we can get it working for me, so I can provide you any information you want for furture testing.

I just setup the custom component using hacs and defining the sensor in configuration.yaml

Unfortunately, I get the following error

homeassistant  |   self._api.init(self._username, self._password)
homeassistant  |
homeassistant  | 2023-11-13 18:12:56.478 ERROR (MainThread) [homeassistant.components.sensor] apsystemsapi: Error on device update!
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 573, in _async_add_entity
homeassistant  |     await entity.async_device_update(warning=False)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 957, in async_device_update
homeassistant  |     await self.async_update()
homeassistant  |   File "/config/custom_components/apsystemsapi/sensor.py", line 89, in async_update
homeassistant  |     inverter_realtime = await self._api.get_inverter_realtime(self._inverter.inverter_dev_id)
homeassistant  |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.11/site-packages/apsystems_api/__init__.py", line 137, in get_inverter_realtime
homeassistant  |     d = await _process_response(resp)
homeassistant  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.11/site-packages/apsystems_api/__init__.py", line 28, in _process_response
homeassistant  |     raise UnknownError()
homeassistant  | apsystems_api.UnknownError

Any information I can provide you?

The setup in configuration file locks like that

# APSystems EZ1-M API
sensor:
  - platform: apsystemsapi
    username: censored@censoredde
    password: mysupersecurepassword

My username is similar to my email, so I censored that.

BR Schmandre

mawoka-myblock commented 11 months ago

You can't provide any more information, but this error could occur if the device is offline. I'll push an update which will include some more information

Schmandre commented 11 months ago

Sounds logical. Device is offline atm, cause its dark night 👍🏽☺️

thank you

mawoka-myblock commented 11 months ago

Sounds logical. Device is offline atm, cause its dark night 👍🏽☺️

thank you

Maybe try again tomorrow and tell me if the issue persists. You have to restart home assistant for that

mawoka-myblock commented 11 months ago

Ok, the error should now include some more details. You can also try it again now to tell me what it says.

Schmandre commented 11 months ago

Ok, the error should now include some more details. You can also try it again now to tell me what it says.

Thank you for your fast push.

The error returns now code 1001 as you can see here

homeassistant  |   self._api.init(self._username, self._password)
homeassistant  |
homeassistant  | 2023-11-13 19:52:54.746 ERROR (MainThread) [homeassistant.components.sensor] apsystemsapi: Error on device update!
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 573, in _async_add_entity
homeassistant  |     await entity.async_device_update(warning=False)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 957, in async_device_update
homeassistant  |     await self.async_update()
homeassistant  |   File "/config/custom_components/apsystemsapi/sensor.py", line 89, in async_update
homeassistant  |     inverter_realtime = await self._api.get_inverter_realtime(self._inverter.inverter_dev_id)
homeassistant  |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.11/site-packages/apsystems_api/__init__.py", line 140, in get_inverter_realtime
homeassistant  |     d = await _process_response(resp)
homeassistant  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.11/site-packages/apsystems_api/__init__.py", line 31, in _process_response
homeassistant  |     raise UnknownError(resp.status, data["code"], data)
homeassistant  | apsystems_api.UnknownError: UnknownError - Code: 1001, Body: {'code': 1001}
mawoka-myblock commented 11 months ago

The error 1001 means that the device is offline (as expected)

mawoka-myblock commented 11 months ago

Should be fixed.

Schmandre commented 11 months ago

The error 1001 means that the device is offline (as expected)

Sounds good. So I`ll retry tomorrow and will inform you afterwards

Schmandre commented 11 months ago

image

After device is back online, everything works. Thank you