diff --git a/Wetterstation/Form1.Designer.cs b/Wetterstation/Form1.Designer.cs index 982cecbb2c7e7a663a56cd9946a78b18a8760f46..d69496a88ff29a8874dd947a4058a62b5b941ba7 100644 --- a/Wetterstation/Form1.Designer.cs +++ b/Wetterstation/Form1.Designer.cs @@ -235,6 +235,7 @@ namespace Wetterstation this.lbLuftFeuchtInnen.Size = new System.Drawing.Size(180, 70); this.lbLuftFeuchtInnen.TabIndex = 17; this.lbLuftFeuchtInnen.Text = "NA %"; + this.lbLuftFeuchtInnen.Click += new System.EventHandler(this.LbLuftFeuchtInnen_Click); // // lbWindricht // @@ -306,7 +307,7 @@ namespace Wetterstation // this.lbForecastImage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(10)))), ((int)(((byte)(80)))), ((int)(((byte)(147))))); this.lbForecastImage2.Location = new System.Drawing.Point(236, 334); - this.lbForecastImage2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.lbForecastImage2.Margin = new System.Windows.Forms.Padding(4); this.lbForecastImage2.Name = "lbForecastImage2"; this.lbForecastImage2.Size = new System.Drawing.Size(71, 68); this.lbForecastImage2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; @@ -317,7 +318,7 @@ namespace Wetterstation // this.lbForecastImage3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(10)))), ((int)(((byte)(80)))), ((int)(((byte)(147))))); this.lbForecastImage3.Location = new System.Drawing.Point(307, 334); - this.lbForecastImage3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.lbForecastImage3.Margin = new System.Windows.Forms.Padding(4); this.lbForecastImage3.Name = "lbForecastImage3"; this.lbForecastImage3.Size = new System.Drawing.Size(71, 68); this.lbForecastImage3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; @@ -328,7 +329,7 @@ namespace Wetterstation // this.lbForecastImage4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(10)))), ((int)(((byte)(80)))), ((int)(((byte)(147))))); this.lbForecastImage4.Location = new System.Drawing.Point(376, 334); - this.lbForecastImage4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.lbForecastImage4.Margin = new System.Windows.Forms.Padding(4); this.lbForecastImage4.Name = "lbForecastImage4"; this.lbForecastImage4.Size = new System.Drawing.Size(71, 68); this.lbForecastImage4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; @@ -339,7 +340,7 @@ namespace Wetterstation // this.lbForecastImage5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(10)))), ((int)(((byte)(80)))), ((int)(((byte)(147))))); this.lbForecastImage5.Location = new System.Drawing.Point(441, 334); - this.lbForecastImage5.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.lbForecastImage5.Margin = new System.Windows.Forms.Padding(4); this.lbForecastImage5.Name = "lbForecastImage5"; this.lbForecastImage5.Size = new System.Drawing.Size(71, 68); this.lbForecastImage5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; @@ -482,7 +483,7 @@ namespace Wetterstation this.lbForecastImage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(10)))), ((int)(((byte)(80)))), ((int)(((byte)(147))))); this.lbForecastImage1.InitialImage = global::Wetterstation.Properties.Resources._01d_2x; this.lbForecastImage1.Location = new System.Drawing.Point(165, 334); - this.lbForecastImage1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.lbForecastImage1.Margin = new System.Windows.Forms.Padding(4); this.lbForecastImage1.Name = "lbForecastImage1"; this.lbForecastImage1.Size = new System.Drawing.Size(71, 68); this.lbForecastImage1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; @@ -495,7 +496,7 @@ namespace Wetterstation this.btSystemKnopf.BackgroundImage = global::Wetterstation.Properties.Resources.Zahnrad12; this.btSystemKnopf.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.btSystemKnopf.Location = new System.Drawing.Point(1291, 847); - this.btSystemKnopf.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btSystemKnopf.Margin = new System.Windows.Forms.Padding(4); this.btSystemKnopf.Name = "btSystemKnopf"; this.btSystemKnopf.Size = new System.Drawing.Size(40, 37); this.btSystemKnopf.TabIndex = 46; @@ -895,7 +896,7 @@ namespace Wetterstation this.Controls.Add(this.lbHintergrund); this.Controls.Add(this.lbCity); this.DoubleBuffered = true; - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Margin = new System.Windows.Forms.Padding(4); this.Name = "Hintergrund"; this.Text = "Wetterstation"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Hintergrund_FormClosed); diff --git a/Wetterstation/Form1.cs b/Wetterstation/Form1.cs index 2df4e07659e41ae5aa8bd6b58a47c1440daec107..5c493aa6b2741f315a8b512fcbedd94b4314e825 100644 --- a/Wetterstation/Form1.cs +++ b/Wetterstation/Form1.cs @@ -150,7 +150,7 @@ namespace Wetterstation { // Handle message received var message = System.Text.Encoding.Default.GetString(e.Message); - System.Console.WriteLine("Message received: " + message); + //System.Console.WriteLine("Message received: " + message); Console.WriteLine("With Topic: " + e.Topic); if (e.Topic.Equals(WeatherstationSettings.mqtt_topic_frontend + WeatherstationSettings.frontendId + "/weather")) @@ -229,13 +229,15 @@ namespace Wetterstation } } } + + // momentan noch von openweathermap public void updateFormWeather(String message) { Console.WriteLine("Entered updateFormWeather"); try { dynamic weatherData = JsonConvert.DeserializeObject(message.ToString()); - lbAussenTemp.Invoke(new Action(() => { lbAussenTemp.Text = weatherData.temp + " °C"; })); + //lbAussenTemp.Invoke(new Action(() => { lbAussenTemp.Text = weatherData.temp + " °C"; })); lbTempMin.Invoke(new Action(() => { lbTempMin.Text = weatherData.tempMin + " °C"; })); lbTempMax.Invoke(new Action(() => { lbTempMax.Text = weatherData.tempMax + " °C"; })); lbLuftfeuchtAussen.Invoke(new Action(() => { lbLuftfeuchtAussen.Text = weatherData.humidity + " %"; })); @@ -304,10 +306,35 @@ namespace Wetterstation Console.WriteLine("Entered updateFormSensors"); try { + dynamic weatherData = JsonConvert.DeserializeObject(message.ToString()); + + Console.WriteLine("---- bin in update Form Sensors -----"); + Console.WriteLine("++++++++++++ Komplette Daten anzeigen " + weatherData); + //lbInnenTemp.Invoke(new Action(() => { lbInnenTemp.Text = weatherData.sensors[0].temperature + " °C"; })); + if (weatherData[0]["client"] == WeatherstationSettings.node1Id && weatherData[0]["sensor"] == WeatherstationSettings.node1Innen) + { + lbInnenTemp.Invoke(new Action(() => { lbInnenTemp.Text = weatherData[0]["temperature"] + " °C"; })); + lbLuftFeuchtInnen.Invoke(new Action(() => { lbLuftFeuchtInnen.Text = weatherData[0]["humidity"] + " %"; })); + lbLuftdruck.Invoke(new Action(() => { lbLuftdruck.Text = weatherData[0]["pressure"] + " hPa"; })); + } + + + + if (weatherData[0]["client"] == WeatherstationSettings.node1Id && weatherData[0]["sensor"] == WeatherstationSettings.node1Aussen) + { + lbAussenTemp.Invoke(new Action(() => { lbAussenTemp.Text = weatherData[0]["temperature"] + " °C"; })); + } + } catch (Exception ignored) { } + + + //Console.WriteLine("weatherData[\"sensors\"] => " + weatherData[0]["temperature"]); + + + } public void updateFormComplete() {