[NF] Now possible to emulate F4G

This commit is contained in:
BlubbFish 2017-12-05 23:10:52 +00:00
parent 53e4ba9d14
commit 06e57c4559
19 changed files with 32 additions and 24 deletions

View File

@ -37,7 +37,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
Helper.WriteError("Kenne in "+this.Name+" ["+this.Id+"] "+ match.Groups[4].Value+" nicht!");
}
if (success && this.CheckSetUpdateTime(json)) {
this.Update?.Invoke(this, new DeviceUpdateEvent(this.Level, this.LastUpdate));
this.Update?.Invoke(this, new DeviceUpdateEvent(this.Level, this.LastUpdate, this));
}
}

View File

@ -31,7 +31,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
} else if (match.Groups[4].Value == ".data.keyAttribute") {
if (json.Keys.Contains("value") && this.CheckSetUpdateTime(json)) {
this.Key = Int32.Parse(json["value"].ToString());
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<Int32, Int32>(this.Scene, this.Key), this.LastUpdate));
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<Int32, Int32>(this.Scene, this.Key), this.LastUpdate, this));
}
} else {
Helper.WriteError("Kenne in " + this.Name + " [" + this.Id + "] " + match.Groups[4].Value + " nicht!");

View File

@ -54,7 +54,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
this.CheckSetUpdateTime(json)) {
this._level = Int64.Parse(json["val"]["value"].ToString());
this.Size = Int32.Parse(json["size"]["value"].ToString());
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<Int64, Int32>(this.Level, this.Size), this.LastUpdate));
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<Int64, Int32>(this.Level, this.Size), this.LastUpdate, this));
}
}

View File

@ -41,7 +41,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
this.Level = Single.Parse(json["val"]["value"].ToString());
this.Type = json["sensorTypeString"]["value"].ToString();
this.Scale = json["scaleString"]["value"].ToString();
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Single>(this.Type, this.Scale, this.Level), this.LastUpdate));
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Single>(this.Type, this.Scale, this.Level), this.LastUpdate, this));
}
}

View File

@ -37,7 +37,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
this.Level = Single.Parse(json["val"]["value"].ToString());
this.Type = json["sensorTypeString"]["value"].ToString();
this.Scale = json["scaleString"]["value"].ToString();
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Single>(this.Type, this.Scale, this.Level), this.LastUpdate));
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Single>(this.Type, this.Scale, this.Level), this.LastUpdate, this));
}
}

View File

@ -70,7 +70,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
this.HasMinMax = false;
}
if (ret && this.CheckSetUpdateTime(json)) {
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Single, Single, Single, Boolean>(this.Type, this.Scale, this.Level, this.TempMin, this.TempMax, this.HasMinMax), this.LastUpdate));
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Single, Single, Single, Boolean>(this.Type, this.Scale, this.Level, this.TempMin, this.TempMax, this.HasMinMax), this.LastUpdate, this));
}
}

View File

