Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

652
Vistas
Raspberry Pi: SenseHat cannot initialize sensors from web app

Hello and thanks for reading my very first question!

I am trying to integrate the sensor data of a Sense HAT (former ASTRO PI) board into a webpage that I am hosting on a Raspberry Pi 4 with NGINX + uWSGI + Flask. I had some problems since the user www-data could not access e.g. the /dev/fb1 device. I guess I fixed some of these issues by adding www-data to the pi, the input, the gpio, and the video user groups but in the uWSGI log I still get some exception, when I try to access/initialize the SenseHAT's humidity, temperature, or pressure:

[2020-04-28 11:15:55,904] ERROR in app: Exception on /system [GET]
Traceback (most recent call last):
  File "./web_base.py", line 35, in system
    temp_humidity = round(sense.get_temperature_from_humidity(),1)
  File "/usr/lib/python3/dist-packages/sense_hat/sense_hat.py", line 582, in get_temperature_from_humidity
    self._init_humidity()  # Ensure humidity sensor is initialised
  File "/usr/lib/python3/dist-packages/sense_hat/sense_hat.py", line 549, in _init_humidity
    raise OSError('Humidity Init Failed')
OSError: Humidity Init Failed

When I run this as the default user inside Thonny, it works, so I guess I still miss some group for my www-data user.

I am using the CPUTemperature object from gpiozero, too, to read the CPU temperature and this is working, only the sensors from sense_hat fail to init.

Does anybody out there have any idea what I am missing or give me a hint where to look at to find a solution?

Thank you very much.

HvFf

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda