diff --git a/docs/_sources/advanced.rst.txt b/docs/_sources/advanced.rst.txt new file mode 100644 index 0000000..49028dc --- /dev/null +++ b/docs/_sources/advanced.rst.txt @@ -0,0 +1,92 @@ +Advanced Configuration +###################### + +.. _format-editor: + +Format editor ++++++++++++++ + +To reduce the need for adding custom endpoints for various services there is an built in format editor that allows the user to customize the format being sent to the push target. + +.. warning:: + + Since the format templates can be big this function can be quite slow on a small device such as the esp8266. + +.. image:: images/format.png + :width: 800 + :alt: Format editor + +You enter the format data in the text field and the test button will show an example on what the output would look like. If the data cannot be formatted in json it will just be displayed as a long string. +The save button will save the current formla and reload the data from the device. + +.. tip:: + + If you save a blank string the default template will be loaded. + +These are the format keys available for use in the format. + +.. list-table:: Directory structure + :widths: 30 50 20 + :header-rows: 1 + + * - key + - description + - example + * - ${mdns} + - Name of the device + - gravmon2 + * - ${id} + - Unique id of the device + - e422a3 + * - ${sleep-interval} + - Seconds between data is pushed + - 900 + * - ${temp} + - Temperature in format configured on device, one decimal + - 21.2 + * - ${temp-c} + - Temperature in C, one decimal + - 21.2 + * - ${temp-f} + - Temperature in F, one decimal + - 58.0 + * - ${temp-unit} + - Temperature format `C` or `F` + - C + * - ${battery} + - Battery voltage, two decimals + - 3.89 + * - ${rssi} + - Wifi signal strength + - -75 + * - ${run-time} + - How long the last measurement took, two decimals + - 3.87 + * - ${angle} + - Angle of the gyro, two decimals + - 28.67 + * - ${tilt} + - Same as angle. + - 28.67 + * - ${gravity} + - Calculated gravity, 4 decimals for SG and 1 for Plato. + - 1.0456 + * - ${gravity-sg} + - Calculated gravity in SG, 4 decimals + - 1.0456 + * - ${gravity-plato} + - Calculated gravity in Plato, 1 decimal + - 8.5 + * - ${corr-gravity} + - Temperature corrected gravity, 4 decimals for SG and 1 for Plato. + - 1.0456 + * - ${corr-gravity-sg} + - Temperature corrected gravity in SG, 4 decimals + - 1.0456 + * - ${corr-gravity-plato} + - Temperature corrected gravity in Plato, 1 decimal + - 8.5 + * - ${gravity-unit} + - Gravity format, `G` or `P` + - G + diff --git a/docs/_sources/api.rst.txt b/docs/_sources/api.rst.txt new file mode 100644 index 0000000..e066dd2 --- /dev/null +++ b/docs/_sources/api.rst.txt @@ -0,0 +1,322 @@ +.. _rest-api: + +REST API +######## + +All the API's use a key called ``ID`` which is the unique device id (chip id). This is used as an API key when sending requests to the device. + +GET: /api/config +================ + +Retrive the current configuation of the device via an HTTP GET command. Payload is in JSON format. + +* ``temp-format`` can be either ``C`` or ``F`` +* ``gravity-format`` is always ``G`` (plato is not yet supported) + +Other parameters are the same as in the configuration guide. + +.. code-block:: json + + { + "mdns": "gravmon", + "id": "ee1bfc", + "ota-url": "http://192.168.1.50:80/firmware/gravmon/", + "temp-format": "C", + "brewfather-push": "http://log.brewfather.net/stream?id=Qwerty", + "http-push": "http://192.168.1.50:9090/api/v1/Qwerty/telemetry", + "http-push-h1": "header: value", + "http-push-h2": "header: value", + "http-push2": "http://192.168.1.50/ispindel", + "http-push2-h1": "header: value", + "http-push2-h2": "header: value", + "influxdb2-push": "http://192.168.1.50:8086", + "influxdb2-org": "org", + "influxdb2-bucket": "bucket_id", + "influxdb2-auth": "token", + "mqtt-push": "192.168.1.50", + "mqtt-port": 1883, + "mqtt-user": "user", + "mqtt-pass": "pass", + "sleep-interval": 30, + "voltage-factor": 1.59, + "gravity-formula": "0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436", + "gravity-format": "G", + "temp-adjustment-value": 0, + "gravity-temp-adjustment": false, + "gyro-temp": true, + "gyro-calibration-data": { + "ax": -330, + "ay": -2249, + "az": 1170, + "gx": 99, + "gy": -6, + "gz": 4 + }, + "angle": 90.93, + "gravity": 1.105, + "battery": 0.04 + } + + +GET: /api/device +================ + +Retrive the current device settings via an HTTP GET command. Payload is in JSON format. + +.. code-block:: json + + { + "app-name": "GravityMon", + "app-ver": "0.0.0", + "id": "ee1bfc", + "mdns": "gravmon" + } + + +GET: /api/status +================ + +Retrive the current device status via an HTTP GET command. Payload is in JSON format. + +* ``temp-format`` can be either ``C`` or ``F`` + +Other parameters are the same as in the configuration guide. + +.. code-block:: json + + { + "id": "ee1bfc", + "angle": 89.86, + "gravity": 1.1052, + "gravity-tempcorr": 1.1031, + "temp-c": 0, + "temp-f": 32, + "battery": 0, + "temp-format": "C", + "sleep-mode": false, + "rssi": -56 + } + + +GET: /api/config/formula +======================== + +Retrive the data used for formula calculation data via an HTTP GET command. Payload is in JSON format. + +* ``a1``-``a4`` are the angles/tilt readings (up to 5 are currently supported) +* ``g1``-``g4`` are the corresponding gravity reaadings in SG or Plato depending on the device-format. + +.. code-block:: json + + { + "id": "ee1bfc", + "a1": 22.4, + "a2": 54.4, + "a3": 58, + "a4": 0, + "a5": 0, + "g1": 1.000, + "g2": 1.053, + "g3": 1.062, + "g4": 1, + "g5": 1, + "gravity-format": "G", + "gravity-formula": "0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436" + } + + +POST: /api/config/device +======================== + +Used to update device settings via an HTTP POST command. + +Payload should be in standard format used for posting a form. Such as as: `id=value&mdns=value` etc. Key value pairs are shown below. + +* ``temp-format`` can be either ``C`` (Celcius) or ``F`` (Farenheight) + +.. code-block:: + + id=ee1bfc + mdns=gravmon + temp-format=C + sleep-interval=30 + + +POST: /api/config/push +====================== + +Used to update push settings via an HTTP POST command. Payload is in JSON format. + +Payload should be in standard format used for posting a form. Such as as: `id=value&mdns=value` etc. Key value pairs are shown below. + +.. code-block:: + + id=ee1bfc + http-push=http://192.168.1.50/ispindel + http-push2= + http-push-h1= + http-push-h2= + http-push2-h1= + http-push2-h2= + brewfather-push= + influxdb2-push=http://192.168.1.50:8086 + influxdb2-org= + influxdb2-bucket= + influxdb2-auth= + mqtt-push=192.168.1.50 + mqtt-port=1883 + mqtt-user= + mqtt-pass= + + +POST: /api/config/gravity +========================= + +Used to update gravity settings via an HTTP POST command. Payload is in JSON format. + +* ``gravity-formula`` keywords ``temp`` and ``tilt`` are supported. +* ``gravity-format`` can be either ``G`` (SG) or ``P`` (PLATO) + +.. note:: + ``gravity-temp-adjustment`` is defined as "on" or "off" when posting since this is the output values + from a checkbox, when reading data it's sent as boolean (true,false). + +Payload should be in standard format used for posting a form. Such as as: `id=value&mdns=value` etc. Key value pairs are shown below. + +.. code-block:: + + id=ee1bfc + gravity-formula=0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436, + gravity-format=P + gravity-temp-adjustment=off + + +POST: /api/config/hardware +========================== + +Used to update hardware settings via an HTTP POST command. Payload is in JSON format. + +.. note:: + ``gyro-temp`` is defined as "on" or "off" when posting since this is the output values from a checkbox, when + reading data it's sent as boolean (true,false). + +Payload should be in standard format used for posting a form. Such as as: `id=value&mdns=value` etc. Key value pairs are shown below. + +.. code-block:: + + id=ee1bfc + voltage-factor=1.59 + temp-adjustment=0 + gyro-temp=off + ota-url=http://192.168.1.50/firmware/gravmon/ + + +POST: /api/config/formula +========================= + +Used to update formula calculation data via an HTTP POST command. Payload is in JSON format. + +* ``a1``-``a4`` are the angles/tilt readings (up to 5 are currently supported) +* ``g1``-``g4`` are the corresponding gravity reaadings (in SG) + +Payload should be in standard format used for posting a form. Such as as: `id=value&mdns=value` etc. Key value pairs are shown below. + +.. code-block:: + + id=ee1bfc + a1=22.4 + a2=54.4 + a3=58 + a4=0 + a5=0 + g1=1.000 + g2=1.053 + g3=1.062 + g4=1 + g5=1 + + +Calling the API's from Python +============================= + +Here is some example code for how to access the API's from a python script. Keys should always be +present or the API call will fail. + +The requests package converts the json to standard form post format. + +.. code-block:: python + + import requests + import json + + host = "192.168.1.1" # IP adress (or name) of the device to send these settings to + id = "ee1bfc" # Device ID (shown in serial console during startup or in UI) + + def set_config( url, json ): + headers = { "ContentType": "application/json" } + print( url ) + resp = requests.post( url, headers=headers, data=json ) + if resp.status_code != 200 : + print ( "Failed " ) + else : + print ( "Success " ) + + url = "http://" + host + "/api/config/device" + json = { "id": id, + "mdns": "gravmon", # Name of the device + "temp-format": "C", # Temperature format C or F + "sleep-interval": 30 # Sleep interval in seconds + } + set_config( url, json ) + + url = "http://" + host + "/api/config/push" + json = { "id": id, + "http-push": "http://192.168.1.1/ispindel", + "http-push2": "", + "http-push-h1": "", + "http-push-h2": "", + "http-push2-h1": "", + "http-push2-h2": "", + "brewfather-push": "", + "influxdb2-push": "", + "influxdb2-org": "", + "influxdb2-bucket": "", + "influxdb2-auth": "", + "mqtt-push": "192.168.1.50", + "mqtt-port": 1883, + "mqtt-user": "Qwerty", + "mqtt-pass": "Qwerty" + } + set_config( url, json ) + + url = "http://" + host + "/api/config/gravity" + json = { "id": id, + "gravity-formula": "", + "gravity-format": "P", + "gravity-temp-adjustment": "off" # Adjust gravity (on/off) + } + set_config( url, json ) + + url = "http://" + host + "/api/config/hardware" + json = { "id": id, + "voltage-factor": 1.59, # Default value for voltage calculation + "temp-adjustment": 0, # If temp sensor needs to be corrected + "gyro-temp": "on", # Use the temp sensor in the gyro instead (on/off) + "ota-url": "" # if the device should seach for a new update when active + } + set_config( url, json ) + + url = "http://" + host + "/api/formula" + json = { "id": id, + "a1": 22.4, + "a2": 54.4, + "a3": 58, + "a4": 0, + "a5": 0, + "g1": 1.000, + "g2": 1.053, + "g3": 1.062, + "g4": 1, + "g5": 1 + } + set_config( url, json ) diff --git a/docs/_sources/configuration.rst.txt b/docs/_sources/configuration.rst.txt index 5738188..c14d794 100644 --- a/docs/_sources/configuration.rst.txt +++ b/docs/_sources/configuration.rst.txt @@ -1,7 +1,7 @@ .. _setting-up-device: -Setting up device -################# +Configuration +############# The device can operate in two modes and must be in ``configuration mode`` in order for the web server to be active. @@ -48,11 +48,12 @@ URL: (http://gravmon.local/device) * **Device name:** - This is unique name of the device. + This is unique name of the device which is set in the configuration, also known as MDNS name. * **Device ID:** - This is unique identifier for the device (ESP8266 id), this is required when using the API as an API Key to safeguard against faulty requests. + This is unique identifier for the device (ESP8266 id), this is required when using the API as an API Key to safeguard + against faulty requests. This is the ESP8266 chip ID, so it should be unique. Configuration @@ -73,15 +74,19 @@ Device Setting * **Temperature format:** - Choose between Celsius and Farenheight + Choose between Celsius and Farenheight when displaying temperature. * **Interval:** - This defines how long the device should be sleeping between the readings when in `gravity monitoring` mode. You will also see the values in minutes/seconds to easier set the interval. 900s is a recommended interval. + This defines how long the device should be sleeping between the readings when in `gravity monitoring` mode. You will also see + the values in minutes/seconds to easier set the interval. 900s is a recommended interval. The sleep interval can + be set between 10 - 3600 seconds (60 minutes). .. note:: - The sleep interval can be set between 10 - 3600 seconds (60 minutes). + A low value such as 30s will give a lifespan of 1-2 weeks and 300s (5 min) would last for 3+ weeks. This assumes that + there is good wifi connection that takes less than 1s to reconnect. Poor wifi connection is the main reason for battery drain. + * **Calibration values:** @@ -166,16 +171,20 @@ Gravity Settings * **Gravity format:** - Gravity format can be eihter `SG` or `Plato`. The device will use SG Internally and convert to Plato when displaying data. + Gravity format can be eihter `SG` or `Plato`. The device will use SG Internally and convert to Plato when displaying or sending data. * **Gravity formula:** Gravity formula is compatible with standard iSpindle formulas so any existing calculation option can be used. You can also use the feature to create the formula by supplying the raw data. See :ref:`create-formula` + The gravity formula accepts to paramaters, **tilt** for the angle or **temp** for temperature (temperature inserted into the formula + will be in celsius). I would recommend to use the formula calculation feature instead since this is much easier. + * **Temperature correct gravity:** - Will apply a temperature calibration formula to the gravity as a second step. + Will apply a temperature calibration formula to the gravity as a second step after gravity has been calculated. It's also possible to + build this into the gravity formula. .. warning:: This formula assumes that the calibration has been done at 20°C / 68°F. @@ -213,7 +222,7 @@ Hardware Settings * **OTA URL:** - Should point to a URL where the .bin file + version.json file is located. + Should point to a URL where the firmware.bin file + version.json file are located. For the OTA to work, place the following files (version.json + firmware.bin) at the location that you pointed out in OTA URL. If the version number in the json file is newer than in the code the update will be done during startup. @@ -225,578 +234,5 @@ Hardware Settings .. code-block:: http://192.168.1.1/firmware/gravmon/ - -.. _format-editor: -Format editor -############# - -To reduce the need for adding custom endpoints for various services there is an built in format editor that allows the user to customize the format being sent to the push target. - -.. warning:: - - Since the format templates can be big this function can be quite slow on a small device such as the esp8266. - -.. image:: images/format.png - :width: 800 - :alt: Format editor - -You enter the format data in the text field and the test button will show an example on what the output would look like. If the data cannot be formatted in json it will just be displayed as a long string. -The save button will save the current formla and reload the data from the device. - -.. tip:: - - If you save a blank string the default template will be loaded. - -These are the format keys available for use in the format. - -.. list-table:: Directory structure - :widths: 30 50 20 - :header-rows: 1 - - * - key - - description - - example - * - ${mdns} - - Name of the device - - gravmon2 - * - ${id} - - Unique id of the device - - e422a3 - * - ${sleep-interval} - - Seconds between data is pushed - - 900 - * - ${temp} - - Temperature in format configured on device, one decimal - - 21.2 - * - ${temp-c} - - Temperature in C, one decimal - - 21.2 - * - ${temp-f} - - Temperature in F, one decimal - - 58.0 - * - ${temp-unit} - - Temperature format `C` or `F` - - C - * - ${battery} - - Battery voltage, two decimals - - 3.89 - * - ${rssi} - - Wifi signal strength - - -75 - * - ${run-time} - - How long the last measurement took, two decimals - - 3.87 - * - ${angle} - - Angle of the gyro, two decimals - - 28.67 - * - ${tilt} - - Same as angle. - - 28.67 - * - ${gravity} - - Calculated gravity, 4 decimals for SG and 1 for Plato. - - 1.0456 - * - ${gravity-sg} - - Calculated gravity in SG, 4 decimals - - 1.0456 - * - ${gravity-plato} - - Calculated gravity in Plato, 1 decimal - - 8.5 - * - ${corr-gravity} - - Temperature corrected gravity, 4 decimals for SG and 1 for Plato. - - 1.0456 - * - ${corr-gravity-sg} - - Temperature corrected gravity in SG, 4 decimals - - 1.0456 - * - ${corr-gravity-plato} - - Temperature corrected gravity in Plato, 1 decimal - - 8.5 - * - ${gravity-unit} - - Gravity format, `G` or `P` - - G - - -.. _create-formula: - -Create formula -############## - -.. image:: images/formula1.png - :width: 800 - :alt: Formula data - -Here you can enter up to 5 values (angles + gravity) that is then used to create the formula. Angles equal to zero will be regarded as empty even if there is a gravity reading. - -.. image:: images/formula2.png - :width: 800 - :alt: Formula graph - -Once the formula is created a graph over the entered values and a simulation of the formula will give you a nice overview on how the formula will work. - -.. _rest-api: - -REST API -######## - -All the API's use a key called ``ID`` which is the unique device id (chip id). This is used as an API key when sending requests to the device. - -GET: /api/config -================ - -Retrive the current configuation of the device via an HTTP GET command. Payload is in JSON format. - -* ``temp-format`` can be either ``C`` or ``F`` -* ``gravity-format`` is always ``G`` (plato is not yet supported) - -Other parameters are the same as in the configuration guide. - -.. code-block:: json - - { - "mdns": "gravmon", - "id": "ee1bfc", - "ota-url": "http://192.168.1.50:80/firmware/gravmon/", - "temp-format": "C", - "brewfather-push": "http://log.brewfather.net/stream?id=Qwerty", - "http-push": "http://192.168.1.50:9090/api/v1/Qwerty/telemetry", - "http-push2": "http://192.168.1.50/ispindel", - "influxdb2-push": "http://192.168.1.50:8086", - "influxdb2-org": "Qwerty", - "influxdb2-bucket": "Qwerty", - "influxdb2-auth": "Qwerty", - "mqtt-push": "192.168.1.50", - "mqtt-port": 1883, - "mqtt-user": "Qwerty", - "mqtt-pass": "Qwerty", - "sleep-interval": 30, - "voltage-factor": 1.59, - "gravity-formula": "0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436", - "gravity-format": "G", - "temp-adjustment-value": 0, - "gravity-temp-adjustment": false, - "gyro-temp": true, - "gyro-calibration-data": { - "ax": -330, - "ay": -2249, - "az": 1170, - "gx": 99, - "gy": -6, - "gz": 4 - }, - "angle": 90.93, - "gravity": 1.105, - "battery": 0.04 - } - - -GET: /api/device -================ - -Retrive the current device settings via an HTTP GET command. Payload is in JSON format. - -.. code-block:: json - - { - "app-name": "GravityMon ", - "app-ver": "0.0.0", - "id": "ee1bfc", - "mdns": "gravmon" - } - - -GET: /api/status -================ - -Retrive the current device status via an HTTP GET command. Payload is in JSON format. - -* ``temp-format`` can be either ``C`` or ``F`` - -Other parameters are the same as in the configuration guide. - -.. code-block:: json - - { - "id": "ee1bfc", - "angle": 89.86, - "gravity": 1.1052, - "gravity-tempcorr": 1.1031, - "temp-c": 0, - "temp-f": 32, - "battery": 0, - "temp-format": "C", - "sleep-mode": false, - "rssi": -56 - } - - -GET: /api/config/formula -======================== - -Retrive the data used for formula calculation data via an HTTP GET command. Payload is in JSON format. - -* ``a1``-``a4`` are the angles/tilt readings (up to 5 are currently supported) -* ``g1``-``g4`` are the corresponding gravity reaadings in SG or Plato depending on the device-format. - -.. code-block:: json - - { - "id": "ee1bfc", - "a1": 22.4, - "a2": 54.4, - "a3": 58, - "a4": 0, - "a5": 0, - "g1": 1.000, - "g2": 1.053, - "g3": 1.062, - "g4": 1, - "g5": 1, - "gravity-format": "G", - "gravity-formula": "0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436" - } - - -POST: /api/config/device -======================== - -Used to update device settings via an HTTP POST command. Payload is in JSON format. - -* ``temp-format`` can be either ``C`` (Celcius) or ``F`` (Farenheight) - -.. code-block:: json - - { - "id": "ee1bfc", - "mdns": "gravmon", - "temp-format": "C", - "sleep-interval": 30 - } - - -POST: /api/config/push -====================== - -Used to update push settings via an HTTP POST command. Payload is in JSON format. - -.. code-block:: json - - { - "id": "ee1bfc", - "http-push": "http://192.168.1.50/ispindel", - "http-push2": "", - "brewfather-push": "", - "influxdb2-push": "http://192.168.1.50:8086", - "influxdb2-org": "Qwerty", - "influxdb2-bucket": "Qwerty", - "influxdb2-auth": "Qwerty" - "mqtt-push": "192.168.1.50", - "mqtt-port": 1883, - "mqtt-user": "Qwerty", - "mqtt-pass": "Qwerty", - } - - -POST: /api/config/gravity -========================= - -Used to update gravity settings via an HTTP POST command. Payload is in JSON format. - -* ``gravity-formula`` keywords ``temp`` and ``tilt`` are supported. -* ``gravity-format`` can be either ``G`` (SG) or ``P`` (PLATO) - -.. note:: - ``gravity-temp-adjustment`` is defined as "on" or "off" when posting since this is the output values - from a checkbox, when reading data it's sent as boolean (true,false). - -.. code-block:: json - - { - "id": "ee1bfc", - "gravity-formula": "0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436", - "gravity-format": "P", - "gravity-temp-adjustment": "off" - } - - -POST: /api/config/hardware -========================== - -Used to update hardware settings via an HTTP POST command. Payload is in JSON format. - -.. note:: - ``gyro-temp`` is defined as "on" or "off" when posting since this is the output values from a checkbox, when - reading data it's sent as boolean (true,false). - -.. code-block:: json - - { - "id": "ee1bfc", - "voltage-factor": 1.59, - "temp-adjustment": 0, - "gyro-temp": "off", - "ota-url": "http://192.168.1.50/firmware/gravmon/" - } - - -POST: /api/config/formula -========================= - -Used to update formula calculation data via an HTTP POST command. Payload is in JSON format. - -* ``a1``-``a4`` are the angles/tilt readings (up to 5 are currently supported) -* ``g1``-``g4`` are the corresponding gravity reaadings (in SG) - -.. code-block:: json - - { - "id": "ee1bfc", - "a1": 22.4, - "a2": 54.4, - "a3": 58, - "a4": 0, - "a5": 0, - "g1": 1.000, - "g2": 1.053, - "g3": 1.062, - "g4": 1, - "g5": 1 - } - - -Calling the API's from Python -============================= - -Here is some example code for how to access the API's from a python script. Keys should always be -present or the API call will fail. - -.. code-block:: python - - import requests - import json - - host = "192.168.1.1" # IP adress (or name) of the device to send these settings to - id = "ee1bfc" # Device ID (shown in serial console during startup or in UI) - - def set_config( url, json ): - headers = { "ContentType": "application/json" } - print( url ) - resp = requests.post( url, headers=headers, data=json ) - if resp.status_code != 200 : - print ( "Failed " ) - else : - print ( "Success " ) - - url = "http://" + host + "/api/config/device" - json = { "id": id, - "mdns": "gravmon", # Name of the device - "temp-format": "C", # Temperature format C or F - "sleep-interval": 30 # Sleep interval in seconds - } - set_config( url, json ) - - url = "http://" + host + "/api/config/push" - json = { "id": id, - "http-push": "http://192.168.1.1/ispindel", - "http-push2": "", - "brewfather-push": "", - "influxdb2-push": "", - "influxdb2-org": "", - "influxdb2-bucket": "", - "influxdb2-auth": "", - "mqtt-push": "192.168.1.50", - "mqtt-port": 1883, - "mqtt-user": "Qwerty", - "mqtt-pass": "Qwerty" - } - set_config( url, json ) - - url = "http://" + host + "/api/config/gravity" - json = { "id": id, - "gravity-formula": "", - "gravity-format": "P", - "gravity-temp-adjustment": "off" # Adjust gravity (on/off) - } - set_config( url, json ) - - url = "http://" + host + "/api/config/hardware" - json = { "id": id, - "voltage-factor": 1.59, # Default value for voltage calculation - "temp-adjustment": 0, # If temp sensor needs to be corrected - "gyro-temp": "on", # Use the temp sensor in the gyro instead (on/off) - "ota-url": "" # if the device should seach for a new update when active - } - set_config( url, json ) - - url = "http://" + host + "/api/formula" - json = { "id": id, - "a1": 22.4, - "a2": 54.4, - "a3": 58, - "a4": 0, - "a5": 0, - "g1": 1.000, - "g2": 1.053, - "g3": 1.062, - "g4": 1, - "g5": 1 - } - set_config( url, json ) - - -.. _data-formats: - -Data Formats -############ - -.. _data-formats-ispindle: - -iSpindle format -=============== - -This is the format used for standard http posts. - -* ``corr-gravity`` is an extended parameter containing a temperature corrected gravity reading. -* ``gravity-format`` is an extended parameter containing the gravity format (G or P). -* ``run-time`` is an extended parameter containing the number of seconds the execution took. - -.. code-block:: json - - { - "name" : "gravmon", - "ID": "2E6753", - "token" : "gravmon", - "interval": 900, - "temperature": 20.5, - "temp-units": "C", - "gravity": 1.0050, - "angle": 45.34, - "battery": 3.67, - "rssi": -12, - - "corr-gravity": 1.0050, - "gravity-unit": "G", - "run-time": 6 - } - -This is the format template used to create the json above. - -.. code-block:: - - { - "name" : "gravmon", - "ID": "${id}", - "token" : "gravmon", - "interval": ${sleep-interval}, - "temperature": ${temp}, - "temp-units": "${temp-unit}", - "gravity": ${gravity}, - "angle": ${angle}, - "battery": ${battery}, - "rssi": ${rssi}, - "corr-gravity": ${corr-gravity}, - "gravity-unit": "${gravity-unit}", - "run-time": ${run-time} - } - - -.. _data-formats-brewfather: - -Brewfather format -================= - -This is the format for Brewfather. See: `Brewfather API docs `_ - -.. code-block:: json - - { - "name" : "gravmon", - "temp": 20.5, - "temp_unit": "C", - "battery": 3.67, - "gravity": 1.0050, - "gravity_unit": "G", - } - - -.. _data-formats-influxdb2: - -Influx DB v2 -============ - -This is the format for InfluxDB v2 - -.. code-block:: - - measurement,host=,device=,temp-format=,gravity-format=SG,gravity=1.0004,corr-gravity=1.0004,angle=45.45,temp=20.1,battery=3.96,rssi=-18 - - -This is the format template used to create the json above. - -.. code-block:: - - measurement,host=${mdns},device=${id},temp-format=${temp-unit},gravity-format=${gravity-unit} gravity=${gravity},corr-gravity=${corr-gravity},angle=${angle},temp=${temp},battery=${battery},rssi=${rssi} - - -.. _data-formats-mqtt: - -MQTT -==== - -This is the format used to send data to MQTT. Each of the lines are specific topics - -.. code-block:: - - ispindel/device_name/tilt 89.96796 - ispindel/device_name/temperature 21.375 - ispindel/device_name/temp_units C - ispindel/device_name/battery 0.04171 - ispindel/device_name/gravity 33.54894 - ispindel/device_name/interval 1 - ispindel/device_name/RSSI -58 - - -This is the format template used to create the json above. - -.. tip:: - - Each line in the format is treated as one topic. The `|` is used as separator between lines and the first `:` is used as separator between topic and value. Each line is formatted as `:` - -.. code-block:: - - ispindel/${mdns}/tilt:${angle}| - ispindel/${mdns}/temperature:${temp}| - ispindel/${mdns}/temp_units:${temp-unit}| - ispindel/${mdns}/battery:${battery}| - ispindel/${mdns}/gravity:${gravity}| - ispindel/${mdns}/interval:${sleep-interval}| - ispindel/${mdns}/RSSI:${rssi}| - -This is a format template that is compatible with v0.6. Just replace the `topic` with the topic you want to post data to. - -.. code-block:: - - topic:{"name":"gravmon","ID":"${id}","token":"gravmon","interval": ${sleep-interval},"temperature": ${temp},"temp-units": "${temp-unit}","gravity":${gravity},"angle": ${angle},"battery":${battery},"rssi": ${rssi},"corr-gravity":${corr-gravity},"gravity-unit": "${gravity-unit}","run-time": ${run-time}}| - - -version.json -============ - -Contents version.json. The version is used by the device to check if the this version is newer. The html files will also be downloaded if the are present on the server. This way it's easy to -upgrade to a version that serve the html files from the file system. If they dont exist nothing will happen, the OTA flashing will still work. If the html files are missing from the file system -they can be uploaded manually afterwards. - -.. code-block:: json - - { - "project":"gravmon", - "version":"0.7.0", - "html": [ - "index.min.htm", - "device.min.htm", - "config.min.htm", - "format.min.htm", - "calibration.min.htm", - "about.min.htm" - ] - } diff --git a/docs/_sources/data.rst.txt b/docs/_sources/data.rst.txt new file mode 100644 index 0000000..d16d875 --- /dev/null +++ b/docs/_sources/data.rst.txt @@ -0,0 +1,156 @@ +.. _data-formats: + +Data Formats +############ + +.. _data-formats-ispindle: + +iSpindle format +=============== + +This is the format used for standard http posts. + +* ``corr-gravity`` is an extended parameter containing a temperature corrected gravity reading. +* ``gravity-format`` is an extended parameter containing the gravity format (G or P). +* ``run-time`` is an extended parameter containing the number of seconds the execution took. + +.. code-block:: json + + { + "name" : "gravmon", + "ID": "2E6753", + "token" : "gravmon", + "interval": 900, + "temperature": 20.5, + "temp-units": "C", + "gravity": 1.0050, + "angle": 45.34, + "battery": 3.67, + "rssi": -12, + + "corr-gravity": 1.0050, + "gravity-unit": "G", + "run-time": 6 + } + +This is the format template used to create the json above. + +.. code-block:: + + { + "name" : "${mdns}", + "ID": "${id}", + "token" : "gravmon", + "interval": ${sleep-interval}, + "temperature": ${temp}, + "temp-units": "${temp-unit}", + "gravity": ${gravity}, + "angle": ${angle}, + "battery": ${battery}, + "rssi": ${rssi}, + "corr-gravity": ${corr-gravity}, + "gravity-unit": "${gravity-unit}", + "run-time": ${run-time} + } + + +.. _data-formats-brewfather: + +Brewfather format +================= + +This is the format for Brewfather. See: `Brewfather API docs `_ + +.. code-block:: json + + { + "name" : "gravmon", + "temp": 20.5, + "temp_unit": "C", + "battery": 3.67, + "gravity": 1.0050, + "gravity_unit": "G", + } + + +.. _data-formats-influxdb2: + +Influx DB v2 +============ + +This is the format for InfluxDB v2 + +.. code-block:: + + measurement,host=,device=,temp-format=,gravity-format=SG,gravity=1.0004,corr-gravity=1.0004,angle=45.45,temp=20.1,battery=3.96,rssi=-18 + + +This is the format template used to create the json above. + +.. code-block:: + + measurement,host=${mdns},device=${id},temp-format=${temp-unit},gravity-format=${gravity-unit} gravity=${gravity},corr-gravity=${corr-gravity},angle=${angle},temp=${temp},battery=${battery},rssi=${rssi} + + +.. _data-formats-mqtt: + +MQTT +==== + +This is the format used to send data to MQTT. Each of the lines are specific topics + +.. code-block:: + + ispindel/device_name/tilt 89.96796 + ispindel/device_name/temperature 21.375 + ispindel/device_name/temp_units C + ispindel/device_name/battery 0.04171 + ispindel/device_name/gravity 33.54894 + ispindel/device_name/interval 1 + ispindel/device_name/RSSI -58 + + +This is the format template used to create the json above. + +.. tip:: + + Each line in the format is treated as one topic. The `|` is used as separator between lines and the first `:` is used as separator between topic and value. Each line is formatted as `:` + +.. code-block:: + + ispindel/${mdns}/tilt:${angle}| + ispindel/${mdns}/temperature:${temp}| + ispindel/${mdns}/temp_units:${temp-unit}| + ispindel/${mdns}/battery:${battery}| + ispindel/${mdns}/gravity:${gravity}| + ispindel/${mdns}/interval:${sleep-interval}| + ispindel/${mdns}/RSSI:${rssi}| + +This is a format template that is compatible with v0.6. Just replace the `topic` with the topic you want to post data to. + +.. code-block:: + + topic:{"name":"gravmon","ID":"${id}","token":"gravmon","interval": ${sleep-interval},"temperature": ${temp},"temp-units": "${temp-unit}","gravity":${gravity},"angle": ${angle},"battery":${battery},"rssi": ${rssi},"corr-gravity":${corr-gravity},"gravity-unit": "${gravity-unit}","run-time": ${run-time}}| + + +version.json +============ + +Contents version.json. The version is used by the device to check if the this version is newer. The html files will also be downloaded if the are present on the server. This way it's easy to +upgrade to a version that serve the html files from the file system. If they dont exist nothing will happen, the OTA flashing will still work. If the html files are missing from the file system +they can be uploaded manually afterwards. + +.. code-block:: json + + { + "project":"gravmon", + "version":"0.7.0", + "html": [ + "index.min.htm", + "device.min.htm", + "config.min.htm", + "format.min.htm", + "calibration.min.htm", + "about.min.htm" + ] + } diff --git a/docs/_sources/formula.rst.txt b/docs/_sources/formula.rst.txt new file mode 100644 index 0000000..3c51780 --- /dev/null +++ b/docs/_sources/formula.rst.txt @@ -0,0 +1,16 @@ +.. _create-formula: + +Create formula +############## + +.. image:: images/formula1.png + :width: 800 + :alt: Formula data + +Here you can enter up to 5 values (angles + gravity) that is then used to create the formula. Angles equal to zero will be regarded as empty even if there is a gravity reading. + +.. image:: images/formula2.png + :width: 800 + :alt: Formula graph + +Once the formula is created a graph over the entered values and a simulation of the formula will give you a nice overview on how the formula will work. diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt index ac00540..eff9733 100644 --- a/docs/_sources/index.rst.txt +++ b/docs/_sources/index.rst.txt @@ -7,7 +7,7 @@ Welcome to GravityMon's documentation! ###################################### .. note:: - This documentation reflects **v0.7**. Last updated 2022-01-23 + This documentation reflects **v0.7.1**. Last updated 2022-01-30 GravityMon is a replacement firmare for the iSpindle firmware, it uses the same hardware configuration so @@ -125,10 +125,14 @@ the following libraries and without these this would have been much more difficu functionallity installation configuration + formula + services + advanced + api + data compiling contributing q_and_a - backlog Indices and tables ================== diff --git a/docs/_sources/releases.rst.txt b/docs/_sources/releases.rst.txt index 09620fb..fc89ec3 100644 --- a/docs/_sources/releases.rst.txt +++ b/docs/_sources/releases.rst.txt @@ -3,6 +3,17 @@ Releases ######## +v0.7.1 +------ + +* 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) +* BUG: Defined mqtt port was ignored, used default values. +* BUG: Extended length of HTTP url fields from 100 to 120 chars. +* BUG: Fixed issue with default template so it now includes the device name correctly. + v0.7.0 ------ diff --git a/docs/_sources/services.rst.txt b/docs/_sources/services.rst.txt new file mode 100644 index 0000000..2040980 --- /dev/null +++ b/docs/_sources/services.rst.txt @@ -0,0 +1,136 @@ +.. _services: + +Service Integration +################### + +This chapter contains a list of targets and what configuration is needed to interact with them. + +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:: + + http://log.brewfather.net/http://log.brewfather.net/stream?id= + + +The URL is found under settings. + +Fermentrack ++++++++++++ + +`Fermentrack `_ is a open source brewing software to monitor and control fermentation. + +GravityMon can be installed and used as an iSpindle. Just register the device as an iSpindle and use the defined endpoint which normally is: + +.. code-block:: + + http://myservername/ispindel + + +UBIdots ++++++++ + +`UBIdots `_ is a IoT service that display data collected various sources. + +For this service there are two options to configure the integration. First you will need your default token which is found under `API Credentials` ( in the example below). +Swap the text with the name you want to show in ubidots. + +**Option 1** - token as an URL parameter + +Enter the following as URL: + +.. code-block:: + + http://industrial.api.ubidots.com/api/v1.6/devices//?token= + + +Even though ubidots can handle the default ispindle format it probably better to just post the data you want. This is an example of a +format template that can be used. For information on customizing the format see :ref:`format-editor`. + +.. code-block:: + + { + "temperature": ${temp}, + "gravity": ${gravity}, + "angle": ${angle}, + "battery": ${battery}, + "rssi": ${rssi} + } + + +Home Assistant ++++++++++++++++ + +`HomeAssistant `_ is a platform for home automation and can collect sensor data +from multiple devices. + +This setup uses the MQTT integration with home assistant to collect values from the device. + +This part of the configuration goes into the home assistant configuration.yaml file. The example assumes that the +device is named `gravmon2` + +:: + + sensor: + - platform: mqtt + name: "gravmon2_gravity" + state_topic: "gravmon/gravmon2/gravity" + - platform: mqtt + name: "gravmon2_battery" + state_topic: "gravmon/gravmon2/battery" + - platform: mqtt + name: "gravmon2_rssi" + state_topic: "gravmon/gravmon2/rssi" + + +Enter the name of the MQTT server in Home Assistant in the URL. You might need to install that option +first. This is the format needed to submit the data to the correct topics as needed above. You can add as +many sensors / topics as you want. + +:: + + gravmon/${mdns}/tilt:${angle}| + gravmon/${mdns}/temperature:${temp}| + 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/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index 9bdd13b..bba8bff 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '0.7.0', + VERSION: '0.7.1', LANGUAGE: 'None', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/advanced.html b/docs/advanced.html new file mode 100644 index 0000000..022a4e7 --- /dev/null +++ b/docs/advanced.html @@ -0,0 +1,375 @@ + + + + + + + + Advanced Configuration - GravityMon 0.7.1 documentation + + + + + + + + + + + + + + Contents + + + + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark mode + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+
+
+ +
+ +
+
+
+

