diff --git a/Mqtt-SWB-Dashboard/Helper/Household.cs b/Mqtt-SWB-Dashboard/Helper/Household.cs index 44ebd5a..a8454cd 100644 --- a/Mqtt-SWB-Dashboard/Helper/Household.cs +++ b/Mqtt-SWB-Dashboard/Helper/Household.cs @@ -58,7 +58,7 @@ namespace Mqtt_SWB_Dashboard.Helper { internal Double GetPower() { Double ret = 0; foreach (KeyValuePair 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; } } @@ -68,7 +68,7 @@ namespace Mqtt_SWB_Dashboard.Helper { internal Double GetAllPower() { Double ret = 0; foreach (KeyValuePair 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; } } @@ -78,7 +78,7 @@ namespace Mqtt_SWB_Dashboard.Helper { internal Double GetColum() { Double ret = 0; foreach (KeyValuePair 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; } } @@ -88,7 +88,7 @@ namespace Mqtt_SWB_Dashboard.Helper { internal Double GetAllColum() { Double ret = 0; foreach (KeyValuePair 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; } } diff --git a/Mqtt-SWB-Dashboard/MainWindow.xaml.cs b/Mqtt-SWB-Dashboard/MainWindow.xaml.cs index 5e8ab17..8ded6e8 100644 --- a/Mqtt-SWB-Dashboard/MainWindow.xaml.cs +++ b/Mqtt-SWB-Dashboard/MainWindow.xaml.cs @@ -16,7 +16,9 @@ namespace Mqtt_SWB_Dashboard { info.NumberFormat.NumberDecimalSeparator = "."; CultureInfo.DefaultThreadCurrentCulture = 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"); this.Dispatcher.BeginInvoke((Action)(() => { diff --git a/Mqtt-SWB-Dashboard/Mosquitto.cs b/Mqtt-SWB-Dashboard/Mosquitto.cs index 0126699..75ccd39 100644 --- a/Mqtt-SWB-Dashboard/Mosquitto.cs +++ b/Mqtt-SWB-Dashboard/Mosquitto.cs @@ -49,7 +49,7 @@ namespace Mqtt_SWB_Dashboard { } #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) { if (!this.disposedValue) { diff --git a/Mqtt-SWB-Dashboard/Stats.cs b/Mqtt-SWB-Dashboard/Stats.cs index 92f47ff..1cba0fb 100644 --- a/Mqtt-SWB-Dashboard/Stats.cs +++ b/Mqtt-SWB-Dashboard/Stats.cs @@ -42,7 +42,7 @@ namespace Mqtt_SWB_Dashboard { * */ 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); } else if (Regex.Match(e.Topic, "/flex4grid/VersionControl/LocalGateway/hosts/.*/status").Success || e.Topic == "/flex4grid/VersionControl/LocalGateway/status") { @@ -65,6 +65,8 @@ namespace Mqtt_SWB_Dashboard { } } + #region Mqtt-Message Parser + /// /// LogMessages eines Raspis /// @@ -131,7 +133,7 @@ namespace Mqtt_SWB_Dashboard { } /// - /// Nachricht ob ein Gerät verbunden ist (Vermutlich vom Master) + /// Nachricht ob ein Haushalt (gateway_plugs_1) verbunden ist (Vermutlich vom Master) /// /// private void HouseholdStatus(MqttEventArgs e) { @@ -149,6 +151,10 @@ namespace Mqtt_SWB_Dashboard { } } + /// + /// Nachricht ob ein Raspi Verbunden ist (liefert die lvc Werte?) + /// + /// private void RaspiStatus(MqttEventArgs e) { try { JsonData data = JsonMapper.ToObject(e.Message); @@ -163,6 +169,8 @@ namespace Mqtt_SWB_Dashboard { } } + #endregion + #region Statistics Output internal String GetNumberDevices() { diff --git a/Mqtt-SWB-Dashboard/bin/Release/LitJson.dll b/Mqtt-SWB-Dashboard/bin/Release/LitJson.dll new file mode 100644 index 0000000..f00f11f Binary files /dev/null and b/Mqtt-SWB-Dashboard/bin/Release/LitJson.dll differ diff --git a/Mqtt-SWB-Dashboard/bin/Release/Mqtt-SWB-Dashboard.exe b/Mqtt-SWB-Dashboard/bin/Release/Mqtt-SWB-Dashboard.exe new file mode 100644 index 0000000..df6f886 Binary files /dev/null and b/Mqtt-SWB-Dashboard/bin/Release/Mqtt-SWB-Dashboard.exe differ diff --git a/Mqtt-SWB-Dashboard/bin/Release/OxyPlot.Wpf.dll b/Mqtt-SWB-Dashboard/bin/Release/OxyPlot.Wpf.dll new file mode 100644 index 0000000..04d8c34 Binary files /dev/null and b/Mqtt-SWB-Dashboard/bin/Release/OxyPlot.Wpf.dll differ diff --git a/Mqtt-SWB-Dashboard/bin/Release/OxyPlot.dll b/Mqtt-SWB-Dashboard/bin/Release/OxyPlot.dll new file mode 100644 index 0000000..388e1dc Binary files /dev/null and b/Mqtt-SWB-Dashboard/bin/Release/OxyPlot.dll differ diff --git a/Mqtt-SWB-Dashboard/bin/Release/Utils.dll b/Mqtt-SWB-Dashboard/bin/Release/Utils.dll new file mode 100644 index 0000000..7edc0ad Binary files /dev/null and b/Mqtt-SWB-Dashboard/bin/Release/Utils.dll differ