kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.95k stars 494 forks source link

Atlas PH Calibrate does not work #686

Closed grux77 closed 4 years ago

grux77 commented 5 years ago

Hello! I'm trying to run Atlas PH with Mycodo 7.7.1 on the Pi 3 B with Buster, but can not calibrate the probe. Right in the first step I get "Error: Calibration: temperature (25.00 C): Default message" Seems to be a problem with the code. See Demon Log:

2019-09-12 16:22:12,447 - DEBUG - mycodo.inputs.atlas_ph_ac3a6aa3 - pH sensor set to calibrate temperature 2019-09-12 16:22:12,501 - ERROR - mycodo.inputs.atlas_ph_ac3a6aa3 - InputModule raised an exception when taking a reading: 'str' object has no attribute 'unit' Traceback (most recent call last): File "/var/mycodo-root/mycodo/inputs/base_input.py", line 122, in read self._measurements = self.get_measurement() File "/home/pi/Mycodo/mycodo/inputs/atlas_ph.py", line 161, in get_measurement measurement.unit, AttributeError: 'str' object has no attribute 'unit'

2nd problem: When I activate 'Calibration Measurement' in the Setup/Data/Input I get 'No Data' in Data/Live. Is this wanted?

Sorry for english is not mine but from Google-translator

kizniche commented 5 years ago

It's difficult for me to test any fixes I make because I do not own this sensor. I am willing to make changes to the code if you are willing to test them. I will try to fix this error you pasted from the log.

kizniche commented 5 years ago

I just pushed a fix that should fix that error. This code has not been released yet, but you can upgrade to master to start using it now.

grux77 commented 5 years ago

Many thanks for your effort! Now I get no readings anymore and I can not calibrate either. Log now when Calibration Measurement is on : 2019-09-12 18:59:59,911 - DEBUG - mycodo.inputs.atlas_ph_ac3a6aa3 - Calibration returned: 1, Default message 2019-09-12 19:00:01,419 - ERROR - mycodo.inputs.atlas_ph_ac3a6aa3 - InputModule raised an exception when taking a reading: could not convert string to float: '?I,pH,2.13' Traceback (most recent call last): File "/var/mycodo-root/mycodo/inputs/base_input.py", line 122, in read self._measurements = self.get_measurement() File "/home/pi/Mycodo/mycodo/inputs/atlas_ph.py", line 271, in get_measurement ph = float(ph_str) ValueError: could not convert string to float: '?I,pH,2.13' 2019-09-12 19:00:02,826 - DEBUG - mycodo.inputs.atlas_ph_ac3a6aa3 - pH sensor set to calibrate temperature 2019-09-12 19:00:02,902 - DEBUG - mycodo.inputs.atlas_ph_ac3a6aa3 - Latest temperature used to calibrate: 7.565 2019-09-12 19:00:03,409 - ERROR - mycodo.atlas_scientific - Unable to retrieve device info (this indicates the device was not properly initialized or connected) 2019-09-12 19:00:03,910 - DEBUG - mycodo.inputs.atlas_ph_ac3a6aa3 - Calibration returned: 1, Default message 2019-09-12 19:00:05,436 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.566, 'timestamp_utc': None}} 2019-09-12 19:00:06,845 - DEBUG - mycodo.inputs.atlas_ph_ac3a6aa3 - pH sensor set to calibrate temperature 2019-09-12 19:00:06,922 - DEBUG - mycodo.inputs.atlas_ph_ac3a6aa3 - Latest temperature used to calibrate: 7.566 2019-09-12 19:00:07,429 - ERROR - mycodo.atlas_scientific - Unable to retrieve device info (this indicates the device was not properly initialized or connected) 2019-09-12 19:00:07,931 - DEBUG - mycodo.inputs.atlas_ph_ac3a6aa3 - Calibration returned: 1, Default message 2019-09-12 19:00:09,457 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.567, 'timestamp_utc': None}} 2019-09-12 19:00:10,866 - DEBUG - mycodo.inputs.atlas_ph_ac3a6aa3 - pH sensor set to calibrate temperature 2019-09-12 19:00:10,944 - DEBUG - mycodo.inputs.atlas_ph_ac3a6aa3 - Latest temperature used to calibrate: 7.567

