diff --git a/Zway/Devices/CommandClasses/Battery.cs b/Zway/Devices/CommandClasses/Battery.cs index 9b18f83..54fb186 100644 --- a/Zway/Devices/CommandClasses/Battery.cs +++ b/Zway/Devices/CommandClasses/Battery.cs @@ -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)); } } diff --git a/Zway/Devices/CommandClasses/CentralScene.cs b/Zway/Devices/CommandClasses/CentralScene.cs index 74eea93..15535a3 100644 --- a/Zway/Devices/CommandClasses/CentralScene.cs +++ b/Zway/Devices/CommandClasses/CentralScene.cs @@ -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(this.Scene, this.Key), this.LastUpdate)); + this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple(this.Scene, this.Key), this.LastUpdate, this)); } } else { Helper.WriteError("Kenne in " + this.Name + " [" + this.Id + "] " + match.Groups[4].Value + " nicht!"); diff --git a/Zway/Devices/CommandClasses/CommandClassSubs/Configurationsub.cs b/Zway/Devices/CommandClasses/CommandClassSubs/Configurationsub.cs index b91b3d8..022f1f7 100644 --- a/Zway/Devices/CommandClasses/CommandClassSubs/Configurationsub.cs +++ b/Zway/Devices/CommandClasses/CommandClassSubs/Configurationsub.cs @@ -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(this.Level, this.Size), this.LastUpdate)); + this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple(this.Level, this.Size), this.LastUpdate, this)); } } diff --git a/Zway/Devices/CommandClasses/CommandClassSubs/MeterSub.cs b/Zway/Devices/CommandClasses/CommandClassSubs/MeterSub.cs index bfd0c0a..3527205 100644 --- a/Zway/Devices/CommandClasses/CommandClassSubs/MeterSub.cs +++ b/Zway/Devices/CommandClasses/CommandClassSubs/MeterSub.cs @@ -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(this.Type, this.Scale, this.Level), this.LastUpdate)); + this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple(this.Type, this.Scale, this.Level), this.LastUpdate, this)); } } diff --git a/Zway/Devices/CommandClasses/CommandClassSubs/SensorMultilevelSub.cs b/Zway/Devices/CommandClasses/CommandClassSubs/SensorMultilevelSub.cs index e7b9a31..3aaa04a 100644 --- a/Zway/Devices/CommandClasses/CommandClassSubs/SensorMultilevelSub.cs +++ b/Zway/Devices/CommandClasses/CommandClassSubs/SensorMultilevelSub.cs @@ -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(this.Type, this.Scale, this.Level), this.LastUpdate)); + this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple(this.Type, this.Scale, this.Level), this.LastUpdate, this)); } } diff --git a/Zway/Devices/CommandClasses/CommandClassSubs/ThermostatSetPointSub.cs b/Zway/Devices/CommandClasses/CommandClassSubs/ThermostatSetPointSub.cs index 7b1dc41..5702100 100644 --- a/Zway/Devices/CommandClasses/CommandClassSubs/ThermostatSetPointSub.cs +++ b/Zway/Devices/CommandClasses/CommandClassSubs/ThermostatSetPointSub.cs @@ -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(this.Type, this.Scale, this.Level, this.TempMin, this.TempMax, this.HasMinMax), this.LastUpdate)); + this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple(this.Type, this.Scale, this.Level, this.TempMin, this.TempMax, this.HasMinMax), this.LastUpdate, this)); } } diff --git a/Zway/Devices/CommandClasses/Configuration.cs b/Zway/Devices/CommandClasses/Configuration.cs index d4bdfcf..bc44751 100644 --- a/Zway/Devices/CommandClasses/Configuration.cs +++ b/Zway/Devices/CommandClasses/Configuration.cs @@ -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) { diff --git a/Zway/Devices/CommandClasses/Indicator.cs b/Zway/Devices/CommandClasses/Indicator.cs index b25ef32..b068258 100644 --- a/Zway/Devices/CommandClasses/Indicator.cs +++ b/Zway/Devices/CommandClasses/Indicator.cs @@ -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!"); diff --git a/Zway/Devices/CommandClasses/Meter.cs b/Zway/Devices/CommandClasses/Meter.cs index f27f987..49cd895 100644 --- a/Zway/Devices/CommandClasses/Meter.cs +++ b/Zway/Devices/CommandClasses/Meter.cs @@ -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) { diff --git a/Zway/Devices/CommandClasses/SensorMultilevel.cs b/Zway/Devices/CommandClasses/SensorMultilevel.cs index 0022d59..26df0da 100644 --- a/Zway/Devices/CommandClasses/SensorMultilevel.cs +++ b/Zway/Devices/CommandClasses/SensorMultilevel.cs @@ -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) { diff --git a/Zway/Devices/CommandClasses/SwitchBinary.cs b/Zway/Devices/CommandClasses/SwitchBinary.cs index b3d195c..84465ed 100644 --- a/Zway/Devices/CommandClasses/SwitchBinary.cs +++ b/Zway/Devices/CommandClasses/SwitchBinary.cs @@ -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!"); diff --git a/Zway/Devices/CommandClasses/SwitchMultilevel.cs b/Zway/Devices/CommandClasses/SwitchMultilevel.cs index 3f3e571..525bc26 100644 --- a/Zway/Devices/CommandClasses/SwitchMultilevel.cs +++ b/Zway/Devices/CommandClasses/SwitchMultilevel.cs @@ -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 { diff --git a/Zway/Devices/CommandClasses/ThermostatMode.cs b/Zway/Devices/CommandClasses/ThermostatMode.cs index 423a1bd..6362ac4 100644 --- a/Zway/Devices/CommandClasses/ThermostatMode.cs +++ b/Zway/Devices/CommandClasses/ThermostatMode.cs @@ -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!"); diff --git a/Zway/Devices/CommandClasses/ThermostatSetPoint.cs b/Zway/Devices/CommandClasses/ThermostatSetPoint.cs index d1080c4..1e38eac 100644 --- a/Zway/Devices/CommandClasses/ThermostatSetPoint.cs +++ b/Zway/Devices/CommandClasses/ThermostatSetPoint.cs @@ -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) { diff --git a/Zway/Devices/CommandClasses/Wakeup.cs b/Zway/Devices/CommandClasses/Wakeup.cs index 9c2e77f..17ae0a0 100644 --- a/Zway/Devices/CommandClasses/Wakeup.cs +++ b/Zway/Devices/CommandClasses/Wakeup.cs @@ -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)); } } diff --git a/Zway/Devices/Device.cs b/Zway/Devices/Device.cs index 3db3d91..be64774 100644 --- a/Zway/Devices/Device.cs +++ b/Zway/Devices/Device.cs @@ -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) { diff --git a/Zway/Devices/Instance.cs b/Zway/Devices/Instance.cs index 9e70fee..e796f82 100644 --- a/Zway/Devices/Instance.cs +++ b/Zway/Devices/Instance.cs @@ -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) { diff --git a/Zway/Events/DeviceUpdateEvent.cs b/Zway/Events/DeviceUpdateEvent.cs index ab6f92d..a586143 100644 --- a/Zway/Events/DeviceUpdateEvent.cs +++ b/Zway/Events/DeviceUpdateEvent.cs @@ -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 value, DateTime time) { + public DeviceUpdateEvent(Tuple value, DateTime time, Object parent) { this.GetStringStringSingleTuple = value; this.UpdateTime = time; + this.Parent = parent; } - public DeviceUpdateEvent(Tuple value, DateTime time) { + public DeviceUpdateEvent(Tuple value, DateTime time, Object parent) { this.GetStringStringSingleSingleSingleSingleBooleanTuple = value; this.UpdateTime = time; + this.Parent = parent; } - public DeviceUpdateEvent(Tuple value, DateTime time) { + public DeviceUpdateEvent(Tuple value, DateTime time, Object parent) { this.GetIntegerTuple = value; this.UpdateTime = time; + this.Parent = parent; } - public DeviceUpdateEvent(Tuple value, DateTime time) { + public DeviceUpdateEvent(Tuple 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 GetStringStringSingleSingleSingleSingleBooleanTuple { get; } public Tuple GetLongIntegerTuple { get; } public DateTime UpdateTime { get; } + public Object Parent { get; private set; } public Boolean GetBoolean { get; } public Tuple GetIntegerTuple { get; } } diff --git a/Zway/bin/Release/Zway.dll b/Zway/bin/Release/Zway.dll index 07dcbdf..ba3f468 100644 Binary files a/Zway/bin/Release/Zway.dll and b/Zway/bin/Release/Zway.dll differ