Removed brewfather option

This commit is contained in:
Magnus Persson 2022-04-10 15:47:44 +02:00
parent e9229efe56
commit a648d54a14
15 changed files with 17 additions and 158 deletions

View File

@ -244,7 +244,6 @@
$("#http-1").val(cfg["http-1"]);
$("#http-2").val(cfg["http-2"]);
$("#http-3").val(cfg["http-3"]);
//$("#brewfather").val(cfg["brewfather"]);
$("#influxdb").val(cfg["influxdb"]);
$("#mqtt").val(cfg["mqtt"]);
selectFormat();

View File

@ -66,7 +66,6 @@ void Config::createJson(DynamicJsonDocument& doc) {
doc[PARAM_PASS] = getWifiPass();
doc[PARAM_BLE] = getColorBLE();
doc[PARAM_TEMPFORMAT] = String(getTempFormat());
doc[PARAM_PUSH_BREWFATHER] = getBrewfatherPushUrl();
doc[PARAM_TOKEN] = getToken();
doc[PARAM_TOKEN2] = getToken2();
doc[PARAM_PUSH_HTTP] = getHttpUrl();
@ -207,9 +206,6 @@ bool Config::loadFile() {
setTempFormat(s.charAt(0));
}
if (!doc[PARAM_PUSH_BREWFATHER].isNull())
setBrewfatherPushUrl(doc[PARAM_PUSH_BREWFATHER]);
if (!doc[PARAM_TOKEN].isNull()) setToken(doc[PARAM_TOKEN]);
if (!doc[PARAM_TOKEN2].isNull()) setToken2(doc[PARAM_TOKEN2]);
if (!doc[PARAM_PUSH_HTTP].isNull()) setHttpUrl(doc[PARAM_PUSH_HTTP]);

View File

@ -106,8 +106,6 @@ class Config {
String _wifiPASS = "";
// Push target settings
String _brewfatherPushUrl = "";
String _token = "";
String _token2 = "";
@ -178,16 +176,6 @@ class Config {
_saveNeeded = true;
}
// Brewfather
const char* getBrewfatherPushUrl() { return _brewfatherPushUrl.c_str(); }
void setBrewfatherPushUrl(String s) {
_brewfatherPushUrl = s;
_saveNeeded = true;
}
bool isBrewfatherActive() {
return _brewfatherPushUrl.length() ? true : false;
}
// Token parameter
const char* getToken() { return _token.c_str(); }
void setToken(String s) {
@ -361,7 +349,7 @@ class Config {
bool isBLEActive() { return _colorBLE.length() ? true : false; }
bool isWifiPushActive() {
return (isHttpActive() || isHttp2Active() || isHttp3Active() ||
isBrewfatherActive() || isInfluxDb2Active() || isMqttActive())
isInfluxDb2Active() || isMqttActive())
? true
: false;
}

View File

@ -44,12 +44,6 @@ void PushTarget::sendAll(float angle, float gravitySG, float corrGravitySG,
TemplatingEngine engine;
engine.initialize(angle, gravitySG, corrGravitySG, tempC, runTime);
if (myConfig.isBrewfatherActive()) {
LOG_PERF_START("push-brewfather");
sendBrewfather(engine);
LOG_PERF_STOP("push-brewfather");
}
if (myConfig.isHttpActive()) {
LOG_PERF_START("push-http");
sendHttpPost(engine, myConfig.isHttpSSL(), 0);
@ -122,45 +116,6 @@ void PushTarget::sendInfluxDb2(TemplatingEngine& engine) {
tcp_cleanup();
}
//
// Send data to brewfather
//
void PushTarget::sendBrewfather(TemplatingEngine& engine) {
#if !defined(PUSH_DISABLE_LOGGING)
Log.notice(F("PUSH: Sending values to brewfather" CR));
#endif
_lastCode = 0;
_lastSuccess = false;
String serverPath = myConfig.getBrewfatherPushUrl();
String doc = engine.create(TemplatingEngine::TEMPLATE_BREWFATHER);
_http.begin(_wifi, serverPath);
_http.setTimeout(myHardwareConfig.getPushTimeout() * 1000);
#if LOG_LEVEL == 6 && !defined(PUSH_DISABLE_LOGGING)
Log.verbose(F("PUSH: url %s." CR), serverPath.c_str());
Log.verbose(F("PUSH: json %s." CR), doc.c_str());
#endif
_http.addHeader(F("Content-Type"), F("application/json"));
_lastCode = _http.POST(doc);
if (_lastCode == 200) {
_lastSuccess = true;
Log.notice(F("PUSH: Brewfather push successful, response=%d" CR),
_lastCode);
} else {
ErrorFileLog errLog;
errLog.addEntry("PUSH: Brewfather push failed response=" +
String(_lastCode));
}
_http.end();
_wifi.stop();
tcp_cleanup();
}
//
//
//

View File

@ -50,7 +50,6 @@ class PushTarget {
void sendAll(float angle, float gravitySG, float corrGravitySG, float tempC,
float runTime);
void sendBrewfather(TemplatingEngine& engine);
void sendHttp1(TemplatingEngine& engine, bool isSecure) {
sendHttpPost(engine, isSecure, 0);
}

View File

@ -32,7 +32,6 @@ SOFTWARE.
#define PARAM_SSID "wifi-ssid"
#define PARAM_PASS "wifi-pass"
#define PARAM_RUNTIME_AVERAGE "runtime-average"
#define PARAM_PUSH_BREWFATHER "brewfather-push"
#define PARAM_TOKEN "token"
#define PARAM_TOKEN2 "token2"
#define PARAM_PUSH_HTTP "http-push"
@ -85,7 +84,6 @@ SOFTWARE.
#define PARAM_FORMAT_HTTP1 "http-1"
#define PARAM_FORMAT_HTTP2 "http-2"
#define PARAM_FORMAT_HTTP3 "http-3"
#define PARAM_FORMAT_BREWFATHER "brewfather"
#define PARAM_FORMAT_INFLUXDB "influxdb"
#define PARAM_FORMAT_MQTT "mqtt"
#define PARAM_PUSH_FORMAT "format"

View File

@ -64,24 +64,6 @@ const char iHttpGetFormat[] PROGMEM =
"&gravity-unit=${gravity-unit}"
"&run-time=${run-time}";
const char brewfatherFormat[] PROGMEM =
"{"
"\"name\": \"${mdns}\","
"\"temp\": ${temp}, "
"\"aux_temp\": 0, "
"\"ext_temp\": 0, "
"\"temp_unit\": \"${temp-unit}\", "
"\"gravity\": ${gravity}, "
"\"gravity_unit\": \"${gravity-unit}\", "
"\"pressure\": 0, "
"\"pressure_unit\": \"PSI\", "
"\"ph\": 0, "
"\"bpm\": 0, "
"\"comment\": \"\", "
"\"beer\": \"\", "
"\"battery\": ${battery}"
"}";
const char influxDbFormat[] PROGMEM =
"measurement,host=${mdns},device=${id},temp-format=${temp-unit},gravity-"
"format=${gravity-unit} "
@ -174,10 +156,6 @@ const String& TemplatingEngine::create(TemplatingEngine::Templates idx) {
baseTemplate = String(iHttpGetFormat);
fname = TPL_FNAME_HTTP3;
break;
case TEMPLATE_BREWFATHER:
baseTemplate = String(brewfatherFormat);
// fname = TPL_FNAME_BREWFATHER;
break;
case TEMPLATE_INFLUX:
baseTemplate = String(influxDbFormat);
fname = TPL_FNAME_INFLUXDB;

View File

@ -57,13 +57,11 @@ SOFTWARE.
#define TPL_FNAME_HTTP1 "/http-1.tpl"
#define TPL_FNAME_HTTP2 "/http-2.tpl"
#define TPL_FNAME_HTTP3 "/http-3.tpl"
// #define TPL_FNAME_BREWFATHER "/brewfather.tpl"
#define TPL_FNAME_INFLUXDB "/influxdb.tpl"
#define TPL_FNAME_MQTT "/mqtt.tpl"
extern const char iSpindleFormat[] PROGMEM;
extern const char iHttpGetFormat[] PROGMEM;
extern const char brewfatherFormat[] PROGMEM;
extern const char influxDbFormat[] PROGMEM;
extern const char mqttFormat[] PROGMEM;
@ -133,9 +131,8 @@ class TemplatingEngine {
TEMPLATE_HTTP1 = 0,
TEMPLATE_HTTP2 = 1,
TEMPLATE_HTTP3 = 2,
TEMPLATE_BREWFATHER = 3,
TEMPLATE_INFLUX = 4,
TEMPLATE_MQTT = 5
TEMPLATE_INFLUX = 3,
TEMPLATE_MQTT = 4
};
void initialize(float angle, float gravitySG, float corrGravitySG,

View File

@ -498,8 +498,6 @@ void WebServerHandler::webHandleConfigPush() {
myConfig.setHttp2Header(_server->arg(PARAM_PUSH_HTTP2_H2).c_str(), 1);
if (_server->hasArg(PARAM_PUSH_HTTP3))
myConfig.setHttp3Url(_server->arg(PARAM_PUSH_HTTP3).c_str());
if (_server->hasArg(PARAM_PUSH_BREWFATHER))
myConfig.setBrewfatherPushUrl(_server->arg(PARAM_PUSH_BREWFATHER).c_str());
if (_server->hasArg(PARAM_PUSH_INFLUXDB2))
myConfig.setInfluxDb2PushUrl(_server->arg(PARAM_PUSH_INFLUXDB2).c_str());
if (_server->hasArg(PARAM_PUSH_INFLUXDB2_ORG))
@ -792,10 +790,6 @@ void WebServerHandler::webHandleConfigFormatWrite() {
} else if (_server->hasArg(PARAM_FORMAT_MQTT)) {
success = writeFile(TPL_FNAME_MQTT, _server->arg(PARAM_FORMAT_MQTT));
}
/*else if (_server->hasArg(PARAM_FORMAT_BREWFATHER)) {
success = writeFile(TPL_FNAME_BREWFATHER,
_server->arg(PARAM_FORMAT_BREWFATHER));
}*/
if (success) {
_server->sendHeader("Location", "/format.htm", true);
@ -841,11 +835,7 @@ void WebServerHandler::webHandleTestPush() {
PushTarget push;
bool enabled = false;
if (!type.compareTo(PARAM_FORMAT_BREWFATHER) &&
myConfig.isBrewfatherActive()) {
push.sendBrewfather(engine);
enabled = true;
} else if (!type.compareTo(PARAM_FORMAT_HTTP1) && myConfig.isHttpActive()) {
if (!type.compareTo(PARAM_FORMAT_HTTP1) && myConfig.isHttpActive()) {
push.sendHttp1(engine, myConfig.isHttpSSL());
enabled = true;
} else if (!type.compareTo(PARAM_FORMAT_HTTP2) && myConfig.isHttp2Active()) {
@ -955,12 +945,6 @@ void WebServerHandler::webHandleConfigFormatRead() {
else
doc[PARAM_FORMAT_HTTP3] = urlencode(String(&iHttpGetFormat[0]));
/*s = readFile(TPL_FNAME_BREWFATHER);
if (s.length())
doc[PARAM_FORMAT_BREWFATHER] = urlencode(s);
else
doc[PARAM_FORMAT_BREWFATHER] = urlencode(&brewfatherFormat[0]);*/
s = readFile(TPL_FNAME_INFLUXDB);
if (s.length())
doc[PARAM_FORMAT_INFLUXDB] = urlencode(s);

View File

@ -24,7 +24,6 @@ Other parameters are the same as in the configuration guide.
"ota-url": "http://192.168.1.50:80/firmware/gravmon/",
"temp-format": "C",
"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",
@ -173,7 +172,7 @@ Trigger a push on one of the targets, used to validate the configuration from th
Requires to parameters to function /api/test/push?id=<deviceid>&format=<format>
* ``format`` defines which endpoint to test, valid values are; http-1, http-2, brewfather, influxdb, mqtt
* ``format`` defines which endpoint to test, valid values are; http-1, http-2, http-3, influxdb, mqtt
The response is an json message with the following values.
@ -223,7 +222,6 @@ Payload should be in standard format used for posting a form. Such as as: `id=va
http-push-h2=
http-push2-h1=
http-push2-h2=
brewfather-push=
influxdb2-push=http://192.168.1.50:8086
influxdb2-org=
influxdb2-bucket=
@ -346,7 +344,6 @@ The requests package converts the json to standard form post format.
"http-push-h2": "",
"http-push2-h1": ""
"http-push2-h2": "",
"brewfather-push": "",
"influxdb2-push": "",
"influxdb2-org": "",
"influxdb2-bucket": "",

View File

@ -121,12 +121,6 @@ If you add the prefix `https://` then the device will use SSL when sending data.
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`
SSL is not supported for this target.
* **HTTP Headers**
.. image:: images/config-popup1.png

View File

@ -54,25 +54,6 @@ This is the format template used to create the json above.
}
.. _data-formats-brewfather:
Brewfather format
=================
This is the format for Brewfather. See: `Brewfather API docs <https://docs.brewfather.app/integrations/custom-stream>`_
.. code-block:: json
{
"name" : "gravmon",
"temp": 20.5,
"temp_unit": "C",
"battery": 3.67,
"gravity": 1.0050,
"gravity_unit": "G",
}
.. _data-formats-influxdb2:
HTTP Get

View File

@ -10,14 +10,21 @@ Brewfather
Brewfather is an all in one service that allows you to manage you recepies and brews.
.. tip::
**Option 1** - iSpindle Endpoint
The integration named Brewfather is uses the custom stream endpoint in brewfather not the standard iSpindle
endpoint. You can use the iSpindle endpoint as well. In that case just use the http-1 or http-2 fields.
This opion makes use of the standard http (1 or 2) endpoints in the push section. This makes use of the standard format template, no changes needed.
**Option 1** - Custom Stream
.. code-block::
This option makes use of the push endpoint called Brewfather in the UI. Just enter the http stream adress found
http://log.brewfather.net/ispindel?id=<yourid>
Documentation on this can be found under `Brewfather iSpindle Endpoint <https://docs.brewfather.app/integrations/ispindel>`_
**Option 2** - Custom Stream
This option makes use of the http push endpoint with a custom format template. Just enter the http stream adress found
on brewfather, not other settings are needed. The stream endpoint URL has the following format:
.. code-block::
@ -48,18 +55,6 @@ The implementation is basically a http request with the following format templat
}
**Option 2** - iSpindle Endpoint
This opion makes use of the standard http (1 or 2) endpoints in the push section. The brewfather iSpindle endpoint
has the following format:
.. code-block::
http://log.brewfather.net/ispindel?id=<yourid>
Documentation on this can be found under `Brewfather iSpindle Endpoint <https://docs.brewfather.app/integrations/ispindel>`_
Fermentrack
+++++++++++

View File

@ -3,7 +3,6 @@
"id": "7376ef",
"ota-url": "http://192.168.1.100:80/firmware/gravmon/",
"temp-format": "C",
"brewfather-push": "http://log.brewfather.net/stream?id=KfkJU43jUFfj",
"http-push": "http://192.168.1.10:9090/api/v1/ZYfjlUNeiuyu9N/telemetry",
"http-push-h1": "Auth: Basic T7IF9DD9fF3RDddE=",
"http-push-h2": "Auth: Advanced T7IF9DD9fF3RDddE=",

View File

@ -37,7 +37,6 @@ json = { "id": id,
"http-push-h2": "",
"http-push2-h1": "Content-Type: application/json",
"http-push2-h2": "",
"brewfather-push": "", # Brewfather URL
"influxdb2-push": "", # InfluxDB2 settings
"influxdb2-org": "",
"influxdb2-bucket": "",