Advanced Configuration

+
+

Format editor

+

To reduce the need for adding custom endpoints for various services there is an built in format editor that allows the user to customize the format being sent to the push target.

+
+

Warning

+

Since the format templates can be big this function can be quite slow on a small device such as the esp8266.

+
+Format editor +

You enter the format data in the text field and the test button will show an example on what the output would look like. If the data cannot be formatted in json it will just be displayed as a long string. +The save button will save the current formla and reload the data from the device.

+
+

Tip

+

If you save a blank string the default template will be loaded.

+
+

These are the format keys available for use in the format.

+
+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Directory structure

key

description

example

${mdns}

Name of the device

gravmon2

${id}

Unique id of the device

e422a3

${sleep-interval}

Seconds between data is pushed

900

${temp}

Temperature in format configured on device, one decimal

21.2

${temp-c}

Temperature in C, one decimal

21.2

${temp-f}

Temperature in F, one decimal

58.0

${temp-unit}

Temperature format C or F

C

${battery}

Battery voltage, two decimals

3.89

${rssi}

Wifi signal strength

-75

${run-time}

How long the last measurement took, two decimals

3.87

${angle}

Angle of the gyro, two decimals

28.67

${tilt}

Same as angle.

28.67

${gravity}

Calculated gravity, 4 decimals for SG and 1 for Plato.