And so when Calibration Measurement is disabled: 2019-09-12 19:11:42,075 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.571, 'timestamp_utc': None}} 2019-09-12 19:11:46,110 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.57, 'timestamp_utc': None}} 2019-09-12 19:11:50,149 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.57, 'timestamp_utc': None}} 2019-09-12 19:11:54,085 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.571, 'timestamp_utc': None}} 2019-09-12 19:11:58,120 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.568, 'timestamp_utc': None}} 2019-09-12 19:12:02,056 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.57, 'timestamp_utc': None}} 2019-09-12 19:12:06,091 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.57, 'timestamp_utc': None}} 2019-09-12 19:12:10,127 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.569, 'timestamp_utc': None}} 2019-09-12 19:12:14,065 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.567, 'timestamp_utc': None}} 2019-09-12 19:12:18,101 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.568, 'timestamp_utc': None}} 2019-09-12 19:12:22,138 - DEBUG - mycodo.controllers.controller_input_ac3a6aa3 - Adding measurements to InfluxDB with ID ac3a6aa3-ecad-46c1-a23d-dba8223d1e66: {0: {'measurement': 'ion_concentration', 'unit': 'pH', 'value': 7.57, 'timestamp_utc': None}}

And I do not get any readings in live

kizniche commented 5 years ago

It looks like it's storing measurements properly. Can you provide SSH access and HTTP web UI access to figure out what's wrong?

kizniche commented 5 years ago

Can you verify under Configure -> Measurement that you have "ion_concentration" as a measurement and "pH" as a unit?

grux77 commented 5 years ago

I sent you a message on https://kylegabriel.com/contact/ with remote data

kizniche commented 5 years ago

I logged in and there are measurements, so it looks like the input is working. I'll check out the calibration section.

kizniche commented 5 years ago

I was able to fix all the issues with the calibration system, and it's now working on your Pi. Go ahead and clear the calibration then go through all the steps with the 4, 7, and 10 pH solutions and see if it's then accurate by placing it back into each solution. I'll push the changes I made soon. Keep in mind all the edits are already on your Pi, so you don't need to do any upgrading at the moment.

kizniche commented 5 years ago

I have the Input currently deactivated. I can't guarantee the calibration procedure will work properly if it's done while the Input is activated. Therefore, deactivate it while calibrating, then reactivate it afterward.

grux77 commented 5 years ago

Yes, if I disable it then the calibration works without errors. Would it be possible to skip Ph10 point during calibration? I have only Ph4 and Ph7 here. For freshwater aquarium also a 2-point calibration is sufficient. I'll leave the board for a week (or even longer) for them, if they want to try something further. I think your software is awesome and I like to make my Atlas Ph available

Am Sa., 14. Sept. 2019 um 02:22 Uhr schrieb Kyle Gabriel < notifications@github.com>:

I have the Input currently deactivated. I can't guarantee the calibration procedure will work properly if it's done while the Input is activated. Therefore, deactivate it while calibrating, then reactivate it afterward.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kizniche/Mycodo/issues/686?email_source=notifications&email_token=ANFPYFTMWJV5BXXN4MKDDVLQJQVEZA5CNFSM4IWFWSO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6WPIKI#issuecomment-531428393, or mute the thread https://github.com/notifications/unsubscribe-auth/ANFPYFVDCN4TSORD6Z7NAYDQJQVEZANCNFSM4IWFWSOQ .

kizniche commented 5 years ago

You're right, there should be the option of what type of calibration you want to perform. I'll see about adding that feature, as well as automatically deactivating the Input at the start of calibration.

kizniche commented 5 years ago

I just added the ability to perform a 1, 2, or 3 point pH calibration (with any combination of the 4.0, 7.0 or 10.0 pH solutions one may have). I successfully tested on your system to work. You will want to clear the calibration, then go through the calibration steps to get your sensor calibrated. Let me know if you come across any issues.

grux77 commented 5 years ago

This looks very good! I will test it out soon. Thanks for the very fast work!

grux77 commented 5 years ago

Yes, the calibration works wonderfully. A trifle might change in the next release. I would increase the time for each calibration solution to at least 60 sec. So that the probe can adjust. Now it's only 6 sec. you can of course wait in advance if you know it. Maybe a note text is enough. ph7_time_red

Overall, it is well done. Respect!

kizniche commented 5 years ago

It's supposed to be 120 seconds. I never changed it back from 5 while I was testing. I'll change it for the next release. Thanks for testing.