#How to filter this error from the log

1 messages · Page 1 of 1 (latest)

patent pivot
#

tried a few options

  homeassistant.components.nederlandse_spoorwegen.sensor:
    - AssertionError
    - 'self._next_trip is not None'
    - 'Error doing job: Task exception was never retrieved (None)'

but this error keeps returning frequently and is spamming the log. Since it has been an issue for years in that integration, I just don't want to see those any longer.. 😉

Logger: homeassistant
Bron: components/nederlandse_spoorwegen/sensor.py:250
Eerst voorgekomen: 20 oktober 2025 om 11:09:15 (366 gebeurtenissen)
Laatst gelogd: 09:39:18

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 1130, in _async_update_entity_states
await entity.async_update_ha_state(True)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 981, in async_update_ha_state
self._async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1151, in _async_write_ha_state
self.__async_calculate_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1092, in __async_calculate_state
if extra_state_attributes := self.extra_state_attributes:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/nederlandse_spoorwegen/sensor.py", line 250, in extra_state_attributes
assert self._next_trip is not None
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

mighty fractal
#

logger:
default: error
logs:
homeassistant.components.nederlandse_spoorwegen.sensor: fatal

#

You can put this in your config yaml

#

change default to your wishes

deft grove
#

I don't think you can filter actual runtime exceptions, only explicit logs

#

You can turn the component into a custom component and see if you can handle it differently in the code

visual leaf
#
logger:
  default: warning
  logs:
    homeassistant.components.nederlandse_spoorwegen.sensor: fatal
  filters:
    homeassistant.components.nederlandse_spoorwegen.sensor:
      - "AssertionError"
      - "self._next_trip is not None"
      - "Error doing job: Task exception was never retrieved (None)"
patent pivot
#

Problem is the logger isn’t that component , it s homeassistant

sacred apex
#

Do you have an issue @patent pivot and I can see if I can solve it rather simple (without rebuilding the entire thing)?

patent pivot
#

You mean in the core repo? No I don’t yet

#

We’ve had this before though , but lately seems to have worsened

#

Logger: homeassistant
Bron: components/nederlandse_spoorwegen/sensor.py:250
Eerst voorgekomen: 10:01:15 (194 gebeurtenissen)
Laatst gelogd: 17:39:11

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 1130, in _async_update_entity_states
await entity.async_update_ha_state(True)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 981, in async_update_ha_state
self._async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1151, in _async_write_ha_state
self.__async_calculate_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1092, in __async_calculate_state
if extra_state_attributes := self.extra_state_attributes:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/nederlandse_spoorwegen/sensor.py", line 250, in extra_state_attributes
assert self._next_trip is not None
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

#

There is 1 route in the config that has no attributes,. It’s international and maybe the integration just doesn’t handle these correctly. Joost (being Dutch ) will understand why , Roosendaal - Berlin

#

We should however be able to not see that level of logging or not al all if the integration would handle that case?

sacred apex
#

That assert is probably there for typing but it’s causing a runtime issue in saving the state which is not the responsibility of the integration but core itself.

patent pivot
#

So let me write that up in an issue and tag you ?

sacred apex
#

Please do or I might forget 🤣

#

Ill take a look in the next days

patent pivot