1.0456

${gravity-sg}

Calculated gravity in SG, 4 decimals

1.0456

${gravity-plato}

Calculated gravity in Plato, 1 decimal

8.5

${corr-gravity}

Temperature corrected gravity, 4 decimals for SG and 1 for Plato.

1.0456

${corr-gravity-sg}

Temperature corrected gravity in SG, 4 decimals

1.0456

${corr-gravity-plato}

Temperature corrected gravity in Plato, 1 decimal

8.5

${gravity-unit}

Gravity format, G or P

G

+
+
+ +
+
+ +
+ +
+
+ + + + + + \ No newline at end of file diff --git a/docs/api.html b/docs/api.html new file mode 100644 index 0000000..96a7f2d --- /dev/null +++ b/docs/api.html @@ -0,0 +1,564 @@ + + + + + + + + REST API - GravityMon 0.7.1 documentation + + + + + + + + + + + + + + Contents + + + + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark mode + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+
+
+ +
+ +
+
+
+

REST API

+

All the API’s use a key called ID which is the unique device id (chip id). This is used as an API key when sending requests to the device.

+
+

GET: /api/config

+

Retrive the current configuation of the device via an HTTP GET command. Payload is in JSON format.

+
    +
  • temp-format can be either C or F

  • +
  • gravity-format is always G (plato is not yet supported)

  • +
