Skip to content
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

API thowing unhandled errors #27

@mawoka-myblock

Description

@mawoka-myblock

Originally mentioned by @gerhardwallnoefer in #9.

The following exceptions were unhandled and experienced:

ValueError regarding an invalid integer
Update for switch.apsystems_ez1_power_status fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 898, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1216, in async_device_update
await self.async_update()
File "/config/custom_components/apsystemsapi_local/switch.py", line 59, in async_update
status = await self._api.get_device_power_status()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/APsystemsEZ1/init.py", line 251, in get_device_power_status
return Status(int(response["data"]["status"])) if response else None
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''

and

TypeError regarding missing inits for the ReturnOutputData
Update for sensor.apsystems_ez1_today_production fails
Update for sensor.apsystems_ez1_total_power fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 898, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1216, in async_device_update
await self.async_update()
File "/config/custom_components/apsystemsapi_local/sensor.py", line 226, in async_update
await self.async_update_data()
File "/config/custom_components/apsystemsapi_local/sensor.py", line 142, in async_update_data
data = await self._api.get_output_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/APsystemsEZ1/init.py", line 163, in get_output_data
return ReturnOutputData(**response["data"]) if response else None
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ReturnOutputData.init() missing 6 required positional arguments: 'p1', 'e1', 'te1', 'p2', 'e2', and 'te2'

My take on that: As these errors are so rare and are seemingly random, it's fine if they throw such an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions