diff --git a/html/config.htm b/html/config.htm index 2e8a759..dbf1a16 100644 --- a/html/config.htm +++ b/html/config.htm @@ -132,7 +132,7 @@
- +
@@ -547,16 +547,15 @@ function checkHeader(input) { window.location.href = "/test.htm"; }); - function estimateBatteryLife(interval) { + function estimateBatteryLife(interval, rt) { // ESP8266 consumes between 140-170mA when WIFI is on. Deep sleep is 20uA. // MPU-6050 consumes 4mA // DS18B20 consumes 1mA // For this estimation we use an average of 160mA - var pwrActive = 160; // mA per hour - var pwrSleep = 5; // mA per day - var batt = 2200; // mA - var rt = parseInt($("#runtime-average").val()); + var pwrActive = 170; // mA per hour + var pwrSleep = 15; // mA per day + var batt = 2000; // mA if(rt<1) rt = 2; @@ -567,15 +566,19 @@ function checkHeader(input) { function updateSleepInfo() { var i = parseInt($("#sleep-interval").val()); + var rt = parseInt($("#runtime-average").val()); + var j = 0; - var j = estimateBatteryLife(i); + if( rt>0 ) + j = estimateBatteryLife(i, rt); var t1 = Math.floor(i/60) + " m " + (i%60) + " s"; - var t2 = Math.floor(j/7) + " weeks " + (i%7) + " days"; + var t2 = Math.floor(j/7) + " weeks " + Math.floor(j%7) + " days"; - $("#sleep-interval-info").text(t1); - //$("#sleep-interval-info").text( t1 + " - Estimated life: " + t2); - console.log( "Estimated life: " + t2); + if( j ) + $("#sleep-interval-info").text( t1 + " - Estimated runtime: " + t2); + else + $("#sleep-interval-info").text( t1 ); hideWarningGyro(); if(i>0 && i<300) { @@ -609,7 +612,7 @@ function checkHeader(input) { setButtonDisabled( true ); var url = "/api/config"; - //var url = "/test/config.json"; + var url = "/test/config.json"; $('#spinner').show(); $.getJSON(url, function (cfg) { console.log( cfg ); diff --git a/html/config.min.htm b/html/config.min.htm index cca456a..d7fc763 100644 --- a/html/config.min.htm +++ b/html/config.min.htm @@ -1 +1 @@ -Beer Gravity Monitor

Temperature Format:




Gravity Format:


(C) Copyright 2021-22 Magnus Persson
\ No newline at end of file +Beer Gravity Monitor

Temperature Format:




Gravity Format:


(C) Copyright 2021-22 Magnus Persson
\ No newline at end of file diff --git a/src_docs/source/configuration.rst b/src_docs/source/configuration.rst index cde4c59..43c7c47 100644 --- a/src_docs/source/configuration.rst +++ b/src_docs/source/configuration.rst @@ -69,7 +69,8 @@ Device Setting .. note:: 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. + there is good wifi connection that takes less than 1s to reconnect. Poor wifi connection is the main reason for battery drain. + The device will show the estimated lifespan based on the average connection time, if no data exist it will not be shown. * **Calibration values:** diff --git a/src_docs/source/releases.rst b/src_docs/source/releases.rst index d8026de..e1efa6c 100644 --- a/src_docs/source/releases.rst +++ b/src_docs/source/releases.rst @@ -8,6 +8,7 @@ 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. * Added documetation on how to integrate with Blynk.io using http get. +* Config page now shows the estimated runtime for the device (based on a full battery and previous average runtime) * 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. diff --git a/src_docs/source/services.rst b/src_docs/source/services.rst index 6178205..5de90fd 100644 --- a/src_docs/source/services.rst +++ b/src_docs/source/services.rst @@ -10,14 +10,55 @@ 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: +.. tip:: + + 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. + +**Option 1** - Custom Stream + +This option makes use of the push endpoint called Brewfather in the UI. Just enter the http stream adress found +on brewfather, not other settings are needed. The stream endpoint URL has the following format: .. code-block:: - http://log.brewfather.net/http://log.brewfather.net/stream?id= + http://log.brewfather.net/stream?id= + +Documentation on this can be found under `Brewfather Custom Endpoint `_ + +The implementation is basically a http request with the following format template: + +.. code-block:: + + { + "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} + } -The URL is found under settings. +**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= + + +Documentation on this can be found under `Brewfather iSpindle Endpoint `_ Fermentrack +++++++++++ diff --git a/test/config.json b/test/config.json index b751976..3383978 100644 --- a/test/config.json +++ b/test/config.json @@ -39,7 +39,7 @@ "angle": 90.93, "gravity": 1.105, "battery": 0.04, - "runtime-average": 2.0, + "runtime-average": 3.0, "ble": "pink", "platform": "esp32" } \ No newline at end of file