Rpi_gpio error although working fine

I am using a wired door magnetic sensor to trigger a light automation with my raspberry PI.

I was able to successfully create the binary sensor below in configuration.yaml

binary_sensor:

  • platform: rpi_gpio
    ports:
    23: Garage Door

The sensor changes status correctly, but I see the error message below when starting hass:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/rpi_gpio/binary_sensor.py", line 74, in read_gpio
    self.schedule_update_ha_state()
 File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 422, in schedule_update_ha_state
    assert self.hass is not None
AssertionError


Could anyone suggest how to get rid of the error or even point to what it means?

Thanks