Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08047db287 | ||
|
|
f406b09ffa | ||
|
|
0834e09178 |
@@ -54,7 +54,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level },
|
||||
{ "Level", this.Level },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "scene", this.Scene },
|
||||
{ "key", this.Key },
|
||||
{ "Scene", this.Scene },
|
||||
{ "Key", this.Key },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level },
|
||||
{ "size", this.Size },
|
||||
{ "Level", this.Level },
|
||||
{ "Size", this.Size },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level },
|
||||
{ "type", this.Type },
|
||||
{ "scale", this.Scale },
|
||||
{ "Level", this.Level },
|
||||
{ "Type", this.Type },
|
||||
{ "Scale", this.Scale },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using BlubbFish.IoT.Zway.Events;
|
||||
using BlubbFish.IoT.Zway.Interfaces;
|
||||
using BlubbFish.IoT.Zway.lib;
|
||||
using LitJson;
|
||||
|
||||
namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
public class Sensorbinarysub : ACommandClass {
|
||||
public override event UpdatedValue Update;
|
||||
|
||||
public String Type { get; private set; }
|
||||
public Boolean Level { get; private set; }
|
||||
public Sensorbinarysub(JsonData json, Tuple<Int32, Int32, Classes, Int32> id, HttpConnection http, Boolean polling) : base(json, id, http, polling) {
|
||||
this.HasReset = true;
|
||||
this.IsSub = true;
|
||||
InitComplex(json);
|
||||
}
|
||||
|
||||
private void InitComplex(JsonData json) {
|
||||
if (json.Keys.Contains("sensorTypeString") &&
|
||||
json["sensorTypeString"].Keys.Contains("value") &&
|
||||
json.Keys.Contains("level") &&
|
||||
json["level"].Keys.Contains("value")) {
|
||||
this.Type = json["sensorTypeString"]["value"].ToString();
|
||||
this.Level = (Boolean)json["level"]["value"];
|
||||
}
|
||||
}
|
||||
|
||||
internal override void SetUpdate(JsonData json, Match match) {
|
||||
if (json.Keys.Contains("level") && json["level"].Keys.Contains("value") &&
|
||||
json.Keys.Contains("sensorTypeString") && json["sensorTypeString"].Keys.Contains("value") &&
|
||||
this.CheckSetUpdateTime(json)) {
|
||||
this.Level = (Boolean)json["level"]["value"];
|
||||
this.Type = json["sensorTypeString"]["value"].ToString();
|
||||
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, Boolean>(this.Type, this.Level), this.LastUpdate, this));
|
||||
}
|
||||
}
|
||||
|
||||
public override String ToString() {
|
||||
return "SensorBinary " + this.Name + " [" + this.Id + "]: " + this.Type + " " + this.Level.ToString();
|
||||
}
|
||||
|
||||
internal override void Poll() => this.PollNone();
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "Level", this.Level },
|
||||
{ "Type", this.Type }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,9 +52,9 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level },
|
||||
{ "type", this.Type },
|
||||
{ "scale", this.Scale },
|
||||
{ "Level", this.Level },
|
||||
{ "Type", this.Type },
|
||||
{ "Scale", this.Scale },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,12 +82,12 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level },
|
||||
{ "type", this.Type },
|
||||
{ "scale", this.Scale },
|
||||
{ "tempmax", this.TempMax },
|
||||
{ "tempmin", this.TempMin },
|
||||
{ "hasminmax", this.HasMinMax },
|
||||
{ "Level", this.Level },
|
||||
{ "Type", this.Type },
|
||||
{ "Scale", this.Scale },
|
||||
{ "TempMax", this.TempMax },
|
||||
{ "TempMin", this.TempMin },
|
||||
{ "HasMinMax", this.HasMinMax },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level },
|
||||
{ "Level", this.Level },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text.RegularExpressions;
|
||||
using BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs;
|
||||
using BlubbFish.IoT.Zway.Events;
|
||||
using BlubbFish.IoT.Zway.Interfaces;
|
||||
using BlubbFish.IoT.Zway.lib;
|
||||
using LitJson;
|
||||
|
||||
namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
/// <summary>
|
||||
/// 48 = SensorBinary
|
||||
/// </summary>
|
||||
public class Sensorbinary : ACommandClass {
|
||||
public override event UpdatedValue Update;
|
||||
|
||||
public Sensorbinary(JsonData json, Tuple<Int32, Int32, Classes> id, HttpConnection http, Boolean polling) : base(json, id, http, polling) {
|
||||
this.HasSub = true;
|
||||
this.InitComplex(json);
|
||||
foreach (KeyValuePair<Int32, ACommandClass> item in this.Sub) {
|
||||
item.Value.Update += this.DeviceUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
private void DeviceUpdate(Object sender, DeviceUpdateEvent e) {
|
||||
this.Update?.Invoke(this, e);
|
||||
}
|
||||
|
||||
internal override void SetUpdate(JsonData json, Match match) {
|
||||
if (match.Groups[4].Value.StartsWith(".data.")) {
|
||||
Int32 subid = Int32.Parse(match.Groups[5].Value);
|
||||
if (this.Sub.ContainsKey(subid)) {
|
||||
this.Sub[subid].SetUpdate(json, match);
|
||||
}
|
||||
} else {
|
||||
Helper.WriteError("Kenne in " + this.Name + " [" + this.Id + "] " + match.Groups[4].Value + " nicht!");
|
||||
}
|
||||
}
|
||||
|
||||
private void InitComplex(JsonData json) {
|
||||
if (json.Keys.Contains("data")) {
|
||||
JsonData data = json["data"];
|
||||
Dictionary<Int32, ACommandClass> subs = new Dictionary<Int32, ACommandClass>();
|
||||
foreach (String item in data.Keys) {
|
||||
if (Int32.TryParse(item, out Int32 subid) &&
|
||||
data[item].Keys.Contains("sensorTypeString") &&
|
||||
data[item].Keys.Contains("level")) {
|
||||
subs.Add(subid, new Sensorbinarysub(data[item], new Tuple<Int32, Int32, Classes, Int32>(this.DeviceId, this.Instance, this.Commandclass, subid), this.http, this.Polling));
|
||||
}
|
||||
}
|
||||
this.Sub = new ReadOnlyDictionary<Int32, ACommandClass>(subs);
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Poll() => this.PollSubGlobal();
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() => this.ToDictionarySub();
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level }
|
||||
{ "Level", this.Level }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level }
|
||||
{ "Level", this.Level }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
modes.Add(item.Key.ToString(), item.Value);
|
||||
}
|
||||
Dictionary<String, Object> json = new Dictionary<String, Object> {
|
||||
{ "level", this.Level },
|
||||
{ "modes", modes }
|
||||
{ "Level", this.Level },
|
||||
{ "ValidModes", modes }
|
||||
};
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -124,13 +124,13 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{"interval", this.Interval },
|
||||
{"againstnode", this.AgainstNode },
|
||||
{ "wakeupmin", this.WakeupMin },
|
||||
{ "wakeupmax", this.WakeupMax },
|
||||
{ "wakeupdefault", this.WakeupDefault },
|
||||
{ "lastwakeup", this.LastWakeup.ToString() },
|
||||
{ "lastsleep", this.LastSleep.ToString() }
|
||||
{ "Interval", this.Interval },
|
||||
{ "AgainstNode", this.AgainstNode },
|
||||
{ "WakeupMin", this.WakeupMin },
|
||||
{ "WakeupMax", this.WakeupMax },
|
||||
{ "WakeupDefault", this.WakeupDefault },
|
||||
{ "LastWakeup", this.LastWakeup.ToString() },
|
||||
{ "LastSleep", this.LastSleep.ToString() }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,55 +10,14 @@ namespace BlubbFish.IoT.Zway.Events {
|
||||
public DeviceUpdateEvent() {
|
||||
}
|
||||
|
||||
public DeviceUpdateEvent(Double value, DateTime time, Object parent) {
|
||||
this.GetDouble = value;
|
||||
public DeviceUpdateEvent(Object value, DateTime time, Object parent) {
|
||||
this.GetValue = value;
|
||||
this.UpdateTime = time;
|
||||
this.Parent = parent;
|
||||
}
|
||||
|
||||
public DeviceUpdateEvent(Boolean value, DateTime time, Object parent) {
|
||||
this.GetBoolean = value;
|
||||
this.UpdateTime = time;
|
||||
this.Parent = parent;
|
||||
}
|
||||
|
||||
public DeviceUpdateEvent(DateTime value, DateTime time, Object parent) {
|
||||
this.GetDate = value;
|
||||
this.UpdateTime = time;
|
||||
this.Parent = parent;
|
||||
}
|
||||
|
||||
public DeviceUpdateEvent(Tuple<String, String, Double> value, DateTime time, Object parent) {
|
||||
this.GetStringStringDoubleTuple = value;
|
||||
this.UpdateTime = time;
|
||||
this.Parent = parent;
|
||||
}
|
||||
public DeviceUpdateEvent(Tuple<String, String, Double, Double, Double, Boolean> value, DateTime time, Object parent) {
|
||||
this.GetStringStringDoubleDoubleDoubleDoubleBooleanTuple = value;
|
||||
this.UpdateTime = time;
|
||||
this.Parent = parent;
|
||||
}
|
||||
|
||||
public DeviceUpdateEvent(Tuple<Int32, Int32> value, DateTime time, Object parent) {
|
||||
this.GetIntegerTuple = value;
|
||||
this.UpdateTime = time;
|
||||
this.Parent = parent;
|
||||
}
|
||||
|
||||
public DeviceUpdateEvent(Tuple<Int64, Int32> value, DateTime time, Object parent) {
|
||||
this.GetLongIntegerTuple = value;
|
||||
this.UpdateTime = time;
|
||||
this.Parent = parent;
|
||||
}
|
||||
|
||||
public Double GetDouble { get; }
|
||||
public DateTime GetDate { get; }
|
||||
public Tuple<String, String, Double> GetStringStringDoubleTuple { get; }
|
||||
public Tuple<String, String, Double, Double, Double, Boolean> GetStringStringDoubleDoubleDoubleDoubleBooleanTuple { get; }
|
||||
public Tuple<Int64, Int32> GetLongIntegerTuple { get; }
|
||||
public Object GetValue { get; }
|
||||
public DateTime UpdateTime { get; }
|
||||
public Object Parent { get; private set; }
|
||||
public Boolean GetBoolean { get; }
|
||||
public Tuple<Int32,Int32> GetIntegerTuple { get; }
|
||||
}
|
||||
}
|
||||
@@ -213,9 +213,9 @@ namespace BlubbFish.IoT.Zway.Interfaces {
|
||||
|
||||
public String ToJson() {
|
||||
Dictionary<String, Object> json = this.ToDictionary();
|
||||
json.Add("date", this.LastUpdate.ToString());
|
||||
json.Add("name", this.Name);
|
||||
json.Add("class", this.Commandclass.ToString());
|
||||
json.Add("LastUpdate", this.LastUpdate.ToString());
|
||||
json.Add("Name", this.Name);
|
||||
json.Add("Commandclass", this.Commandclass.ToString());
|
||||
return JsonMapper.ToJson(json);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
// indem Sie "*" wie unten gezeigt eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.3.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.3.0")]
|
||||
[assembly: AssemblyVersion("1.3.4.1")]
|
||||
[assembly: AssemblyFileVersion("1.3.4.1")]
|
||||
|
||||
@@ -45,12 +45,14 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Devices\CommandClasses\Battery.cs" />
|
||||
<Compile Include="Devices\CommandClasses\CommandClassSubs\Configurationsub.cs" />
|
||||
<Compile Include="Devices\CommandClasses\CommandClassSubs\SensorBinarySub.cs" />
|
||||
<Compile Include="Devices\CommandClasses\CommandClassSubs\ThermostatSetPointSub.cs" />
|
||||
<Compile Include="Devices\CommandClasses\Configuration.cs" />
|
||||
<Compile Include="Devices\CommandClasses\Indicator.cs" />
|
||||
<Compile Include="Devices\CommandClasses\Meter.cs" />
|
||||
<Compile Include="Devices\CommandClasses\CommandClassSubs\MeterSub.cs" />
|
||||
<Compile Include="Devices\CommandClasses\CommandClassSubs\SensorMultilevelSub.cs" />
|
||||
<Compile Include="Devices\CommandClasses\SensorBinary.cs" />
|
||||
<Compile Include="Devices\CommandClasses\Wakeup.cs" />
|
||||
<Compile Include="Devices\Device.cs" />
|
||||
<Compile Include="Interfaces\ACommandClass.cs" />
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user