+

Other parameters are the same as in the configuration guide.

+
{
+   "mdns": "gravmon",
+   "id": "ee1bfc",
+   "ota-url": "http://192.168.1.50:80/firmware/gravmon/",
+   "temp-format": "C",
+   "brewfather-push": "http://log.brewfather.net/stream?id=Qwerty",
+   "http-push": "http://192.168.1.50:9090/api/v1/Qwerty/telemetry",
+   "http-push-h1": "header: value",
+   "http-push-h2": "header: value",
+   "http-push2": "http://192.168.1.50/ispindel",
+   "http-push2-h1": "header: value",
+   "http-push2-h2": "header: value",
+   "influxdb2-push": "http://192.168.1.50:8086",
+   "influxdb2-org": "org",
+   "influxdb2-bucket": "bucket_id",
+   "influxdb2-auth": "token",
+   "mqtt-push": "192.168.1.50",
+   "mqtt-port": 1883,
+   "mqtt-user": "user",
+   "mqtt-pass": "pass",
+   "sleep-interval": 30,
+   "voltage-factor": 1.59,
+   "gravity-formula": "0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436",
+   "gravity-format": "G",
+   "temp-adjustment-value": 0,
+   "gravity-temp-adjustment": false,
+   "gyro-temp": true,
+   "gyro-calibration-data": {
+      "ax": -330,
+      "ay": -2249,
+      "az": 1170,
+      "gx": 99,
+      "gy": -6,
+      "gz": 4
+   },
+   "angle": 90.93,
+   "gravity": 1.105,
+   "battery": 0.04
+}
+
+
+
+
+

