Added token as option in UI #32

This commit is contained in:
Magnus Persson 2022-01-31 18:50:47 +01:00
parent 761d570d39
commit e1cc54d188
12 changed files with 36 additions and 8 deletions

View File

@ -196,6 +196,15 @@
<hr class="my-2"> <hr class="my-2">
<div class="form-group row">
<label for="token" class="col-sm-2 col-form-label">Token:</label>
<div class="col-sm-4">
<input type="text" maxlength="50" class="form-control" name="token" id="token">
</div>
</div>
<hr class="my-2">
<div class="form-group row"> <div class="form-group row">
<label for="inputBrewfatherPush" class="col-sm-2 col-form-label">Brewfather URL:</label> <label for="inputBrewfatherPush" class="col-sm-2 col-form-label">Brewfather URL:</label>
<div class="col-sm-10"> <div class="col-sm-10">
@ -223,8 +232,6 @@
<input type="text" maxlength="50" class="form-control" name="influxdb2-bucket" id="influxdb2-bucket"> <input type="text" maxlength="50" class="form-control" name="influxdb2-bucket" id="influxdb2-bucket">
</div> </div>
</div> </div>
<div class="form-group row">
</div>
<div class="form-group row"> <div class="form-group row">
<label for="influxdb2-auth" class="col-sm-2 col-form-label">InfluxDB v2 Auth:</label> <label for="influxdb2-auth" class="col-sm-2 col-form-label">InfluxDB v2 Auth:</label>
<div class="col-sm-4"> <div class="col-sm-4">
@ -503,6 +510,7 @@ $('#modal-http').on('hide.bs.modal', function (event) {
if( cfg["gravity-format"] == "G" ) $("#gravity-format-g").click(); if( cfg["gravity-format"] == "G" ) $("#gravity-format-g").click();
else $("#gravity-format-p").click(); else $("#gravity-format-p").click();
$("#ota-url").val(cfg["ota-url"]); $("#ota-url").val(cfg["ota-url"]);
$("#token").val(cfg["token"]);
$("#http-push").val(cfg["http-push"]); $("#http-push").val(cfg["http-push"]);
$("#http-push-h1").val(cfg["http-push-h1"]); $("#http-push-h1").val(cfg["http-push-h1"]);
$("#http-push-h2").val(cfg["http-push-h2"]); $("#http-push-h2").val(cfg["http-push-h2"]);

File diff suppressed because one or more lines are too long

View File

@ -148,10 +148,11 @@
// Test the calibration // Test the calibration
$("#test-btn").click(function(e) { $("#test-btn").click(function(e) {
var doc = $("#format").val(); var doc = $("#format").val();
doc = doc.replaceAll("${mdns}", "gravmon2"); doc = doc.replaceAll("${mdns}", "testing");
doc = doc.replaceAll("${id}", "e4a344"); doc = doc.replaceAll("${id}", "e4a344");
doc = doc.replaceAll("${sleep-interval}", "300"); doc = doc.replaceAll("${sleep-interval}", "300");
doc = doc.replaceAll("${temp}", "21.1"); doc = doc.replaceAll("${temp}", "21.1");
doc = doc.replaceAll("${token}", "a-token");
doc = doc.replaceAll("${temp-c}", "21.1"); doc = doc.replaceAll("${temp-c}", "21.1");
doc = doc.replaceAll("${temp-f}", "51.3"); doc = doc.replaceAll("${temp-f}", "51.3");
doc = doc.replaceAll("${temp-unit}", "C"); doc = doc.replaceAll("${temp-unit}", "C");

View File

@ -1,2 +1,2 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="description" content=""><title>Beer Gravity Monitor</title><link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous"><script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" crossorigin="anonymous"></script></head><body class="py-4"><!-- START MENU --><nav class="navbar navbar-expand-sm navbar-dark bg-primary"><a class="navbar-brand" href="/index.htm">Beer Gravity Monitor</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button><div class="collapse navbar-collapse" id="navbar"><ul class="navbar-nav mr-auto"><li class="nav-item"><a class="nav-link" href="/config.htm">Back to configuration</a></li></ul></div><div class="spinner-border text-light" id="spinner" role="status"></div></nav><!-- START MAIN INDEX --><div class="container"><hr class="my-2"><div class="alert alert-success alert-dismissible fade hide show d-none" role="alert" id="alert"><div id="alert-msg">...</div><button type="button" id="alert-btn" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button></div><script type="text/javascript">function showError(s){$("#alert").removeClass("alert-success").addClass("alert-danger").removeClass("d-none").addClass("show"),$("#alert-msg").text(s)}function showSuccess(s){$("#alert").addClass("alert-success").removeClass("alert-danger").removeClass("d-none").addClass("show"),$("#alert-msg").text(s)}$("#alert-btn").click(function(s){$("#alert").addClass("d-none").removeClass("show")})</script><div class="accordion" id="accordion"><div class="card"><div class="card-header" id="headingOne"><h2 class="mb-0"><button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">Push Format Templates</button></h2></div><div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"><div class="card-body"><input type="text" name="id" id="id" hidden> <input type="text" name="http-1" id="http-1" hidden> <input type="text" name="http-2" id="http-2" hidden><!--<input type="text" name="brewfather" id="brewfather" hidden>--> <input type="text" name="influxdb" id="influxdb" hidden> <input type="text" name="mqtt" id="mqtt" hidden><div class="form-group row"><label for="push-target" class="col-sm-2 col-form-label">Push target:</label> <select class="custom-select col-sm-4" required name="push-target" id="push-target"><option value="http-1">HTTP option 1</option><option value="http-2">HTTP option 2</option><!--<option value="brewfather">Brewfather</option>--><option value="influxdb">Influx DB</option><option value="mqtt">MQTT</option></select></div><div class="form-group row"><div class="col-sm-12"><textarea rows="5" class="form-control" name="format" id="format"> <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="description" content=""><title>Beer Gravity Monitor</title><link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous"><script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" crossorigin="anonymous"></script></head><body class="py-4"><!-- START MENU --><nav class="navbar navbar-expand-sm navbar-dark bg-primary"><a class="navbar-brand" href="/index.htm">Beer Gravity Monitor</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button><div class="collapse navbar-collapse" id="navbar"><ul class="navbar-nav mr-auto"><li class="nav-item"><a class="nav-link" href="/config.htm">Back to configuration</a></li></ul></div><div class="spinner-border text-light" id="spinner" role="status"></div></nav><!-- START MAIN INDEX --><div class="container"><hr class="my-2"><div class="alert alert-success alert-dismissible fade hide show d-none" role="alert" id="alert"><div id="alert-msg">...</div><button type="button" id="alert-btn" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button></div><script type="text/javascript">function showError(s){$("#alert").removeClass("alert-success").addClass("alert-danger").removeClass("d-none").addClass("show"),$("#alert-msg").text(s)}function showSuccess(s){$("#alert").addClass("alert-success").removeClass("alert-danger").removeClass("d-none").addClass("show"),$("#alert-msg").text(s)}$("#alert-btn").click(function(s){$("#alert").addClass("d-none").removeClass("show")})</script><div class="accordion" id="accordion"><div class="card"><div class="card-header" id="headingOne"><h2 class="mb-0"><button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">Push Format Templates</button></h2></div><div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"><div class="card-body"><input type="text" name="id" id="id" hidden> <input type="text" name="http-1" id="http-1" hidden> <input type="text" name="http-2" id="http-2" hidden><!--<input type="text" name="brewfather" id="brewfather" hidden>--> <input type="text" name="influxdb" id="influxdb" hidden> <input type="text" name="mqtt" id="mqtt" hidden><div class="form-group row"><label for="push-target" class="col-sm-2 col-form-label">Push target:</label> <select class="custom-select col-sm-4" required name="push-target" id="push-target"><option value="http-1">HTTP option 1</option><option value="http-2">HTTP option 2</option><!--<option value="brewfather">Brewfather</option>--><option value="influxdb">Influx DB</option><option value="mqtt">MQTT</option></select></div><div class="form-group row"><div class="col-sm-12"><textarea rows="5" class="form-control" name="format" id="format">
</textarea></div></div><div class="form-group row"><div class="col-sm-8 offset-sm-2"><button class="btn btn-primary" id="format-btn">Save</button> <button class="btn btn-secondary" id="test-btn">Test</button></div></div><pre class="card-preview" id="preview" name="preview"></pre></div></div></div><hr class="my-4"></div><script type="text/javascript">function setButtonDisabled(l){$("#format-btn").prop("disabled",l),$("#test-btn").prop("disabled",l)}function selectFormat(){var l="#"+$("#push-target").val();console.log(l),l=decodeURIComponent($(l).val()),console.log(l),l=l.replaceAll("|","|\n"),console.log(l),$("#format").val(l),$("#preview").text("")}function getConfig(){setButtonDisabled(!0);var l="/api/config/format";$("#spinner").show(),$.getJSON(l,function(l){console.log(l),$("#id").val(l.id),$("#http-1").val(l["http-1"]),$("#http-2").val(l["http-2"]),$("#influxdb").val(l.influxdb),$("#mqtt").val(l.mqtt),selectFormat()}).fail(function(){showError("Unable to get data from the device.")}).always(function(){$("#spinner").hide(),setButtonDisabled(!1)})}window.onload=getConfig,setButtonDisabled(!0),$(document).ready(function(){null!=location.hash&&""!=location.hash&&($(".collapse").removeClass("in"),$(location.hash+".collapse").collapse("show"))}),$("#push-target").change(function(l){console.log(l),selectFormat()}),$("#format-btn").click(function(l){var e=$("#format").val();e=e.replaceAll("\n","");var t="id="+$("#id").val()+"&"+$("#push-target").val()+"="+encodeURIComponent(e);console.log(t),$.ajax({type:"POST",url:"/api/config/format",data:t,success:function(l){showSuccess("Format stored successfully."),getConfig()},error:function(l){showError("Unable to store format.")}})}),$("#test-btn").click(function(l){var e=$("#format").val();e=e.replaceAll("${mdns}","gravmon2"),e=e.replaceAll("${id}","e4a344"),e=e.replaceAll("${sleep-interval}","300"),e=e.replaceAll("${temp}","21.1"),e=e.replaceAll("${temp-c}","21.1"),e=e.replaceAll("${temp-f}","51.3"),e=e.replaceAll("${temp-unit}","C"),e=e.replaceAll("${battery}","3.86"),e=e.replaceAll("${rssi}","-76"),e=e.replaceAll("${run-time}","4.32"),e=e.replaceAll("${gravity}","1.044"),e=e.replaceAll("${gravity-sg}","1.044"),e=e.replaceAll("${gravity-plato}","9.5"),e=e.replaceAll("${gravity-unit}","G"),e=e.replaceAll("${corr-gravity}","1.044"),e=e.replaceAll("${corr-gravity-sg}","1.044"),e=e.replaceAll("${corr-gravity-plato}","9.5"),e=e.replaceAll("${angle}","54.5"),e=e.replaceAll("${tilt}","54.5");try{var t=JSON.parse(e);e=JSON.stringify(t,null,2)}catch(l){console.log("Not a javascript object!")}$("#preview").text(e)})</script><!-- START FOOTER --><div class="container-fluid themed-container bg-primary text-light">(C) Copyright 2021-22 Magnus Persson</div></div></body></html> </textarea></div></div><div class="form-group row"><div class="col-sm-8 offset-sm-2"><button class="btn btn-primary" id="format-btn">Save</button> <button class="btn btn-secondary" id="test-btn">Test</button></div></div><pre class="card-preview" id="preview" name="preview"></pre></div></div></div><hr class="my-4"></div><script type="text/javascript">function setButtonDisabled(l){$("#format-btn").prop("disabled",l),$("#test-btn").prop("disabled",l)}function selectFormat(){var l="#"+$("#push-target").val();console.log(l),l=decodeURIComponent($(l).val()),console.log(l),l=l.replaceAll("|","|\n"),console.log(l),$("#format").val(l),$("#preview").text("")}function getConfig(){setButtonDisabled(!0);var l="/api/config/format";$("#spinner").show(),$.getJSON(l,function(l){console.log(l),$("#id").val(l.id),$("#http-1").val(l["http-1"]),$("#http-2").val(l["http-2"]),$("#influxdb").val(l.influxdb),$("#mqtt").val(l.mqtt),selectFormat()}).fail(function(){showError("Unable to get data from the device.")}).always(function(){$("#spinner").hide(),setButtonDisabled(!1)})}window.onload=getConfig,setButtonDisabled(!0),$(document).ready(function(){null!=location.hash&&""!=location.hash&&($(".collapse").removeClass("in"),$(location.hash+".collapse").collapse("show"))}),$("#push-target").change(function(l){console.log(l),selectFormat()}),$("#format-btn").click(function(l){var e=$("#format").val();e=e.replaceAll("\n","");var t="id="+$("#id").val()+"&"+$("#push-target").val()+"="+encodeURIComponent(e);console.log(t),$.ajax({type:"POST",url:"/api/config/format",data:t,success:function(l){showSuccess("Format stored successfully."),getConfig()},error:function(l){showError("Unable to store format.")}})}),$("#test-btn").click(function(l){var e=$("#format").val();e=e.replaceAll("${mdns}","testing"),e=e.replaceAll("${id}","e4a344"),e=e.replaceAll("${sleep-interval}","300"),e=e.replaceAll("${temp}","21.1"),e=e.replaceAll("${token}","a-token"),e=e.replaceAll("${temp-c}","21.1"),e=e.replaceAll("${temp-f}","51.3"),e=e.replaceAll("${temp-unit}","C"),e=e.replaceAll("${battery}","3.86"),e=e.replaceAll("${rssi}","-76"),e=e.replaceAll("${run-time}","4.32"),e=e.replaceAll("${gravity}","1.044"),e=e.replaceAll("${gravity-sg}","1.044"),e=e.replaceAll("${gravity-plato}","9.5"),e=e.replaceAll("${gravity-unit}","G"),e=e.replaceAll("${corr-gravity}","1.044"),e=e.replaceAll("${corr-gravity-sg}","1.044"),e=e.replaceAll("${corr-gravity-plato}","9.5"),e=e.replaceAll("${angle}","54.5"),e=e.replaceAll("${tilt}","54.5");try{var t=JSON.parse(e);e=JSON.stringify(t,null,2)}catch(l){console.log("Not a javascript object!")}$("#preview").text(e)})</script><!-- START FOOTER --><div class="container-fluid themed-container bg-primary text-light">(C) Copyright 2021-22 Magnus Persson</div></div></body></html>

View File

@ -71,6 +71,7 @@ void Config::createJson(DynamicJsonDocument& doc) {
doc[PARAM_PASS] = getWifiPass(); doc[PARAM_PASS] = getWifiPass();
doc[PARAM_TEMPFORMAT] = String(getTempFormat()); doc[PARAM_TEMPFORMAT] = String(getTempFormat());
doc[PARAM_PUSH_BREWFATHER] = getBrewfatherPushUrl(); doc[PARAM_PUSH_BREWFATHER] = getBrewfatherPushUrl();
doc[PARAM_TOKEN] = getToken();
doc[PARAM_PUSH_HTTP] = getHttpUrl(); doc[PARAM_PUSH_HTTP] = getHttpUrl();
doc[PARAM_PUSH_HTTP_H1] = getHttpHeader(0); doc[PARAM_PUSH_HTTP_H1] = getHttpHeader(0);
doc[PARAM_PUSH_HTTP_H2] = getHttpHeader(1); doc[PARAM_PUSH_HTTP_H2] = getHttpHeader(1);
@ -206,6 +207,7 @@ bool Config::loadFile() {
if (!doc[PARAM_PUSH_BREWFATHER].isNull()) if (!doc[PARAM_PUSH_BREWFATHER].isNull())
setBrewfatherPushUrl(doc[PARAM_PUSH_BREWFATHER]); setBrewfatherPushUrl(doc[PARAM_PUSH_BREWFATHER]);
if (!doc[PARAM_TOKEN].isNull()) setToken(doc[PARAM_TOKEN]);
if (!doc[PARAM_PUSH_HTTP].isNull()) setHttpUrl(doc[PARAM_PUSH_HTTP]); if (!doc[PARAM_PUSH_HTTP].isNull()) setHttpUrl(doc[PARAM_PUSH_HTTP]);
if (!doc[PARAM_PUSH_HTTP_H1].isNull()) if (!doc[PARAM_PUSH_HTTP_H1].isNull())
setHttpHeader(doc[PARAM_PUSH_HTTP_H1], 0); setHttpHeader(doc[PARAM_PUSH_HTTP_H1], 0);

View File

@ -104,6 +104,8 @@ class Config {
// Push target settings // Push target settings
String _brewfatherPushUrl = ""; String _brewfatherPushUrl = "";
String _token = "";
String _httpUrl = ""; String _httpUrl = "";
String _httpHeader[2] = { "Content-Type: application/json", "" }; String _httpHeader[2] = { "Content-Type: application/json", "" };
String _http2Url = ""; String _http2Url = "";
@ -174,6 +176,13 @@ class Config {
return _brewfatherPushUrl.length() ? true : false; return _brewfatherPushUrl.length() ? true : false;
} }
// Token parameter
const char* getToken() { return _token.c_str(); }
void setToken(String s) {
_token = s;
_saveNeeded = true;
}
// Standard HTTP // Standard HTTP
const char* getHttpUrl() { return _httpUrl.c_str(); } const char* getHttpUrl() { return _httpUrl.c_str(); }
void setHttpUrl(String s) { void setHttpUrl(String s) {

View File

@ -32,6 +32,7 @@ SOFTWARE.
#define PARAM_PASS "wifi-pass" #define PARAM_PASS "wifi-pass"
#define PARAM_RUNTIME_AVERAGE "runtime-average" #define PARAM_RUNTIME_AVERAGE "runtime-average"
#define PARAM_PUSH_BREWFATHER "brewfather-push" #define PARAM_PUSH_BREWFATHER "brewfather-push"
#define PARAM_TOKEN "token"
#define PARAM_PUSH_HTTP "http-push" #define PARAM_PUSH_HTTP "http-push"
#define PARAM_PUSH_HTTP_H1 "http-push-h1" #define PARAM_PUSH_HTTP_H1 "http-push-h1"
#define PARAM_PUSH_HTTP_H2 "http-push-h2" #define PARAM_PUSH_HTTP_H2 "http-push-h2"

View File

@ -35,7 +35,7 @@ const char iSpindleFormat[] PROGMEM =
"{" "{"
"\"name\" : \"${mdns}\", " "\"name\" : \"${mdns}\", "
"\"ID\": \"${id}\", " "\"ID\": \"${id}\", "
"\"token\" : \"gravmon\", " "\"token\" : \"${token}\", "
"\"interval\": ${sleep-interval}, " "\"interval\": ${sleep-interval}, "
"\"temperature\": ${temp}, " "\"temperature\": ${temp}, "
"\"temp-units\": \"${temp-unit}\", " "\"temp-units\": \"${temp-unit}\", "
@ -88,6 +88,7 @@ void TemplatingEngine::initialize(float angle, float gravitySG, float corrGravit
// Names // Names
setVal(TPL_MDNS, myConfig.getMDNS()); setVal(TPL_MDNS, myConfig.getMDNS());
setVal(TPL_ID, myConfig.getID()); setVal(TPL_ID, myConfig.getID());
setVal(TPL_TOKEN, myConfig.getToken());
// Temperature // Temperature
if (myConfig.isTempC()) { if (myConfig.isTempC()) {

View File

@ -34,6 +34,7 @@ SOFTWARE.
// Templating variables // Templating variables
#define TPL_MDNS "${mdns}" #define TPL_MDNS "${mdns}"
#define TPL_ID "${id}" #define TPL_ID "${id}"
#define TPL_TOKEN "${token}"
#define TPL_SLEEP_INTERVAL "${sleep-interval}" #define TPL_SLEEP_INTERVAL "${sleep-interval}"
#define TPL_TEMP "${temp}" #define TPL_TEMP "${temp}"
#define TPL_TEMP_C "${temp-c}" #define TPL_TEMP_C "${temp-c}"
@ -71,7 +72,7 @@ class TemplatingEngine {
String val; String val;
}; };
KeyVal items[19] = {{TPL_MDNS, ""}, {TPL_ID, ""}, KeyVal items[20] = {{TPL_MDNS, ""}, {TPL_ID, ""},
{TPL_SLEEP_INTERVAL, ""}, {TPL_TEMP, ""}, {TPL_SLEEP_INTERVAL, ""}, {TPL_TEMP, ""},
{TPL_TEMP_C, ""}, {TPL_TEMP_F, ""}, {TPL_TEMP_C, ""}, {TPL_TEMP_F, ""},
{TPL_TEMP_UNITS, ""}, {TPL_BATTERY, ""}, {TPL_TEMP_UNITS, ""}, {TPL_BATTERY, ""},
@ -80,7 +81,7 @@ class TemplatingEngine {
{TPL_GRAVITY, ""}, {TPL_GRAVITY_G, ""}, {TPL_GRAVITY, ""}, {TPL_GRAVITY_G, ""},
{TPL_GRAVITY_P, ""}, {TPL_GRAVITY_CORR, ""}, {TPL_GRAVITY_P, ""}, {TPL_GRAVITY_CORR, ""},
{TPL_GRAVITY_CORR_G, ""}, {TPL_GRAVITY_CORR_P, ""}, {TPL_GRAVITY_CORR_G, ""}, {TPL_GRAVITY_CORR_P, ""},
{TPL_GRAVITY_UNIT, ""}}; {TPL_GRAVITY_UNIT, ""}, {TPL_TOKEN, ""}};
char buffer[20]; char buffer[20];
String baseTemplate; String baseTemplate;

View File

@ -365,6 +365,8 @@ void WebServerHandler::webHandleConfigPush() {
Log.verbose(F("WEB : %s." CR), getRequestArguments().c_str()); Log.verbose(F("WEB : %s." CR), getRequestArguments().c_str());
#endif #endif
if (_server->hasArg(PARAM_TOKEN))
myConfig.setToken(_server->arg(PARAM_TOKEN).c_str());
if (_server->hasArg(PARAM_PUSH_HTTP)) if (_server->hasArg(PARAM_PUSH_HTTP))
myConfig.setHttpUrl(_server->arg(PARAM_PUSH_HTTP).c_str()); myConfig.setHttpUrl(_server->arg(PARAM_PUSH_HTTP).c_str());
if (_server->hasArg(PARAM_PUSH_HTTP_H1)) if (_server->hasArg(PARAM_PUSH_HTTP_H1))

View File

@ -23,6 +23,7 @@ Other parameters are the same as in the configuration guide.
"ota-url": "http://192.168.1.50:80/firmware/gravmon/", "ota-url": "http://192.168.1.50:80/firmware/gravmon/",
"temp-format": "C", "temp-format": "C",
"brewfather-push": "http://log.brewfather.net/stream?id=Qwerty", "brewfather-push": "http://log.brewfather.net/stream?id=Qwerty",
"token": "token",
"http-push": "http://192.168.1.50:9090/api/v1/Qwerty/telemetry", "http-push": "http://192.168.1.50:9090/api/v1/Qwerty/telemetry",
"http-push-h1": "header: value", "http-push-h1": "header: value",
"http-push-h2": "header: value", "http-push-h2": "header: value",
@ -273,6 +274,7 @@ The requests package converts the json to standard form post format.
url = "http://" + host + "/api/config/push" url = "http://" + host + "/api/config/push"
json = { "id": id, json = { "id": id,
"token": "",
"http-push": "http://192.168.1.1/ispindel", "http-push": "http://192.168.1.1/ispindel",
"http-push2": "", "http-push2": "",
"http-push-h1": "", "http-push-h1": "",

View File

@ -10,6 +10,7 @@
"http-push2": "http://192.168.1.10/ispindel", "http-push2": "http://192.168.1.10/ispindel",
"http-push2-h1": "Second", "http-push2-h1": "Second",
"http-push2-h2": "First", "http-push2-h2": "First",
"token": "mytoken",
"influxdb2-push": "http://192.168.1.10:8086", "influxdb2-push": "http://192.168.1.10:8086",
"influxdb2-org": "hello", "influxdb2-org": "hello",
"influxdb2-bucket": "spann", "influxdb2-bucket": "spann",