[BF] Fixing a Calculation Bug

This commit is contained in:
BlubbFish 2017-09-18 18:06:25 +00:00
parent ef0c483ac2
commit 66a517b935
9 changed files with 18 additions and 8 deletions

View File

@ -58,7 +58,7 @@ namespace Mqtt_SWB_Dashboard.Helper {
internal Double GetPower() {
Double ret = 0;
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;
}
}
@ -68,7 +68,7 @@ namespace Mqtt_SWB_Dashboard.Helper {
internal Double GetAllPower() {
Double ret = 0;
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;
}
}
@ -78,7 +78,7 @@ namespace Mqtt_SWB_Dashboard.Helper {
internal Double GetColum() {
Double ret = 0;
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;
}
}
@ -88,7 +88,7 @@ namespace Mqtt_SWB_Dashboard.Helper {
internal Double GetAllColum() {
Double ret = 0;
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;
}
}

View File

@ -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)(() => {

View File

@ -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) {

View File

@ -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
/// <summary>
/// LogMessages eines Raspis
/// </summary>
@ -131,7 +133,7 @@ namespace Mqtt_SWB_Dashboard {
}
/// <summary>
/// Nachricht ob ein Gerät verbunden ist (Vermutlich vom Master)
/// Nachricht ob ein Haushalt (gateway_plugs_1) verbunden ist (Vermutlich vom Master)
/// </summary>
/// <param name="e"></param>
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) {
try {
JsonData data = JsonMapper.ToObject(e.Message);
@ -163,6 +169,8 @@ namespace Mqtt_SWB_Dashboard {
}
}
#endregion
#region Statistics Output
internal String GetNumberDevices() {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.