GET: /api/device

+

Retrive the current device settings via an HTTP GET command. Payload is in JSON format.

+
{
+   "app-name": "GravityMon",
+   "app-ver": "0.0.0",
+   "id": "ee1bfc",
+   "mdns": "gravmon"
+}
+
+
+
+
+

GET: /api/status

+

Retrive the current device status via an HTTP GET command. Payload is in JSON format.

+
    +
  • temp-format can be either C or F

  • +
+

Other parameters are the same as in the configuration guide.

+
{
+   "id": "ee1bfc",
+   "angle": 89.86,
+   "gravity": 1.1052,
+   "gravity-tempcorr": 1.1031,
+   "temp-c": 0,
+   "temp-f": 32,
+   "battery": 0,
+   "temp-format": "C",
+   "sleep-mode": false,
+   "rssi": -56
+}
+
+
+
+
+

GET: /api/config/formula

+

Retrive the data used for formula calculation data via an HTTP GET command. Payload is in JSON format.

+
    +
  • a1-a4 are the angles/tilt readings (up to 5 are currently supported)

  • +
  • g1-g4 are the corresponding gravity reaadings in SG or Plato depending on the device-format.

  • +
+
{
+   "id": "ee1bfc",
+   "a1": 22.4,
+   "a2": 54.4,
+   "a3": 58,
+   "a4": 0,
+   "a5": 0,
+   "g1": 1.000,
+   "g2": 1.053,
+   "g3": 1.062,
+   "g4": 1,
+   "g5": 1,
+   "gravity-format": "G",
+   "gravity-formula": "0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436"
+}
+
+
+
+
+

POST: /api/config/device

+

Used to update device settings via an HTTP POST command.

+

Payload should be in standard format used for posting a form. Such as as: id=value&mdns=value etc. Key value pairs are shown below.

+
    +
  • temp-format can be either C (Celcius) or F (Farenheight)

  • +
+
id=ee1bfc
+mdns=gravmon
+temp-format=C
+sleep-interval=30
+
+
+
+
+

POST: /api/config/push

+

Used to update push settings via an HTTP POST command. Payload is in JSON format.

+

Payload should be in standard format used for posting a form. Such as as: id=value&mdns=value etc. Key value pairs are shown below.

