Skip to content

Commit c2fc7bb

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into Floorplan-Params
2 parents 3f2733e + 5127f7f commit c2fc7bb

35 files changed

+30
-18
lines changed

main/SQLHelper.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4981,7 +4981,7 @@ void CSQLHelper::AddCalendarUpdateMeter()
49814981
}
49824982

49834983

4984-
result=safe_query("SELECT MIN(Value), MAX(Value) FROM Meter WHERE (DeviceRowID='%llu' AND Date>='%q' AND Date<'%q')",
4984+
result=safe_query("SELECT MIN(Value), MAX(Value), AVG(Value) FROM Meter WHERE (DeviceRowID='%llu' AND Date>='%q' AND Date<'%q')",
49854985
ID,
49864986
szDateStart,
49874987
szDateEnd
@@ -4991,7 +4991,8 @@ void CSQLHelper::AddCalendarUpdateMeter()
49914991
std::vector<std::string> sd=result[0];
49924992

49934993
double total_min=(double)atof(sd[0].c_str());
4994-
double total_max=(double)atof(sd[1].c_str());
4994+
double total_max = (double)atof(sd[1].c_str());
4995+
double avg_value = (double)atof(sd[2].c_str());
49954996

49964997
if (
49974998
(devType!=pTypeAirQuality)&&
@@ -5057,7 +5058,7 @@ void CSQLHelper::AddCalendarUpdateMeter()
50575058
"INSERT INTO MultiMeter_Calendar (DeviceRowID, Value1,Value2,Value3,Value4,Value5,Value6, Date) "
50585059
"VALUES ('%llu', '%.2f','%.2f','%.2f','%.2f','%.2f','%.2f', '%q')",
50595060
ID,
5060-
total_min,total_max,0.0f,0.0f,0.0f,0.0f,
5061+
total_min,total_max, avg_value,0.0f,0.0f,0.0f,
50615062
szDateStart
50625063
);
50635064
}

main/WebServer.cpp

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12327,7 +12327,9 @@ namespace http {
1232712327
{
1232812328
if (bHaveFirstValue)
1232912329
{
12330-
root["result"][ii]["d"] = LastDateTime + (method == 1 ? ":30" : ":00");
12330+
//root["result"][ii]["d"] = LastDateTime + (method == 1 ? ":30" : ":00");
12331+
//^^ not necessarely bad, but is currently inconsistent with all other day graphs
12332+
root["result"][ii]["d"] = LastDateTime + ":00";
1233112333

1233212334
long long ulTotalValue = ulLastValue - ulFirstValue;
1233312335
if (ulTotalValue == 0)
@@ -14013,37 +14015,46 @@ namespace http {
1401314015
vdiv = 1000.0f;
1401414016
}
1401514017

14016-
result = m_sql.safe_query("SELECT Value1,Value2, Date FROM %s WHERE (DeviceRowID==%llu AND Date>='%q' AND Date<='%q') ORDER BY Date ASC", dbasetable.c_str(), idx, szDateStart, szDateEnd);
14018+
result = m_sql.safe_query("SELECT Value1,Value2,Value3,Date FROM %s WHERE (DeviceRowID==%llu AND Date>='%q' AND Date<='%q') ORDER BY Date ASC", dbasetable.c_str(), idx, szDateStart, szDateEnd);
1401714019
if (result.size() > 0)
1401814020
{
1401914021
std::vector<std::vector<std::string> >::const_iterator itt;
1402014022
for (itt = result.begin(); itt != result.end(); ++itt)
1402114023
{
1402214024
std::vector<std::string> sd = *itt;
1402314025

14024-
root["result"][ii]["d"] = sd[2].substr(0, 16);
14025-
1402614026
float fValue1 = float(atof(sd[0].c_str())) / vdiv;
1402714027
float fValue2 = float(atof(sd[1].c_str())) / vdiv;
14028+
float fValue3 = float(atof(sd[2].c_str())) / vdiv;
14029+
root["result"][ii]["d"] = sd[3].substr(0, 16);
14030+
1402814031
if (metertype == 1)
1402914032
{
1403014033
fValue1 *= 0.6214f;
1403114034
fValue2 *= 0.6214f;
1403214035
}
14033-
if ((dType == pTypeGeneral) && (dSubType == sTypeVoltage))
14034-
sprintf(szTmp, "%.3f", fValue1);
14035-
else if ((dType == pTypeGeneral) && (dSubType == sTypeCurrent))
14036+
if (
14037+
((dType == pTypeGeneral) && (dSubType == sTypeVoltage)) ||
14038+
((dType == pTypeGeneral) && (dSubType == sTypeCurrent))
14039+
)
14040+
{
1403614041
sprintf(szTmp, "%.3f", fValue1);
14037-
else
14038-
sprintf(szTmp, "%.1f", fValue1);
14039-
root["result"][ii]["v_min"] = szTmp;
14040-
if ((dType == pTypeGeneral) && (dSubType == sTypeVoltage))
14041-
sprintf(szTmp, "%.3f", fValue2);
14042-
else if ((dType == pTypeGeneral) && (dSubType == sTypeCurrent))
14042+
root["result"][ii]["v_min"] = szTmp;
1404314043
sprintf(szTmp, "%.3f", fValue2);
14044+
root["result"][ii]["v_max"] = szTmp;
14045+
if (fValue3 != 0)
14046+
{
14047+
sprintf(szTmp, "%.3f", fValue3);
14048+
root["result"][ii]["v_avg"] = szTmp;
14049+
}
14050+
}
1404414051
else
14052+
{
14053+
sprintf(szTmp, "%.1f", fValue1);
14054+
root["result"][ii]["v_min"] = szTmp;
1404514055
sprintf(szTmp, "%.1f", fValue2);
14046-
root["result"][ii]["v_max"] = szTmp;
14056+
root["result"][ii]["v_max"] = szTmp;
14057+
}
1404714058
ii++;
1404814059
}
1404914060
}

www/html5.appcache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# ref 1254
2+
# ref 1255
33

44
CACHE:
55
# CSS

www/i18n/domoticz-ar.json.gz

28 Bytes
Binary file not shown.

www/i18n/domoticz-bg.json.gz

27 Bytes
Binary file not shown.

www/i18n/domoticz-ca.json.gz

27 Bytes
Binary file not shown.

www/i18n/domoticz-cs.json.gz

29 Bytes
Binary file not shown.

www/i18n/domoticz-da.json.gz

49 Bytes
Binary file not shown.

www/i18n/domoticz-de.json.gz

46 Bytes
Binary file not shown.

www/i18n/domoticz-el.json.gz

94 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)