@ -24,7 +24,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
}
private void DeviceUpdate(Object sender, DeviceUpdateEvent e) {
this.Update?.Invoke(sender, e);
this.Update?.Invoke(this, e);
}
private void InitComplex(JsonData json) {

View File

@ -36,7 +36,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
if(match.Groups[4].Value == ".data.stat") {
if (json.Keys.Contains("value") && this.CheckSetUpdateTime(json)) {
this._level = Int32.Parse(json["value"].ToString()) == 255;
this.Update?.Invoke(this, new DeviceUpdateEvent(this.Level, this.LastUpdate));
this.Update?.Invoke(this, new DeviceUpdateEvent(this.Level, this.LastUpdate, this));
}
} else {
Helper.WriteError("Kenne in " + this.Name + " [" + this.Id + "] " + match.Groups[4].Value + " nicht!");

View File

@ -26,7 +26,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
}
private void DeviceUpdate(Object sender, DeviceUpdateEvent e) {
this.Update?.Invoke(sender, e);
this.Update?.Invoke(this, e);
}
internal override void SetUpdate(JsonData json, Match match) {

View File

@ -26,7 +26,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
}
private void DeviceUpdate(Object sender, DeviceUpdateEvent e) {
this.Update?.Invoke(sender, e);
this.Update?.Invoke(this, e);
}
internal override void SetUpdate(JsonData json, Match match) {

View File

@ -31,7 +31,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
if(match.Groups[4].Value == ".data.level") {
if (json.Keys.Contains("value") && json["value"].IsBoolean && this.CheckSetUpdateTime(json)) {
this._level = (Boolean)json["value"];
this.Update?.Invoke(this, new DeviceUpdateEvent(this.Level, this.LastUpdate));
this.Update?.Invoke(this, new DeviceUpdateEvent(this.Level, this.LastUpdate, this));
}
} else {
Helper.WriteError("Kenne in " + this.Name + " [" + this.Id + "] " + match.Groups[4].Value + " nicht!");

View File

@ -33,7 +33,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
if(match.Groups[4].Value == ".data.level") {
if(json.Keys.Contains("value") && this.CheckSetUpdateTime(json)) {
this._level = Int32.Parse(json["value"].ToString());
this.Update?.Invoke(this, new DeviceUpdateEvent(this.Level, this.LastUpdate));
this.Update?.Invoke(this, new DeviceUpdateEvent(this.Level, this.LastUpdate, this));
}
} else if (match.Groups[4].Value == ".data.prevLevel") {
} else {

View File

@ -35,7 +35,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
if(match.Groups[4].Value == ".data.mode") {
if(json.Keys.Contains("value") && this.CheckSetUpdateTime(json)) {
this._level = Int32.Parse(json["value"].ToString());
this.Update?.Invoke(this, new DeviceUpdateEvent(this.Level, this.LastUpdate));
this.Update?.Invoke(this, new DeviceUpdateEvent(this.Level, this.LastUpdate, this));
}
} else {
Helper.WriteError("Kenne in " + this.Name + " [" + this.Id + "] " + match.Groups[4].Value + " nicht!");

View File

@ -25,7 +25,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
}
private void DeviceUpdate(Object sender, DeviceUpdateEvent e) {
this.Update?.Invoke(sender, e);
this.Update?.Invoke(this, e);
}
internal override void SetUpdate(JsonData json, Match match) {

View File

@ -113,7 +113,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
Helper.WriteError("Kenne in " + this.Name + " [" + this.Id + "] " + match.Groups[4].Value + " nicht!");
}
if (success && this.CheckSetUpdateTime(json)) {
this.Update?.Invoke(this, new DeviceUpdateEvent(0, this.LastUpdate));
this.Update?.Invoke(this, new DeviceUpdateEvent(0, this.LastUpdate, this));
}
}

View File

@ -47,7 +47,7 @@ namespace BlubbFish.IoT.Zway.Devices {
}
private void InstanceUpdate(Object sender, DeviceUpdateEvent e) {
this.Update?.Invoke(sender, e);
this.Update?.Invoke(this, e);
}
private void CreateInstances(JsonData json, HttpConnection http) {

View File

@ -38,7 +38,7 @@ namespace BlubbFish.IoT.Zway.Devices {
}
private void ClassUpdate(Object sender, DeviceUpdateEvent e) {
this.Update?.Invoke(sender, e);
this.Update?.Invoke(this, e);
}
private void CreateInstances(JsonData json, HttpConnection http) {

View File

@ -10,38 +10,45 @@ namespace BlubbFish.IoT.Zway.Events {
public DeviceUpdateEvent() {
}
public DeviceUpdateEvent(Single value, DateTime time) {
public DeviceUpdateEvent(Single value, DateTime time, Object parent) {
this.GetSingle = value;
this.UpdateTime = time;
this.Parent = parent;
}
public DeviceUpdateEvent(Boolean value, DateTime time) {
public DeviceUpdateEvent(Boolean value, DateTime time, Object parent) {
this.GetBoolean = value;
this.UpdateTime = time;
this.Parent = parent;
}
public DeviceUpdateEvent(DateTime value, DateTime time) {
public DeviceUpdateEvent(DateTime value, DateTime time, Object parent) {
this.GetDate = value;
this.UpdateTime = time;
this.Parent = parent;
}
public DeviceUpdateEvent(Tuple<String, String, Single> value, DateTime time) {
public DeviceUpdateEvent(Tuple<String, String, Single> value, DateTime time, Object parent) {
this.GetStringStringSingleTuple = value;
this.UpdateTime = time;
this.Parent = parent;
}
public DeviceUpdateEvent(Tuple<String, String, Single, Single, Single, Boolean> value, DateTime time) {
public DeviceUpdateEvent(Tuple<String, String, Single, Single, Single, Boolean> value, DateTime time, Object parent) {
this.GetStringStringSingleSingleSingleSingleBooleanTuple = value;
this.UpdateTime = time;
this.Parent = parent;
}
public DeviceUpdateEvent(Tuple<Int32, Int32> value, DateTime time) {
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) {
public DeviceUpdateEvent(Tuple<Int64, Int32> value, DateTime time, Object parent) {
this.GetLongIntegerTuple = value;
this.UpdateTime = time;
this.Parent = parent;
}
public Single GetSingle { get; }
@ -50,6 +57,7 @@ namespace BlubbFish.IoT.Zway.Events {
public Tuple<String, String, Single, Single, Single, Boolean> GetStringStringSingleSingleSingleSingleBooleanTuple { get; }
public Tuple<Int64, Int32> GetLongIntegerTuple { get; }
public DateTime UpdateTime { get; }
public Object Parent { get; private set; }
public Boolean GetBoolean { get; }
public Tuple<Int32,Int32> GetIntegerTuple { get; }
}

Binary file not shown.