+
id=ee1bfc
+http-push=http://192.168.1.50/ispindel
+http-push2=
+http-push-h1=
+http-push-h2=
+http-push2-h1=
+http-push2-h2=
+brewfather-push=
+influxdb2-push=http://192.168.1.50:8086
+influxdb2-org=
+influxdb2-bucket=
+influxdb2-auth=
+mqtt-push=192.168.1.50
+mqtt-port=1883
+mqtt-user=
+mqtt-pass=
+
+
+
+
+

POST: /api/config/gravity

+

Used to update gravity settings via an HTTP POST command. Payload is in JSON format.

+
    +
  • gravity-formula keywords temp and tilt are supported.

  • +
  • gravity-format can be either G (SG) or P (PLATO)

  • +
+
+

Note

+

gravity-temp-adjustment is defined as “on” or “off” when posting since this is the output values +from a checkbox, when reading data it’s sent as boolean (true,false).

+
+

Payload should be in standard format used for posting a form. Such as as: id=value&mdns=value etc. Key value pairs are shown below.

+
id=ee1bfc
+gravity-formula=0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436,
+gravity-format=P
+gravity-temp-adjustment=off
+
+
+
+
+

POST: /api/config/hardware

+

Used to update hardware settings via an HTTP POST command. Payload is in JSON format.

+
+

Note

+

gyro-temp is defined as “on” or “off” when posting since this is the output values from a checkbox, when +reading data it’s sent as boolean (true,false).

+
+

Payload should be in standard format used for posting a form. Such as as: id=value&mdns=value etc. Key value pairs are shown below.

+
id=ee1bfc
+voltage-factor=1.59
+temp-adjustment=0
+gyro-temp=off
+ota-url=http://192.168.1.50/firmware/gravmon/
+
+
+
+
+

POST: /api/config/formula

+

Used to update formula calculation data via an HTTP POST command. Payload is in JSON format.

+
    +
  • a1-a4 are the angles/tilt readings (up to 5 are currently supported)

  • +
  • g1-g4 are the corresponding gravity reaadings (in SG)

  • +
+

Payload should be in standard format used for posting a form. Such as as: id=value&mdns=value etc. Key value pairs are shown below.

+
id=ee1bfc
+a1=22.4
+a2=54.4
+a3=58
+a4=0
+a5=0
+g1=1.000
+g2=1.053
+g3=1.062
+g4=1
+g5=1
+
+
+
+
+

Calling the API’s from Python

+

Here is some example code for how to access the API’s from a python script. Keys should always be +present or the API call will fail.

+

The requests package converts the json to standard form post format.

+
import requests
+import json
+
+host = "192.168.1.1"           # IP adress (or name) of the device to send these settings to
+id = "ee1bfc"                  # Device ID (shown in serial console during startup or in UI)
+
+def set_config( url, json ):
+   headers = { "ContentType": "application/json" }
+   print( url )
+   resp = requests.post( url, headers=headers, data=json )
+   if resp.status_code != 200 :
+      print ( "Failed "  )
+   else :
+      print ( "Success "  )
+
+url = "http://" + host + "/api/config/device"
+json = { "id": id,
+         "mdns": "gravmon",             # Name of the device
+         "temp-format": "C",            # Temperature format C or F
+         "sleep-interval": 30           # Sleep interval in seconds
+      }
+set_config( url, json )
+
+url = "http://" + host + "/api/config/push"
+json = { "id": id,
+         "http-push": "http://192.168.1.1/ispindel",
+         "http-push2": "",
+         "http-push-h1": "",
+         "http-push-h2": "",
+         "http-push2-h1": "",
+         "http-push2-h2": "",
+         "brewfather-push": "",
+         "influxdb2-push": "",
+         "influxdb2-org": "",
+         "influxdb2-bucket": "",
+         "influxdb2-auth": "",
+         "mqtt-push": "192.168.1.50",
+         "mqtt-port": 1883,
+         "mqtt-user": "Qwerty",
+         "mqtt-pass": "Qwerty"
+         }
+set_config( url, json )
+
+url = "http://" + host + "/api/config/gravity"
+json = { "id": id,
+         "gravity-formula": "",
+         "gravity-format": "P",
+         "gravity-temp-adjustment": "off"        # Adjust gravity (on/off)
+         }
+set_config( url, json )
+
+url = "http://" + host + "/api/config/hardware"
+json = { "id": id,
+         "voltage-factor": 1.59,                 # Default value for voltage calculation
+         "temp-adjustment": 0,                   # If temp sensor needs to be corrected
+         "gyro-temp": "on",                      # Use the temp sensor in the gyro instead (on/off)
+         "ota-url": ""                           # if the device should seach for a new update when active
+      }
+set_config( url, json )
+
+url = "http://" + host + "/api/formula"
+json = { "id": id,
+         "a1": 22.4,
+         "a2": 54.4,
+         "a3": 58,
+         "a4": 0,
+         "a5": 0,
+         "g1": 1.000,
+         "g2": 1.053,
+         "g3": 1.062,
+         "g4": 1,
+         "g5": 1
+         }
+set_config( url, json )
+
+
+
+
+ +
+
+ +
+ +
+
+ + + + + + \ No newline at end of file diff --git a/docs/compiling.html b/docs/compiling.html index 90852fa..d36fa76 100644 --- a/docs/compiling.html +++ b/docs/compiling.html @@ -2,10 +2,10 @@ - + - Compiling the software - GravityMon 0.7.0 documentation + Compiling the software - GravityMon 0.7.1 documentation @@ -122,7 +122,7 @@
- +
Previous
-
Setting up device
+
Data Formats
diff --git a/docs/configuration.html b/docs/configuration.html index 56ef344..688ff66 100644 --- a/docs/configuration.html +++ b/docs/configuration.html @@ -2,10 +2,10 @@ - + - Setting up device - GravityMon 0.7.0 documentation + Configuration - GravityMon 0.7.1 documentation @@ -122,7 +122,7 @@
-
-

Setting up device

+
+

Configuration

The device can operate in two modes and must be in configuration mode in order for the web server to be active.

One of the following conditions will place the device in configuration mode:

    @@ -228,18 +228,19 @@ you are collecting angle/tilt for calibration. If this is unchecked the device w
  • Device name:

    -

    This is unique name of the device.

    +

    This is unique name of the device which is set in the configuration, also known as MDNS name.

  • Device ID:

    -

    This is unique identifier for the device (ESP8266 id), this is required when using the API as an API Key to safeguard against faulty requests.

    +

    This is unique identifier for the device (ESP8266 id), this is required when using the API as an API Key to safeguard +against faulty requests. This is the ESP8266 chip ID, so it should be unique.

-
-

Configuration

+
+

Configuration

