Working on my second Weather Pi, this one the Grove version. Its running ok'ish. However I am getting periodic errors on the HTU21DF module. Its very sporadic, as the basic functions seem to be reading the sensor just fine.
Command '['htu21dflib/htu21dflib', '-l']' returned non-zero exit status 254 File "/usr/local/lib/python2.7/dist-packages/apscheduler/executors/base.py", line 125, in run_job retval = job.func(*job.args, **job.kwargs) File "GroveWeatherPi.py", line 950, in sampleWeather HTU21DFOut = subprocess.check_output(["htu21dflib/htu21dflib","-l"]) File "/usr/lib/python2.7/subprocess.py", line 573, in check_output raise CalledProcessError(retcode, cmd, output=output)
That one has been running fine for over a year now. The code is slightly different as its the original version. Its only every now and then that it throws that error. Otherwise it reads the sensor fine.
I've been playing around with the job scheduler limiting what is running. When I run it with just the sampleAndDisplay and patTheDog "jobs" I get no HTU21DF errors nor do I get the sunAirPlus errors from this thread.
If I add any of the following jobs: sampleWeather, sampleSunAirPlus, writeWeatherRecord, writePowerRecord I will eventually get both errors. Going through the code of those jobs cleaning them up for my version/install. Will see if that helps any.
Yes! That really reinforces my "thread problem" argument. The issue is that occasionally two jobs may be running at the same time and will try to access the shared I2C bus. Something is not working quite right in the OS to allow that to happen correctly. I'm thinking I need to put a semaphore regulating access to the I2C bus to make the software totally "thread safe".
Changed the code to fit my setup a bit better and use the secondCount loop instead of apscheduler. Running a lot better, no HTU errors, no AM2315 temp = 0.0 C, no SunAirPlus errors, No DS3231 errors. Eventually those jobs are on a collision course. I do like the scheduler though because if something does error it still keeps running the code.