Added http get option to push

This commit is contained in:
Magnus Persson
2022-03-14 18:55:12 +01:00
parent 6e9d562977
commit 4cad6f888f
23 changed files with 249 additions and 39 deletions

View File

@ -35,6 +35,12 @@ These are the format keys available for use in the format.
* - ${mdns}
- Name of the device
- gravmon2
* - ${token}
- Token
- any value
* - ${token2}
- Token 2
- any value
* - ${id}
- Unique id of the device
- e422a3

View File

@ -26,12 +26,14 @@ Other parameters are the same as in the configuration guide.
"ble": "color",
"brewfather-push": "http://log.brewfather.net/stream?id=Qwerty",
"token": "token",
"token2": "token2",
"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",
"http-push3": "http://192.168.1.50/ispindel",
"influxdb2-push": "http://192.168.1.50:8086",
"influxdb2-org": "org",
"influxdb2-bucket": "bucket_id",
@ -103,6 +105,7 @@ Other parameters are the same as in the configuration guide.
"temp-format": "C",
"sleep-mode": false,
"token": "token",
"token2": "token2",
"rssi": -56,
"app-ver": "0.0.0",
"mdns": "gravmon",
@ -211,8 +214,11 @@ Payload should be in standard format used for posting a form. Such as as: `id=va
.. code-block::
id=ee1bfc
token=
token2=
http-push=http://192.168.1.50/ispindel
http-push2=
http-push3=
http-push-h1=
http-push-h2=
http-push2-h1=
@ -332,8 +338,10 @@ The requests package converts the json to standard form post format.
url = "http://" + host + "/api/config/push"
json = { "id": id,
"token": "",
"token2": "",
"http-push": "http://192.168.1.1/ispindel",
"http-push2": "",
"http-push3": "",
"http-push-h1": "",
"http-push-h2": "",
"http-push2-h1": ""

View File

@ -92,13 +92,13 @@ Push Settings
When enabling SSL this will not validate the root CA of the remote service, this is a design decision based on two aspects. Enabling CA validation will take 3-4s extra on each connection which means way less
battery life, so the decision is to prioritize battery life over security. The data transmitted is not really that sensitive anyway so I belive this is a good balance.
* **HTTP URL 1:**
* **HTTP 1 (POST):**
Endpoint to send data via http. Default format used Format used :ref:`data-formats-ispindle`. You can customize the format using :ref:`format-editor`.
If you add the prefix `https://` then the device will use SSL when sending data.
* **HTTP URL 2:**
* **HTTP 2 (POST):**
Endpoint to send data via http. Default format used :ref:`data-formats-ispindle`. You can customize the format using :ref:`format-editor`.
@ -109,6 +109,16 @@ Push Settings
The token is included in the iSpindle JSON format and will be used for both HTTP targets. If you
need to have 2 different tokens please use the :ref:`format-editor` to customize the data format.
* **HTTP 3 (GET):**
Endpoint to send data via http. This is using an HTTP GET request instead of a post. This means that the values are appended to the URL like; http://endpoint?param=value&param2=value2. You can customize the format using :ref:`format-editor`.
If you add the prefix `https://` then the device will use SSL when sending data.
* **Token 2:**
The token is included in the default format for the HTTP GET url but can be used for any of the formats. For HTTP GET use can use this for an authorization token with for instance ubidots or blynk http api.
* **Brewfather URL:**
Endpoint to send data via http to brewfather. Format used :ref:`data-formats-brewfather`

View File

@ -5,8 +5,8 @@ Data Formats
.. _data-formats-ispindle:
iSpindle format
===============
HTTP Post, iSpindle format
==========================
This is the format used for standard http posts.
@ -75,6 +75,25 @@ This is the format for Brewfather. See: `Brewfather API docs <https://docs.brewf
.. _data-formats-influxdb2:
HTTP Get
========
This is the format added to the URL when using HTTP get
.. code-block::
?name=<mdns>,id=<id>,token=<token>&interval=300&temperature=20.1&temp-units=<C|F>&
gravity=$1.004&angle=45.5&battery=3.96&rssi=-18&corr-gravity=1.004&gravity-unit=<G|P>&run-time=2.1
This is the format template used to create the data above.
.. code-block::
?name=${mdns}&id=${id}&token=${token2}&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}
Influx DB v2
============
@ -82,14 +101,17 @@ This is the format for InfluxDB v2
.. code-block::
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
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.
.. 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}
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:
@ -130,7 +152,10 @@ This is a format template that is compatible with v0.6. Just replace the `topic`
.. 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}}|
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
@ -147,7 +172,7 @@ they can be uploaded manually afterwards.
"version":"0.7.0",
"html": [
"index.min.htm",
"device.min.htm",
"test.min.htm",
"config.min.htm",
"format.min.htm",
"calibration.min.htm",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -5,18 +5,18 @@ Releases
v0.9.0
------
* Added one http push target that uses HTTP GET. This can be used with ubidots or blynk api's.
* Added function to test push targets from configuration page. It will send data and show the return code as a first step.
* Experimental release of firmware using an esp32 instead of esp8266
* Merged index and device pages into one so that all the needed information is available on the index page.
* Removed api for device (/api/device), it's now merged into the /api/status api.
* Test function in format editor now uses real data and not fake.
* Split push configuration into two sections to make it fit better on smaller devices
* Updated WifiManager and DoubleReset libraries
* Experimental release of firmware using an esp32 instead of esp8266
* Updated esp32 target with littlefs support
* Updated esp32 target with BLE send support (it will simulate a tilt)
* Corrected PIN for voltage read on ESP32
* Mounted esp32 d1 mini mounted to a iSpindle PCB 4.0 (CherryPhilip) which worked fine.
* BUG: Corrected PIN for voltage read on ESP32
* BUG: If using plato and not gravity formula was defined the value was set to null.
v0.8.0
@ -29,7 +29,7 @@ v0.8.0
* Added instructions for how to configure integration with Brewspy
* Added instructions for how to configure integration with Thingspeak
* Added option to do a factory reset via API.
* Logging the runtime, how long a measurement take (last 10 are stored). This can be
* Added logging of the runtime, how long a measurement take (last 10 are stored). This can be
used to check how good the wifi connection is and estimate the lifetime when on battery.
Check the device page in the UI for this information.
* Refactored code to free up more RAM to make SSL more stable.