URL: (http://gravmon.local/config)

Device Setting

@@ -252,18 +253,21 @@ you are collecting angle/tilt for calibration. If this is unchecked the device w
  • Temperature format:

    -

    Choose between Celsius and Farenheight

    +

    Choose between Celsius and Farenheight when displaying temperature.

  • Interval:

    -

    This defines how long the device should be sleeping between the readings when in gravity monitoring mode. You will also see the values in minutes/seconds to easier set the interval. 900s is a recommended interval.

    +

    This defines how long the device should be sleeping between the readings when in gravity monitoring mode. You will also see +the values in minutes/seconds to easier set the interval. 900s is a recommended interval. The sleep interval can +be set between 10 - 3600 seconds (60 minutes).

  • Note

    -

    The sleep interval can be set between 10 - 3600 seconds (60 minutes).

    +

    A low value such as 30s will give a lifespan of 1-2 weeks and 300s (5 min) would last for 3+ weeks. This assumes that +there is good wifi connection that takes less than 1s to reconnect. Poor wifi connection is the main reason for battery drain.

    • Calibration values:

      @@ -288,25 +292,25 @@ battery life, so the decision is to prioritize battery life over security. The d
      • HTTP URL 1:

        -

        Endpoint to send data via http. Default format used Format used iSpindle format. You can customize the format using Format editor.

        +

        Endpoint to send data via http. Default format used Format used iSpindle format. You can customize the format using Format editor.

        If you add the prefix https:// then the device will use SSL when sending data.

      • HTTP URL 2:

        -

        Endpoint to send data via http. Default format used iSpindle format. You can customize the format using Format editor.

        +

        Endpoint to send data via http. Default format used iSpindle format. You can customize the format using Format editor.

        If you add the prefix https:// then the device will use SSL when sending data.

      • Brewfather URL:

        -

        Endpoint to send data via http to brewfather. Format used Brewfather format

        +

        Endpoint to send data via http to brewfather. Format used Brewfather format

        SSL is not supported for this target.

      • Influx DB v2 URL:

        -

        Endpoint to send data via http to InfluxDB. Format used Influx DB v2. You can customize the format using Format editor.

        +

        Endpoint to send data via http to InfluxDB. Format used Influx DB v2. You can customize the format using Format editor.

        SSL is not supported for this target. Raise a issue on github if this is wanted.

      • @@ -327,7 +331,7 @@ battery life, so the decision is to prioritize battery life over security. The d
      • MQTT server:

        -

        IP or name of server to send data to. Default format used MQTT. You can customize the format using Format editor.

        +

        IP or name of server to send data to. Default format used MQTT. You can customize the format using Format editor.

      • MQTT Port:

        @@ -353,18 +357,21 @@ battery life, so the decision is to prioritize battery life over security. The d
        • Gravity format:

          -

          Gravity format can be eihter SG or Plato. The device will use SG Internally and convert to Plato when displaying data.

          +

          Gravity format can be eihter SG or Plato. The device will use SG Internally and convert to Plato when displaying or sending data.

        • Gravity formula:

          Gravity formula is compatible with standard iSpindle formulas so any existing calculation option can be used. You can also use -the feature to create the formula by supplying the raw data. See Create formula

          +the feature to create the formula by supplying the raw data. See Create formula

          +

          The gravity formula accepts to paramaters, tilt for the angle or temp for temperature (temperature inserted into the formula +will be in celsius). I would recommend to use the formula calculation feature instead since this is much easier.

        • Temperature correct gravity:

          -

          Will apply a temperature calibration formula to the gravity as a second step.

          +

          Will apply a temperature calibration formula to the gravity as a second step after gravity has been calculated. It’s also possible to +build this into the gravity formula.

        @@ -403,7 +410,7 @@ been running the value would be totally off.

      • OTA URL:

        -

        Should point to a URL where the .bin file + version.json file is located.

        +

        Should point to a URL where the firmware.bin file + version.json file are located.

        For the OTA to work, place the following files (version.json + firmware.bin) at the location that you pointed out in OTA URL. If the version number in the json file is newer than in the code the update will be done during startup.

        If you have the previx https:// then the device will use secure transfer without CA validation.

        @@ -416,528 +423,6 @@ code the update will be done during startup.

    -
    -
    -

    Format editor

    -

    To reduce the need for adding custom endpoints for various services there is an built in format editor that allows the user to customize the format being sent to the push target.

    -
    -

    Warning

    -

    Since the format templates can be big this function can be quite slow on a small device such as the esp8266.

    -
    -Format editor -

    You enter the format data in the text field and the test button will show an example on what the output would look like. If the data cannot be formatted in json it will just be displayed as a long string. -The save button will save the current formla and reload the data from the device.

    -
    -

    Tip

    -

    If you save a blank string the default template will be loaded.

    -
    -

    These are the format keys available for use in the format.

    -
    - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Directory structure

    key

    description

    example

    ${mdns}

    Name of the device

    gravmon2

    ${id}

    Unique id of the device

    e422a3

    ${sleep-interval}

    Seconds between data is pushed

    900

    ${temp}

    Temperature in format configured on device, one decimal

    21.2

    ${temp-c}

    Temperature in C, one decimal

    21.2

    ${temp-f}

    Temperature in F, one decimal

    58.0

    ${temp-unit}

    Temperature format C or F

    C

    ${battery}

    Battery voltage, two decimals

    3.89

    ${rssi}

    Wifi signal strength

    -75

    ${run-time}

    How long the last measurement took, two decimals

    3.87

    ${angle}

    Angle of the gyro, two decimals

    28.67

    ${tilt}

    Same as angle.

    28.67

    ${gravity}

    Calculated gravity, 4 decimals for SG and 1 for Plato.

    1.0456

    ${gravity-sg}

    Calculated gravity in SG, 4 decimals

    1.0456

    ${gravity-plato}

    Calculated gravity in Plato, 1 decimal

    8.5

    ${corr-gravity}

    Temperature corrected gravity, 4 decimals for SG and 1 for Plato.

    1.0456

    ${corr-gravity-sg}

    Temperature corrected gravity in SG, 4 decimals

    1.0456

    ${corr-gravity-plato}

    Temperature corrected gravity in Plato, 1 decimal

    8.5

    ${gravity-unit}

    Gravity format, G or P

    G

    -
    -
    -

    Create formula

    -Formula data -

    Here you can enter up to 5 values (angles + gravity) that is then used to create the formula. Angles equal to zero will be regarded as empty even if there is a gravity reading.

    -Formula graph -

    Once the formula is created a graph over the entered values and a simulation of the formula will give you a nice overview on how the formula will work.

    -
    -
    -

    REST API

    -

    All the API’s use a key called ID which is the unique device id (chip id). This is used as an API key when sending requests to the device.

    -
    -

    GET: /api/config

    -

    Retrive the current configuation of the device via an HTTP GET command. Payload is in JSON format.

    -
      -
    • temp-format can be either C or F

    • -
    • gravity-format is always G (plato is not yet supported)

    • -
    -

    Other parameters are the same as in the configuration guide.

    -
    {
    -   "mdns": "gravmon",
    -   "id": "ee1bfc",
    -   "ota-url": "http://192.168.1.50:80/firmware/gravmon/",
    -   "temp-format": "C",
    -   "brewfather-push": "http://log.brewfather.net/stream?id=Qwerty",
    -   "http-push": "http://192.168.1.50:9090/api/v1/Qwerty/telemetry",
    -   "http-push2": "http://192.168.1.50/ispindel",
    -   "influxdb2-push": "http://192.168.1.50:8086",
    -   "influxdb2-org": "Qwerty",
    -   "influxdb2-bucket": "Qwerty",
    -   "influxdb2-auth": "Qwerty",
    -   "mqtt-push": "192.168.1.50",
    -   "mqtt-port": 1883,
    -   "mqtt-user": "Qwerty",
    -   "mqtt-pass": "Qwerty",
    -   "sleep-interval": 30,
    -   "voltage-factor": 1.59,
    -   "gravity-formula": "0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436",
    -   "gravity-format": "G",
    -   "temp-adjustment-value": 0,
    -   "gravity-temp-adjustment": false,
    -   "gyro-temp": true,
    -   "gyro-calibration-data": {
    -      "ax": -330,
    -      "ay": -2249,
    -      "az": 1170,
    -      "gx": 99,
    -      "gy": -6,
    -      "gz": 4
    -   },
    -   "angle": 90.93,
    -   "gravity": 1.105,
    -   "battery": 0.04
    -}
    -
    -
    -
    -
    -

    GET: /api/device

    -

    Retrive the current device settings via an HTTP GET command. Payload is in JSON format.

    -
    {
    -   "app-name": "GravityMon ",
    -   "app-ver": "0.0.0",
    -   "id": "ee1bfc",
    -   "mdns": "gravmon"
    -}
    -
    -
    -
    -
    -

    GET: /api/status

    -

    Retrive the current device status via an HTTP GET command. Payload is in JSON format.

    -
      -
    • temp-format can be either C or F

    • -
    -

    Other parameters are the same as in the configuration guide.

    -
    {
    -   "id": "ee1bfc",
    -   "angle": 89.86,
    -   "gravity": 1.1052,
    -   "gravity-tempcorr": 1.1031,
    -   "temp-c": 0,
    -   "temp-f": 32,
    -   "battery": 0,
    -   "temp-format": "C",
    -   "sleep-mode": false,
    -   "rssi": -56
    -}
    -
    -
    -
    -
    -

    GET: /api/config/formula

    -

    Retrive the data used for formula calculation data via an HTTP GET command. Payload is in JSON format.

    -
      -
    • a1-a4 are the angles/tilt readings (up to 5 are currently supported)

    • -
    • g1-g4 are the corresponding gravity reaadings in SG or Plato depending on the device-format.

    • -
    -
    {
    -   "id": "ee1bfc",
    -   "a1": 22.4,
    -   "a2": 54.4,
    -   "a3": 58,
    -   "a4": 0,
    -   "a5": 0,
    -   "g1": 1.000,
    -   "g2": 1.053,
    -   "g3": 1.062,
    -   "g4": 1,
    -   "g5": 1,
    -   "gravity-format": "G",
    -   "gravity-formula": "0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436"
    -}
    -
    -
    -
    -
    -

    POST: /api/config/device

    -

    Used to update device settings via an HTTP POST command. Payload is in JSON format.

    -
      -
    • temp-format can be either C (Celcius) or F (Farenheight)

    • -
    -
    {
    -   "id": "ee1bfc",
    -   "mdns": "gravmon",
    -   "temp-format": "C",
    -   "sleep-interval": 30
    -}
    -
    -
    -
    -
    -

    POST: /api/config/push

    -

    Used to update push settings via an HTTP POST command. Payload is in JSON format.

    -
    {
    -   "id": "ee1bfc",
    -   "http-push": "http://192.168.1.50/ispindel",
    -   "http-push2": "",
    -   "brewfather-push": "",
    -   "influxdb2-push": "http://192.168.1.50:8086",
    -   "influxdb2-org": "Qwerty",
    -   "influxdb2-bucket": "Qwerty",
    -   "influxdb2-auth": "Qwerty"
    -   "mqtt-push": "192.168.1.50",
    -   "mqtt-port": 1883,
    -   "mqtt-user": "Qwerty",
    -   "mqtt-pass": "Qwerty",
    -}
    -
    -
    -
    -
    -

    POST: /api/config/gravity

    -

    Used to update gravity settings via an HTTP POST command. Payload is in JSON format.

    -
      -
    • gravity-formula keywords temp and tilt are supported.

    • -
    • gravity-format can be either G (SG) or P (PLATO)

    • -
    -
    -

    Note

    -

    gravity-temp-adjustment is defined as “on” or “off” when posting since this is the output values -from a checkbox, when reading data it’s sent as boolean (true,false).

    -
    -
    {
    -   "id": "ee1bfc",
    -   "gravity-formula": "0.0*tilt^3+0.0*tilt^2+0.0017978*tilt+0.9436",
    -   "gravity-format": "P",
    -   "gravity-temp-adjustment": "off"
    -}
    -
    -
    -
    -
    -

    POST: /api/config/hardware

    -

    Used to update hardware settings via an HTTP POST command. Payload is in JSON format.

    -
    -

    Note

    -

    gyro-temp is defined as “on” or “off” when posting since this is the output values from a checkbox, when -reading data it’s sent as boolean (true,false).

    -
    -
    {
    -   "id": "ee1bfc",
    -   "voltage-factor": 1.59,
    -   "temp-adjustment": 0,
    -   "gyro-temp": "off",
    -   "ota-url": "http://192.168.1.50/firmware/gravmon/"
    -}
    -
    -
    -
    -
    -

    POST: /api/config/formula

    -

    Used to update formula calculation data via an HTTP POST command. Payload is in JSON format.

    -
      -
    • a1-a4 are the angles/tilt readings (up to 5 are currently supported)

    • -
    • g1-g4 are the corresponding gravity reaadings (in SG)

    • -
    -
    {
    -   "id": "ee1bfc",
    -   "a1": 22.4,
    -   "a2": 54.4,
    -   "a3": 58,
    -   "a4": 0,
    -   "a5": 0,
    -   "g1": 1.000,
    -   "g2": 1.053,
    -   "g3": 1.062,
    -   "g4": 1,
    -   "g5": 1
    -}
    -
    -
    -
    -
    -

    Calling the API’s from Python

    -

    Here is some example code for how to access the API’s from a python script. Keys should always be -present or the API call will fail.

    -
    import requests
    -import json
    -
    -host = "192.168.1.1"           # IP adress (or name) of the device to send these settings to
    -id = "ee1bfc"                  # Device ID (shown in serial console during startup or in UI)
    -
    -def set_config( url, json ):
    -   headers = { "ContentType": "application/json" }
    -   print( url )
    -   resp = requests.post( url, headers=headers, data=json )
    -   if resp.status_code != 200 :
    -      print ( "Failed "  )
    -   else :
    -      print ( "Success "  )
    -
    -url = "http://" + host + "/api/config/device"
    -json = { "id": id,
    -         "mdns": "gravmon",             # Name of the device
    -         "temp-format": "C",            # Temperature format C or F
    -         "sleep-interval": 30           # Sleep interval in seconds
    -      }
    -set_config( url, json )
    -
    -url = "http://" + host + "/api/config/push"
    -json = { "id": id,
    -         "http-push": "http://192.168.1.1/ispindel",
    -         "http-push2": "",
    -         "brewfather-push": "",
    -         "influxdb2-push": "",
    -         "influxdb2-org": "",
    -         "influxdb2-bucket": "",
    -         "influxdb2-auth": "",
    -         "mqtt-push": "192.168.1.50",
    -         "mqtt-port": 1883,
    -         "mqtt-user": "Qwerty",
    -         "mqtt-pass": "Qwerty"
    -         }
    -set_config( url, json )
    -
    -url = "http://" + host + "/api/config/gravity"
    -json = { "id": id,
    -         "gravity-formula": "",
    -         "gravity-format": "P",
    -         "gravity-temp-adjustment": "off"        # Adjust gravity (on/off)
    -         }
    -set_config( url, json )
    -
    -url = "http://" + host + "/api/config/hardware"
    -json = { "id": id,
    -         "voltage-factor": 1.59,                 # Default value for voltage calculation
    -         "temp-adjustment": 0,                   # If temp sensor needs to be corrected
    -         "gyro-temp": "on",                      # Use the temp sensor in the gyro instead (on/off)
    -         "ota-url": ""                           # if the device should seach for a new update when active
    -      }
    -set_config( url, json )
    -
    -url = "http://" + host + "/api/formula"
    -json = { "id": id,
    -         "a1": 22.4,
    -         "a2": 54.4,
    -         "a3": 58,
    -         "a4": 0,
    -         "a5": 0,
    -         "g1": 1.000,
    -         "g2": 1.053,
    -         "g3": 1.062,
    -         "g4": 1,
    -         "g5": 1
    -         }
    -set_config( url, json )
    -
    -
    -
    -
    -
    -

    Data Formats

    -
    -

    iSpindle format

    -

    This is the format used for standard http posts.

    -
      -
    • corr-gravity is an extended parameter containing a temperature corrected gravity reading.

    • -
    • gravity-format is an extended parameter containing the gravity format (G or P).

    • -
    • run-time is an extended parameter containing the number of seconds the execution took.

    • -
    -
    {
    -   "name" : "gravmon",
    -   "ID": "2E6753",
    -   "token" : "gravmon",
    -   "interval": 900,
    -   "temperature": 20.5,
    -   "temp-units": "C",
    -   "gravity": 1.0050,
    -   "angle": 45.34,
    -   "battery": 3.67,
    -   "rssi": -12,
    -
    -   "corr-gravity": 1.0050,
    -   "gravity-unit": "G",
    -   "run-time": 6
    -}
    -
    -
    -

    This is the format template used to create the json above.

    -
    {
    - "name" : "gravmon",
    - "ID": "${id}",
    - "token" : "gravmon",
    - "interval": ${sleep-interval},
    - "temperature": ${temp},
    - "temp-units": "${temp-unit}",
    - "gravity": ${gravity},
    - "angle": ${angle},
    - "battery": ${battery},
    - "rssi": ${rssi},
    - "corr-gravity": ${corr-gravity},
    - "gravity-unit": "${gravity-unit}",
    - "run-time": ${run-time}
    -}
    -
    -
    -
    -
    -

    Brewfather format

    -

    This is the format for Brewfather. See: Brewfather API docs

    -
    {
    -   "name" : "gravmon",
    -   "temp": 20.5,
    -   "temp_unit": "C",
    -   "battery": 3.67,
    -   "gravity": 1.0050,
    -   "gravity_unit": "G",
    -}
    -
    -
    -
    -
    -

    Influx DB v2

    -

    This is the format for InfluxDB v2

    -
    measurement,host=<mdns>,device=<id>,temp-format=<C|F>,gravity-format=SG,gravity=1.0004,corr-gravity=1.0004,angle=45.45,temp=20.1,battery=3.96,rssi=-18
    -
    -
    -

    This is the format template used to create the json above.

    -
    measurement,host=${mdns},device=${id},temp-format=${temp-unit},gravity-format=${gravity-unit} gravity=${gravity},corr-gravity=${corr-gravity},angle=${angle},temp=${temp},battery=${battery},rssi=${rssi}
    -
    -
    -
    -
    -

    MQTT

    -

    This is the format used to send data to MQTT. Each of the lines are specific topics

    -
    ispindel/device_name/tilt 89.96796
    -ispindel/device_name/temperature 21.375
    -ispindel/device_name/temp_units C
    -ispindel/device_name/battery 0.04171
    -ispindel/device_name/gravity 33.54894
    -ispindel/device_name/interval 1
    -ispindel/device_name/RSSI -58
    -
    -
    -

    This is the format template used to create the json above.

    -
    -

    Tip

    -

    Each line in the format is treated as one topic. The | is used as separator between lines and the first : is used as separator between topic and value. Each line is formatted as <topic>:<value>

    -
    -
    ispindel/${mdns}/tilt:${angle}|
    -ispindel/${mdns}/temperature:${temp}|
    -ispindel/${mdns}/temp_units:${temp-unit}|
    -ispindel/${mdns}/battery:${battery}|
    -ispindel/${mdns}/gravity:${gravity}|
    -ispindel/${mdns}/interval:${sleep-interval}|
    -ispindel/${mdns}/RSSI:${rssi}|
    -
    -
    -

    This is a format template that is compatible with v0.6. Just replace the topic with the topic you want to post data to.

    -
    topic:{"name":"gravmon","ID":"${id}","token":"gravmon","interval": ${sleep-interval},"temperature": ${temp},"temp-units": "${temp-unit}","gravity":${gravity},"angle": ${angle},"battery":${battery},"rssi": ${rssi},"corr-gravity":${corr-gravity},"gravity-unit": "${gravity-unit}","run-time": ${run-time}}|
    -
    -
    -
    -
    -

    version.json

    -

    Contents version.json. The version is used by the device to check if the this version is newer. The html files will also be downloaded if the are present on the server. This way it’s easy to -upgrade to a version that serve the html files from the file system. If they dont exist nothing will happen, the OTA flashing will still work. If the html files are missing from the file system -they can be uploaded manually afterwards.

    -
    {
    -   "project":"gravmon",
    -   "version":"0.7.0",
    -   "html": [
    -      "index.min.htm",
    -      "device.min.htm",
    -      "config.min.htm",
    -      "format.min.htm",
    -      "calibration.min.htm",
    -      "about.min.htm"
    -   ]
    -}
    -
    -
    -
    @@ -945,12 +430,12 @@ they can be uploaded manually afterwards.