OpenEPaperLink / Home_Assistant_Integration

Home assistant Integration for the OpenEPaperLink project
Apache License 2.0
137 stars 32 forks source link

Numerous errors in HA log #31

Closed tomm1ed closed 9 months ago

tomm1ed commented 12 months ago

Describe the bug HA logs is filled with the following error repeating every 30 seconds:

homeassistant | 2023-08-24 08:58:41.625 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ap_free_space fails homeassistant | Traceback (most recent call last): homeassistant | File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 699, in async_update_ha_state homeassistant | await self.async_device_update() homeassistant | File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 940, in async_device_update homeassistant | await hass.async_add_executor_job(self.update) homeassistant | File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run homeassistant | result = self.fn(*self.args, **self.kwargs) homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ homeassistant | File "/config/custom_components/open_epaper_link/sensor.py", line 226, in update homeassistant | self._attr_native_value = round(int(self._hub.data["ap"]["littlefsfree"]) / 1024,1) homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ homeassistant | TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

To Reproduce Start HA, install open_epaper_link_homeassistant (through HACS). open logfile

Expected behavior No errors in logs

HA version Home Assistant 2023.8.3

psfales commented 10 months ago

I'm seeing frequent errors in my log too. I don't know if makes sense to open a new issue for my errors (or multiple new issues, once for each error), but for now I'll try them here:

This one is showing up every few seconds:

2023-10-08 06:45:38.518 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.00000218d1e03b10_next_update fails
Traceback (most recent call last):
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 683, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 938, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/opt/python3.11/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/open_epaper_link/sensor.py", line 351, in update
    self._attr_native_value = datetime.datetime.fromtimestamp(self._hub.data[eslid]["nextupdate"],datetime.timezone.utc)

It could be a configuration error on my part, but I don't know where to change the settings that would fix it, and in any case it would nice if it could be caught and handled more cleanly.

I think I'm able to work around it by disabling the "nextupdate" sensor for each of the tags in the UI

psfales commented 10 months ago

I'm also seeing this one every few seconds:

2023-10-08 06:47:38.453 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ap_temp fails
Traceback (most recent call last):
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 683, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 938, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/opt/python3.11/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/open_epaper_link/sensor.py", line 124, in update
    self._attr_native_value = round(self._hub.data["ap"]["temp"],1)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I think this is because the temperature sensor in the AP (at least in my AP) is not supported and always reports as "Unknown." The temperature sensors in the tags are working and report valid values, but I don't get it from the AP.

I think I'm able to work around it by disabling "sensor.ap_temp" in UI

jwoglom commented 10 months ago

I fixed the temperature error in #38. Should be pretty trivial to fix the other cases.

jonasniesner commented 10 months ago

@jwoglom Thank you for fixing the temp error. If you want to fix the other errors, I would be happy to implement these fixes.

nohn commented 9 months ago

Home Assistant 2023.11.0 + OpenEPaperLink integration 0.3.2 quite frequently throw this:

2023-11-04 14:44:01.796 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ap_temp fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 696, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 959, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/open_epaper_link/sensor.py", line 124, in update
    self._attr_native_value = round(self._hub.data["ap"]["temp"],1)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type NoneType doesn't define __round__ method
jonasniesner commented 9 months ago

should be fixed with the latest release