From 5d0f02eb18c93237a8ba54edda25096160c57cf7 Mon Sep 17 00:00:00 2001 From: Magnus Persson Date: Sun, 30 Jan 2022 11:50:09 +0100 Subject: [PATCH] Update docs --- src/calc.cpp | 6 ++-- src/gyro.cpp | 4 +-- src/main.cpp | 4 +-- src/pushtarget.cpp | 4 +-- src/templating.cpp | 2 +- src_docs/source/data.rst | 2 +- src_docs/source/index.rst | 3 +- src_docs/source/releases.rst | 2 ++ src_docs/source/services.rst | 38 +++++++++++++++++++++++ src_docs/source/troubleshooting.rst | 48 +++++++++++++++++++++++++++++ 10 files changed, 101 insertions(+), 12 deletions(-) create mode 100644 src_docs/source/troubleshooting.rst diff --git a/src/calc.cpp b/src/calc.cpp index 980fd8a..6c965e2 100644 --- a/src/calc.cpp +++ b/src/calc.cpp @@ -103,7 +103,7 @@ int createFormula(RawFormulaData &fd, char *formulaBuffer, } if (!valid) { - myLastErrors.addEntry(F("CALC: Deviation to large, formula rejected.")); + myLastErrors.addEntry(F("CALC: Error validating created formula. Deviation to large, formula rejected.")); return ERR_FORMULA_UNABLETOFFIND; } @@ -157,7 +157,7 @@ double calculateGravity(double angle, double temp, const char *tempFormula) { return g; } - myLastErrors.addEntry("CALC: Failed to parse expression " + String(err)); + myLastErrors.addEntry("CALC: Failed to parse gravity expression " + String(err)); return 0; } @@ -204,7 +204,7 @@ double gravityTemperatureCorrectionC(double gravity, double tempC, } myLastErrors.addEntry( - "CALC: Failed to parse expression for gravity correction " + String(err)); + "CALC: Failed to parse expression for gravity temperature correction " + String(err)); return gravity; } diff --git a/src/gyro.cpp b/src/gyro.cpp index 97702b7..a6f8155 100644 --- a/src/gyro.cpp +++ b/src/gyro.cpp @@ -44,7 +44,7 @@ bool GyroSensor::setup() { // compilation difficulties if (!accelgyro.testConnection()) { - myLastErrors.addEntry(F("GYRO: Failed to connect to gyro")); + myLastErrors.addEntry(F("GYRO: Failed to connect to gyro, is it connected?")); _sensorConnected = false; } else { #if !defined(GYRO_DISABLE_LOGGING) @@ -286,7 +286,7 @@ void GyroSensor::applyCalibration() { if ((_calibrationOffset.ax + _calibrationOffset.ay + _calibrationOffset.az + _calibrationOffset.gx + _calibrationOffset.gy + _calibrationOffset.gz) == 0) { - myLastErrors.addEntry(F("GYRO: No valid calibration values, aborting")); + myLastErrors.addEntry(F("GYRO: No valid calibration values, please calibrate the device.")); return; } diff --git a/src/main.cpp b/src/main.cpp index 2ca49b3..be4fb62 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -173,7 +173,7 @@ void setup() { LOG_PERF_STOP("main-temp-setup"); if (!myGyro.setup()) { - myLastErrors.addEntry(F("MAIN: Failed to initialize the gyro")); + myLastErrors.addEntry(F("MAIN: Failed to initialize the gyro, is it connected?")); } else { LOG_PERF_START("main-gyro-read"); myGyro.read(); @@ -252,7 +252,7 @@ bool loopReadGravity() { LOG_PERF_STOP("loop-push"); return true; } else { - myLastErrors.addEntry(F("MAIN: No gyro value")); + Log.error(F("MAIN: No gyro value found, the device might be moving.")); } return false; } diff --git a/src/pushtarget.cpp b/src/pushtarget.cpp index 8c78ce5..1b0c4aa 100644 --- a/src/pushtarget.cpp +++ b/src/pushtarget.cpp @@ -55,7 +55,7 @@ void PushTarget::send(float angle, float gravitySG, float corrGravitySG, #if defined(ESP8266) if (ESP.getFreeContStack() < 1500) { if (!_memErrorReported) { - myLastErrors.addEntry(F("PUSH: Low on memory, skipping push ") + + myLastErrors.addEntry("PUSH: Low on memory, skipping push " + String(ESP.getFreeContStack())); } else { Log.error(F("PUSH: Low on memory, skipping push %d" CR), @@ -193,7 +193,7 @@ void PushTarget::addHttpHeader(HTTPClient& http, String header) { value.c_str()); http.addHeader(name, value); } else { - myLastErrors.addEntry("PUSH: Invalid http header " + header); + myLastErrors.addEntry("PUSH: Unable to set header, invalid value " + header); } } diff --git a/src/templating.cpp b/src/templating.cpp index 7ee778a..9360cac 100644 --- a/src/templating.cpp +++ b/src/templating.cpp @@ -33,7 +33,7 @@ SOFTWARE. // Use iSpindle format for compatibility const char iSpindleFormat[] PROGMEM = "{" - "\"name\" : \"gravmon\", " + "\"name\" : \"${mdns}\", " "\"ID\": \"${id}\", " "\"token\" : \"gravmon\", " "\"interval\": ${sleep-interval}, " diff --git a/src_docs/source/data.rst b/src_docs/source/data.rst index 869f496..d16d875 100644 --- a/src_docs/source/data.rst +++ b/src_docs/source/data.rst @@ -38,7 +38,7 @@ This is the format template used to create the json above. .. code-block:: { - "name" : "gravmon", + "name" : "${mdns}", "ID": "${id}", "token" : "gravmon", "interval": ${sleep-interval}, diff --git a/src_docs/source/index.rst b/src_docs/source/index.rst index 14c8b63..cea20da 100644 --- a/src_docs/source/index.rst +++ b/src_docs/source/index.rst @@ -7,7 +7,7 @@ Welcome to GravityMon's documentation! ###################################### .. note:: - This documentation reflects **v0.7**. Last updated 2022-01-23 + This documentation reflects **v0.8**. Last updated 2022-01-28 GravityMon is a replacement firmare for the iSpindle firmware, it uses the same hardware configuration so @@ -132,6 +132,7 @@ the following libraries and without these this would have been much more difficu data compiling contributing + troubleshooting q_and_a Indices and tables diff --git a/src_docs/source/releases.rst b/src_docs/source/releases.rst index 311350d..30f0170 100644 --- a/src_docs/source/releases.rst +++ b/src_docs/source/releases.rst @@ -11,12 +11,14 @@ v0.8.0 * Added instructions for how to configure integration with Fermentrack * Added instructions for how to configure integration with Ubidots * Added instructions for how to configure integration with HomeAssistant +* Added instructions for how to configure integration with Brewers Friend (not verified) v0.7.1 ------ * Defined mqtt port was ignored, used default values. * Extended length of HTTP url fields from 100 to 120 chars. +* Fixed issue with default template so it now includes the device name correctly. v0.7.0 ------ diff --git a/src_docs/source/services.rst b/src_docs/source/services.rst index 7ce6aac..f1e6194 100644 --- a/src_docs/source/services.rst +++ b/src_docs/source/services.rst @@ -8,6 +8,8 @@ This chapter contains a list of targets and what configuration is needed to inte Brewfather ++++++++++ +Brewfather is an all in one service that allows you to manage you recepies and brews. + Just enter the http adress found on brewfather, not other settings are needed. The endpoint has the following format: .. code-block:: @@ -117,3 +119,39 @@ many sensors / topics as you want. gravmon/${mdns}/temp_units:${temp-unit}| +Brewer's Friend ++++++++++++++++ + +Brewer's friend is an all in one service that allows you to manage you recepies and brews. + +.. warning:: + I dont have an account for brewers friend so I have not been able to verfy this completely. Its based on + the available documentation. + +You can find you API key when logged in to the service. Follow these `instructions `_ + +**Note there are different URLs if you are using plato or specific gravity!** + +.. code-block:: + + http://log.brewersfriend.com/ispindel/[API KEY] + http://log.brewersfriend.com/ispindel_sg/[API KEY] + + +From what I can read in the documentation you need to add the API key as a token as well. This can be done using a custom +format for the endpoint. Just add you API key after token. + +.. code-block:: + + { + "name" : "${mdns}", + "ID": "${id}", + "token" : "[API KEY]", + "interval": ${sleep-interval}, + "temperature": ${temp}, + "temp-units": "${temp-unit}", + "gravity": ${gravity}, + "angle": ${angle}, + "battery": ${battery}, + "rssi": ${rssi} + } diff --git a/src_docs/source/troubleshooting.rst b/src_docs/source/troubleshooting.rst new file mode 100644 index 0000000..b441e8c --- /dev/null +++ b/src_docs/source/troubleshooting.rst @@ -0,0 +1,48 @@ +.. _troubleshooting: + +Troubleshooting +############### + +Log errors +++++++++++ + +* Not enough values for deriving formula + + To create a formula its required to have at least 3 measurements. + +* Error validating created formula. Deviation to large, formula rejected + + The device will try to create formulas with different complexities. It will try to + validate the formula using the supplied values. If the differnce is more than 1.6 SG on any point + the formula will be rejected. Check the entered values if they seams to be resonable. + +* No valid calibration values, please calibrate the device. + + The gyro needs to be calibrated at 90 degress (flat). This is done on the configration page. + +* Low on memory, skipping push + + The arduino libraries sometimes leak memory, this only occurs when running in configuration mode. To avoid + crashes the device will skip pushing data if the memory drops to much. Network connections seams to be connected + to memory leaks. + +* Unable to set header, invalid value + + Check the format for your custom header. This means it has not a correct format. + +* Influxdb push failed response +* Brewfather push failed response +* HTTP push failed response + + All these errors are standard http error codes. This are the commone ones; + + * 400 - Bad request. Probably an issue with the post format. Check format in the format editor. + * 401 - Unathorized. The service needs an token or other means to authenticate the device. + * 403 - Forbidden. Could be an issue with token or URL. + * 404 - Not found. Probably a wrong URL. + +* MQTT push on failed error + + * -3 - Network failed connected + * -10 - Connection denied +