I am using an optical sensor on my energy meter. At the moment I am calling a python script fetching new values through optical sensor every 10 seconds. The raspberry pi zero takes a while to start the python script (over 5 seconds).
I like to fetch sensor data every second now.
What I want:
- start script once, use while loop to fetch new sensor data and sleep 1 second after fetch
- offer a rest API endpoint with latest value (uvicorn and fastapi?!)
Maybe I can get some help to get me started. Thanks.