[BF] Fixing a Calculation Bug
This commit is contained in:
parent
ef0c483ac2
commit
66a517b935
@ -58,7 +58,7 @@ namespace Mqtt_SWB_Dashboard.Helper {
|
|||||||
internal Double GetPower() {
|
internal Double GetPower() {
|
||||||
Double ret = 0;
|
Double ret = 0;
|
||||||
foreach (KeyValuePair<String, Device> item in this.Devices) {
|
foreach (KeyValuePair<String, Device> item in this.Devices) {
|
||||||
if (item.Value.TimeStamp > DateTime.Now.AddMinutes(-10) && item.Value.Type == (Device.DevType.Consumption & Device.DevType.State)) {
|
if (item.Value.TimeStamp > DateTime.Now.AddMinutes(-10) && item.Value.Type != Device.DevType.Production) {
|
||||||
ret += item.Value.Power;
|
ret += item.Value.Power;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ namespace Mqtt_SWB_Dashboard.Helper {
|
|||||||
internal Double GetAllPower() {
|
internal Double GetAllPower() {
|
||||||
Double ret = 0;
|
Double ret = 0;
|
||||||
foreach (KeyValuePair<String, Device> item in this.Devices) {
|
foreach (KeyValuePair<String, Device> item in this.Devices) {
|
||||||
if (item.Value.Type == (Device.DevType.Consumption & Device.DevType.State)) {
|
if (item.Value.Type != Device.DevType.Production) {
|
||||||
ret += item.Value.Power;
|
ret += item.Value.Power;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ namespace Mqtt_SWB_Dashboard.Helper {
|
|||||||
internal Double GetColum() {
|
internal Double GetColum() {
|
||||||
Double ret = 0;
|
Double ret = 0;
|
||||||
foreach (KeyValuePair<String, Device> item in this.Devices) {
|
foreach (KeyValuePair<String, Device> item in this.Devices) {
|
||||||
if (item.Value.TimeStamp > DateTime.Now.AddMinutes(-10) && item.Value.Type == (Device.DevType.Consumption & Device.DevType.State)) {
|
if (item.Value.TimeStamp > DateTime.Now.AddMinutes(-10) && item.Value.Type != Device.DevType.Production) {
|
||||||
ret += item.Value.Comul;
|
ret += item.Value.Comul;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ namespace Mqtt_SWB_Dashboard.Helper {
|
|||||||
internal Double GetAllColum() {
|
internal Double GetAllColum() {
|
||||||
Double ret = 0;
|
Double ret = 0;
|
||||||
foreach (KeyValuePair<String, Device> item in this.Devices) {
|
foreach (KeyValuePair<String, Device> item in this.Devices) {
|
||||||
if (item.Value.Type == (Device.DevType.Consumption & Device.DevType.State)) {
|
if (item.Value.Type != Device.DevType.Production) {
|
||||||
ret += item.Value.Comul;
|
ret += item.Value.Comul;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,9 @@ namespace Mqtt_SWB_Dashboard {
|
|||||||
info.NumberFormat.NumberDecimalSeparator = ".";
|
info.NumberFormat.NumberDecimalSeparator = ".";
|
||||||
CultureInfo.DefaultThreadCurrentCulture = info;
|
CultureInfo.DefaultThreadCurrentCulture = info;
|
||||||
CultureInfo.DefaultThreadCurrentUICulture = info;
|
CultureInfo.DefaultThreadCurrentUICulture = info;
|
||||||
|
System.Threading.Thread.CurrentThread.CurrentCulture = info;
|
||||||
|
System.Threading.Thread.CurrentThread.CurrentUICulture = info;
|
||||||
|
LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(System.Windows.Markup.XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
|
||||||
|
|
||||||
String broker = InIReader.GetInstance("settings.ini").GetValue("general", "broker");
|
String broker = InIReader.GetInstance("settings.ini").GetValue("general", "broker");
|
||||||
this.Dispatcher.BeginInvoke((Action)(() => {
|
this.Dispatcher.BeginInvoke((Action)(() => {
|
||||||
|
@ -49,7 +49,7 @@ namespace Mqtt_SWB_Dashboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region IDisposable Support
|
#region IDisposable Support
|
||||||
private bool disposedValue = false; // Dient zur Erkennung redundanter Aufrufe.
|
private Boolean disposedValue = false; // Dient zur Erkennung redundanter Aufrufe.
|
||||||
|
|
||||||
protected virtual void Dispose(Boolean disposing) {
|
protected virtual void Dispose(Boolean disposing) {
|
||||||
if (!this.disposedValue) {
|
if (!this.disposedValue) {
|
||||||
|
@ -42,7 +42,7 @@ namespace Mqtt_SWB_Dashboard {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void Mosquitto_MessageIncomming(Object sender, MqttEventArgs e) {
|
private void Mosquitto_MessageIncomming(Object sender, MqttEventArgs e) {
|
||||||
if (e.Topic == "/flex4grid/VersionControl/LocalGateway/groups/BONN_1") {
|
if (Regex.Match(e.Topic, "/flex4grid/VersionControl/LocalGateway/groups/.*").Success) {
|
||||||
this.LvcMessages(e);
|
this.LvcMessages(e);
|
||||||
} else if (Regex.Match(e.Topic, "/flex4grid/VersionControl/LocalGateway/hosts/.*/status").Success ||
|
} else if (Regex.Match(e.Topic, "/flex4grid/VersionControl/LocalGateway/hosts/.*/status").Success ||
|
||||||
e.Topic == "/flex4grid/VersionControl/LocalGateway/status") {
|
e.Topic == "/flex4grid/VersionControl/LocalGateway/status") {
|
||||||
@ -65,6 +65,8 @@ namespace Mqtt_SWB_Dashboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Mqtt-Message Parser
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// LogMessages eines Raspis
|
/// LogMessages eines Raspis
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -131,7 +133,7 @@ namespace Mqtt_SWB_Dashboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Nachricht ob ein Gerät verbunden ist (Vermutlich vom Master)
|
/// Nachricht ob ein Haushalt (gateway_plugs_1) verbunden ist (Vermutlich vom Master)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void HouseholdStatus(MqttEventArgs e) {
|
private void HouseholdStatus(MqttEventArgs e) {
|
||||||
@ -149,6 +151,10 @@ namespace Mqtt_SWB_Dashboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Nachricht ob ein Raspi Verbunden ist (liefert die lvc Werte?)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void RaspiStatus(MqttEventArgs e) {
|
private void RaspiStatus(MqttEventArgs e) {
|
||||||
try {
|
try {
|
||||||
JsonData data = JsonMapper.ToObject(e.Message);
|
JsonData data = JsonMapper.ToObject(e.Message);
|
||||||
@ -163,6 +169,8 @@ namespace Mqtt_SWB_Dashboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Statistics Output
|
#region Statistics Output
|
||||||
|
|
||||||
internal String GetNumberDevices() {
|
internal String GetNumberDevices() {
|
||||||
|
BIN
Mqtt-SWB-Dashboard/bin/Release/LitJson.dll
Normal file
BIN
Mqtt-SWB-Dashboard/bin/Release/LitJson.dll
Normal file
Binary file not shown.
BIN
Mqtt-SWB-Dashboard/bin/Release/Mqtt-SWB-Dashboard.exe
Normal file
BIN
Mqtt-SWB-Dashboard/bin/Release/Mqtt-SWB-Dashboard.exe
Normal file
Binary file not shown.
BIN
Mqtt-SWB-Dashboard/bin/Release/OxyPlot.Wpf.dll
Normal file
BIN
Mqtt-SWB-Dashboard/bin/Release/OxyPlot.Wpf.dll
Normal file
Binary file not shown.
BIN
Mqtt-SWB-Dashboard/bin/Release/OxyPlot.dll
Normal file
BIN
Mqtt-SWB-Dashboard/bin/Release/OxyPlot.dll
Normal file
Binary file not shown.
BIN
Mqtt-SWB-Dashboard/bin/Release/Utils.dll
Normal file
BIN
Mqtt-SWB-Dashboard/bin/Release/Utils.dll
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user