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