|
Post by doxidad on Nov 23, 2018 7:26:36 GMT -8
The normal inline reads work OK but the ones that the scheduler run all fail.
ALSO - values that are returned are in the wrong order
The SDL_Pi_AM2315 returns the values as Humidity, Temperature CRC. The GroveWeatherPi code expects them to be in the order of Temperature, Humidity, CRC.
Easy fix.
|
|
|
Post by doxidad on Nov 21, 2018 9:44:22 GMT -8
Hmmm... everthing is included. Here are 2 that look exactly like the above - other than they appear at different spots in the log. All of them seem to happen in the scheduler call to sampleAndDisplay.
Let me know if there is something that I am missing that should be included.
I've programmed in about 10+ languages over the past 40 years and I have been resisting learning python. I think my language queue is full 8-}.
Have a great Thanksgiving Day!
----------------- AM2315 Temperature/Humidity Sensor ----------------- 'NoneType' object has no attribute '__getitem__' 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 "/home/pi/SDL_Pi_GroveWeatherPi/GroveWeatherPi.py", line 1376, in sampleAndDisplay outsideTemperature, outsideHumidity, crc_check = am2315.read_humidity_temperature_crc() File "./SDL_Pi_AM2315/AM2315.py", line 91, in read_humidity_temperature_crc self._read_data() File "./SDL_Pi_AM2315/AM2315.py", line 63, in _read_data self.humidity = ((tmp[2] << 8) | tmp[3]) / 10.0
Tick! The time is: 2018-11-21 06:25:58.324848
----------------- AM2315 Temperature/Humidity Sensor ----------------- 'NoneType' object has no attribute '__getitem__' 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 "/home/pi/SDL_Pi_GroveWeatherPi/GroveWeatherPi.py", line 1376, in sampleAndDisplay outsideTemperature, outsideHumidity, crc_check = am2315.read_humidity_temperature_crc() File "./SDL_Pi_AM2315/AM2315.py", line 91, in read_humidity_temperature_crc self._read_data() File "./SDL_Pi_AM2315/AM2315.py", line 63, in _read_data self.humidity = ((tmp[2] << 8) | tmp[3]) / 10.0
----------------- Local WeatherRack Weather Sensors Sampling ----------------- Rain Total= 0.74 in
|
|
|
Post by doxidad on Nov 19, 2018 7:15:01 GMT -8
Just putting this here since I see the errors also. I added a comment in the AM2315 forum with the "non-type" errors a day or so ago.
|
|
|
Post by doxidad on Nov 18, 2018 13:08:29 GMT -8
I'm seeing a couple of things on the new version (GroveWeatherPi 034)- this is on a Pi Zero W.
1st thing is the AM2315 is not seen every other time the Groveweather Pi code is run.
The 2nd is this ----------------- AM2315 Temperature/Humidity Sensor ----------------- 'NoneType' object has no attribute '__getitem__' 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 "/home/pi/SDL_Pi_GroveWeatherPi/GroveWeatherPi.py", line 1376, in sampleAndDisplay outsideTemperature, outsideHumidity, crc_check = am2315.read_humidity_temperature_crc() File "./SDL_Pi_AM2315/AM2315.py", line 91, in read_humidity_temperature_crc self._read_data() File "./SDL_Pi_AM2315/AM2315.py", line 63, in _read_data self.humidity = ((tmp[2] << 8) | tmp[3]) / 10.0
Searching I found that it happened 446 time in 1654 reads
Still getting (thread?) errors on the INA3221 reads (not all of them).
|
|
|
Post by doxidad on Oct 7, 2018 6:19:05 GMT -8
Thanks for the update
|
|
|
Post by doxidad on Oct 5, 2018 10:21:56 GMT -8
Any progress on items 2 & 3?
|
|
|
Post by doxidad on Aug 13, 2018 12:18:24 GMT -8
Ok Thanks- Appreciate the reply.
|
|
|
Post by doxidad on Aug 13, 2018 8:56:37 GMT -8
It looks like the I/O isn't thread safe - where I/O = any one of the modules that does I/O or a sensor. If one thread is using the I/O and another tries to do the same thing it get stepped on. Since the thing everyone wants to use is the I/O and there is ONE hardware bus, there should be one entrance into the routines that use it so it can be blocked for use by others until the I/O is complete and released when the current I/O is completed. The bus multiplexer code seems to be a spot that all I/O goes through and might be a good place to do this.
Am I stating this correctly or am I wrong on my assumptions?
TR
|
|
|
Post by doxidad on Aug 11, 2018 6:21:31 GMT -8
Are there any plans for making the I/O in GroveWeatherPi thread safe?
|
|
|
Post by doxidad on Jun 19, 2018 15:39:11 GMT -8
Ok - This is still happening. Here's the first part of the log that shows what devices I have. >>>>>>>>>>>>>>>>>>>>>>>>
GroveWeatherPi Solar Powered Weather Station Version 3.02 - SwitchDoc Labs
Program Started at:2018-06-19 17:27:33
---------------------- I2C Mux - TCA9545: Present BMP280: Present DS3231: Present HDC1080: Present HTU21DF: Not Present AM2315: Present ADS1015: Not Present ADS1115: Present AS3935: Present OLED: Present SunAirPlus: Present Sunlight Sensor: Not Present WXLink: Not Present
UseMySQL: Present Check WLAN: Present WeatherUnderground: Not Present
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< A section showing the error >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
----------------- Local WeatherRack Weather Sensors Sampling ----------------- Rain Total= 0.00 in Rain Last 60 Minutes= 0.00 in Wind Speed= 0.00 MPH MPH wind_gust= 0.00 MPH ------Patting The Dog------- Wind Direction= 0.00 Degrees Wind Direction Voltage= 3.859 V ----------------- ----------------- DS3231 Real Time Clock ----------------- Raspberry Pi= 2018-06-19 17:32:26 DS3231= 2018-06-19 17:32:26 DS3231 Temperature= 26.25 C ----------------- ----------------- BMP280 Barometer ----------------- Temperature = 26.04 C Pressure = 98.23 KPa Altitude = 260.66 m Sealevel Pressure = 101.87 KPa ----------------- ----------------- Sunlight Vi/IR/UV Sensor Not Present ----------------- ----------------- HDC1080 Temp/Hum ----------------- Temperature = 26.00 C Humidity = 46.27 % ----------------- HTU21DF Temp/Hum Not Present ----------------- ----------------- ----------------- AS3935 Lightning Detector ----------------- Last result from AS3935: ----No Lightning detected--- Lightning Count = 0 ----------------- ----------------- AM2315 Temperature/Humidity Sensor ----------------- outsideTemperature: 25.5 C outsideHumidity: 39.8 % crc: 1 ----------------- ----------------- ----------------- ----------------- SunAirPlus Currents / Voltage ----------------- LIPO_Battery Bus Voltage: 4.19 V LIPO_Battery Shunt Voltage: 0.00 mV LIPO_Battery Load Voltage: 4.19 V LIPO_Battery Current 1: 0.00 mA Battery Power 1: 0.00 W
Solar Cell Bus Voltage 2: 0.78 V Solar Cell Shunt Voltage 2: 0.00 mV Solar Cell Load Voltage 2: 0.78 V Solar Cell Current 2: -0.00 mA Solar Cell Power 2: -0.00 W
Output Bus Voltage 3: 5.13 V Output Shunt Voltage 3: 20.24 mV Output Load Voltage 3: 5.13 V Output Current 3: 202.40 mA Output Power 3: 1.04 W
------------------------------ Tick! The time is: 2018-06-19 17:32:35.888277 ----------------- Local WeatherRack Weather Sensors Sampling ----------------- Rain Total= 0.00 in Rain Last 60 Minutes= 0.00 in Wind Speed= 0.00 MPH MPH wind_gust= 0.00 MPH ------Patting The Dog------- Wind Direction= 0.00 Degrees Wind Direction Voltage= 3.859 V ----------------- SunAirPlus Sampling ----------------- trying database trying database before query query=INSERT INTO WeatherData(TimeStamp,as3935LightningCount, as3935LastInterrupt, as3935LastDistance, as3935LastStatus, currentWindSpeed, currentWindGust, totalRain, bmp180Temperature, bmp180Pressure, bmp180Altitude, bmp180SeaLevel, outsideTemperature, outsideHumidity, currentWindDirection, currentWindDirectionVoltage, insideTemperature, insideHumidity) VALUES(UTC_TIMESTAMP(), 0.000, 0.000, 0.000, "", 0.000, 0.001, 0.000, 0, 0.000, 0.000, 0.000, 25.500, 39.800, 0.000, 0.000, 25.999, 46.274) rain in past 60 minute= 0.0 before query query=INSERT INTO PowerSystem(TimeStamp, batteryVoltage, batteryCurrent, solarVoltage, solarCurrent, loadVoltage, loadCurrent, batteryPower, solarPower, loadPower, batteryCharge) VALUES (UTC_TIMESTAMP (), 4.192, 0.000, 0.800, -0.000, 5.128, 186.000, 0.000, -0.000, 0.954, 100.000) [Errno 121] Remote I/O error 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 "/home/pi/SDL_Pi_GroveWeatherPi/GroveWeatherPi.py", line 1221, in sampleAndDisplay Scroll_SSD1306.addLineOLED(display, ("Wind Speed=\t%0.2f MPH")%(currentWindSpeed/1.6)) File "/home/pi/SDL_Pi_GroveWeatherPi/Scroll_SSD1306.py", line 65, in addLineOLED display.display() File "./Adafruit_Python_SSD1306/Adafruit_SSD1306/SSD1306.py", line 164, in display self.command(SSD1306_COLUMNADDR) File "./Adafruit_Python_SSD1306/Adafruit_SSD1306/SSD1306.py", line 128, in command self._i2c.write8(control, c) File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 114, in write8 self._bus.write_byte_data(self._address, register, value) File "build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py", line 236, in write_byte_data self._device.write(data)
----------------- Weather Sampling ----------------- ----------------- [Errno 121] Remote I/O error 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 "/home/pi/SDL_Pi_GroveWeatherPi/GroveWeatherPi.py", line 1093, in sampleSunAirPlus shuntvoltage1 = sunAirPlus.getShuntVoltage_mV(LIPO_BATTERY_CHANNEL) File "./SDL_Pi_INA3221/SDL_Pi_INA3221.py", line 156, in getShuntVoltage_mV value = self._getShuntVoltage_raw(channel) File "./SDL_Pi_INA3221/SDL_Pi_INA3221.py", line 139, in _getShuntVoltage_raw value = self._read_register_little_endian(INA3221_REG_SHUNTVOLTAGE_1+(channel -1) *2) File "./SDL_Pi_INA3221/SDL_Pi_INA3221.py", line 108, in _read_register_little_endian result = self._bus.read_word_data(self._addr,register) & 0xFFFF
----------------- Local WeatherRack Weather Sensors Sampling ----------------- Rain Total= 0.00 in Rain Last 60 Minutes= 0.00 in Wind Speed= 0.00 MPH MPH wind_gust= 0.00 MPH Wind Direction= 0.00 Degrees ------Patting The Dog------- Wind Direction Voltage= 3.857 V -----------------
|
|
|
Post by doxidad on Jun 9, 2018 4:44:19 GMT -8
With V3.01 I still have the threading problem:
SunAirPlus Currents / Voltage ----------------- [Errno 121] Remote I/O error 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 "/home/pi/SDL_Pi_GroveWeatherPi/GroveWeatherPi.py", line 1399, in sampleAndDisplay shuntvoltage1 = sunAirPlus.getShuntVoltage_mV(LIPO_BATTERY_CHANNEL) File "./SDL_Pi_INA3221/SDL_Pi_INA3221.py", line 156, in getShuntVoltage_mV value = self._getShuntVoltage_raw(channel) File "./SDL_Pi_INA3221/SDL_Pi_INA3221.py", line 139, in _getShuntVoltage_raw value = self._read_register_little_endian(INA3221_REG_SHUNTVOLTAGE_1+(channel -1) *2) File "./SDL_Pi_INA3221/SDL_Pi_INA3221.py", line 108, in _read_register_little_endian result = self._bus.read_word_data(self._addr,register) & 0xFFFF
|
|
|
Post by doxidad on May 22, 2018 8:44:39 GMT -8
A little story. In the mid 90's I was an owner/partner in an ISP. Our website used wunderground, which at that time was part of the University of Michigan. We used their servers for local weather and had a whole bunch of perl scripts that displayed the local weather in icons (long before the big guys did). Our subscribers loved it because you could customize it by entering a weather station ID to get its weather data dipslayed. Well, one day I got a email from them saying "you can't do this anymore unless you want to pay for it" - and it was big bucks for a little ISP. I suppose this is when they spun themselves out of the university into a business. I've never dealt with them again directly but nothing surprises me anymore especially as small fry get eaten up by the bigger guys.
|
|
|
Post by doxidad on Apr 29, 2018 4:59:18 GMT -8
GroveWeatherPi - How about the problem with thread synchronization? Will that be worked on or is it considered part of #1? Thanks!
|
|
|
Post by doxidad on Apr 1, 2018 11:17:51 GMT -8
Did you install mysqlDB python?
sudo apt-get install python-mysqldb
|
|
|
Post by doxidad on Mar 31, 2018 5:43:27 GMT -8
I can see 2 things. You are starting with sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
You are trying to stop it with a script sudo /etc/init.d/mysql stop which may not work since you started mysql with a command to run in the background "&". You have executed with username "pi" as opposed to having the system start it. This _could_ be the cause of you not being able to stop it. Can you stop it when you start it this way sudo /etc/init.d/mysql start?
2ndly - You are running the script against the database GroiveWeatherPi. Did you create the database first. The script just creates the tables. The database has be created before the script will run. When you log into mysql show the databases. Example:
pi@wpi ~ $ sudo mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 36 Server version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | GroveWeatherPi | | information_schema | | mysql | | performance_schema | | phpmyadmin | +--------------------+ 5 rows in set (0.00 sec)
See if the database GroveWeatherPi exists. If not create it like this:
MariaDB [(none)]> create database testdatabase; Query OK, 1 row affected (0.00 sec)
I used the database testdatabase since I already have a GroveWeatherPi database. showing the databases again will prove that it was created.
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | GroveWeatherPi | | information_schema | | mysql | | performance_schema | | phpmyadmin | | testdatabase | +--------------------+
I hope this helps a bit.
|
|