[DW] Flex4Grid deleted
[NF] BosMon Mqtt Plugin created
This commit is contained in:
parent
9189a1bf36
commit
a59a458e58
@ -12,9 +12,16 @@ using LitJson;
|
||||
namespace BlubbFish.House.Dashboard.Graphics {
|
||||
class Heater : AGraphics {
|
||||
private TextBlock targetTemp;
|
||||
private Dictionary<Int32, Double> targetTemps = new Dictionary<Int32, Double>();
|
||||
private TextBlock mode;
|
||||
private TextBlock now;
|
||||
private String topic;
|
||||
private Dictionary<Int32, String> modes = new Dictionary<Int32, String>();
|
||||
private Int32 activemode = -1;
|
||||
private Dictionary<String, String> replace = new Dictionary<String, String> {
|
||||
{ "Heat", "Heizen" },
|
||||
{ "Energy Save Heat", "Nacht" }
|
||||
};
|
||||
|
||||
public Heater(Dictionary<String, String> settings, ADataBackend data) : base(settings, data) {
|
||||
this.targetTemp = new TextBlock {
|
||||
@ -30,6 +37,9 @@ namespace BlubbFish.House.Dashboard.Graphics {
|
||||
this.topic = this.settings["topic"];
|
||||
this.data.MessageIncomming += this.Data_MessageIncomming;
|
||||
this.data.Send(this.topic + "/0/49/1/get", "");
|
||||
this.data.Send(this.topic + "/0/64/get", "");
|
||||
this.data.Send(this.topic + "/0/67/1/get", "");
|
||||
this.data.Send(this.topic + "/0/67/11/get", "");
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,10 +56,58 @@ namespace BlubbFish.House.Dashboard.Graphics {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e.Topic == this.topic + "/0/64") {
|
||||
if (j.Keys.Contains("ValidModes") && j["ValidModes"].IsObject && this.modes.Count == 0) {
|
||||
foreach (String item in j["ValidModes"].Keys) {
|
||||
if (Int32.TryParse(item, out Int32 jvmode)) {
|
||||
this.modes.Add(jvmode, j["ValidModes"][item].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (j.Keys.Contains("Level")) {
|
||||
if (Int32.TryParse(j["Level"].ToString(), out Int32 jmode) && this.modes.ContainsKey(jmode)) {
|
||||
this.activemode = jmode;
|
||||
String text = this.modes[jmode];
|
||||
if (this.replace.ContainsKey(text)) {
|
||||
text = this.replace[text];
|
||||
}
|
||||
this.now.Dispatcher.BeginInvoke((Action)(() => {
|
||||
this.mode.Text = text;
|
||||
}));
|
||||
this.WriteTargetTemp();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e.Topic == this.topic + "/0/67/1" || e.Topic == this.topic + "/0/67/11") {
|
||||
if (j.Keys.Contains("Level")) {
|
||||
if (Double.TryParse(j["Level"].ToString(), out Double temp)) {
|
||||
Int32 id = 0;
|
||||
if (e.Topic.EndsWith("/1")) {
|
||||
id = 1;
|
||||
} else if (e.Topic.EndsWith("/11")) {
|
||||
id = 11;
|
||||
}
|
||||
if (this.targetTemps.ContainsKey(id)) {
|
||||
this.targetTemps[id] = temp;
|
||||
} else {
|
||||
this.targetTemps.Add(id, temp);
|
||||
}
|
||||
this.WriteTargetTemp();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteTargetTemp() {
|
||||
if (this.targetTemps.ContainsKey(this.activemode)) {
|
||||
this.now.Dispatcher.BeginInvoke((Action)(() => {
|
||||
this.targetTemp.Text = this.targetTemps[this.activemode] + " °C";
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
public override Grid Draw() {
|
||||
Grid outergrid = this.CreateOuterGrid();
|
||||
outergrid.Children.Add(this.CreateInnerGrid());
|
||||
|
@ -5,13 +5,13 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:House_Dashboard"
|
||||
mc:Ignorable="d"
|
||||
Title="Dashboard" WindowState="Maximized" Topmost="True" WindowStyle="None" Height="600" Width="800">
|
||||
Title="Dashboard" WindowState="Maximized" Topmost="True" WindowStyle="None" Height="600" Width="800" Name="myWindow">
|
||||
<Grid>
|
||||
<TabControl x:Name="tabs" Padding="0" Margin="0,0,0,26">
|
||||
<TabItem Header="Home" FontSize="20">
|
||||
<Grid Background="#FFE5E5E5">
|
||||
<Image Source="E:\Eigene Dateien\Dokumente\Visual Studio 2017\Projects\House-Dashboard\House-Dashboard\bin\Debug\Images\Grundriss.png"/>
|
||||
<Grid HorizontalAlignment="Left" Margin="20,87,0,0" VerticalAlignment="Top">
|
||||
<Grid HorizontalAlignment="Left" Margin="105,87,0,0" VerticalAlignment="Top">
|
||||
<Grid.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform/>
|
||||
@ -76,5 +76,12 @@
|
||||
<Button Content="Beenden" Click="ApplicationShutdown"/>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
<Popup PlacementTarget="{Binding ElementName=myWindow}" Placement="Center" PopupAnimation="Slide" IsOpen="True">
|
||||
<Grid Background="White">
|
||||
<Border BorderBrush="Black" BorderThickness="1"/>
|
||||
<TextBlock Text="asdasdasd"/>
|
||||
|
||||
</Grid>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
Loading…
Reference in New Issue
Block a user