diff --git a/Zway-Bot.sln b/Zway-Bot.sln index ceb42e9..33f6814 100644 --- a/Zway-Bot.sln +++ b/Zway-Bot.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils\IoT\U EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorDataMosquitto", "..\Utils\IoT\Connector\Data\Mosquitto\ConnectorDataMosquitto.csproj", "{39235FAD-BA9D-4B51-82FC-6969967BEAE9}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorDataMqtt", "..\Utils\IoT\Connector\Data\Mqtt\ConnectorDataMqtt.csproj", "{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {39235FAD-BA9D-4B51-82FC-6969967BEAE9}.Debug|Any CPU.Build.0 = Debug|Any CPU {39235FAD-BA9D-4B51-82FC-6969967BEAE9}.Release|Any CPU.ActiveCfg = Release|Any CPU {39235FAD-BA9D-4B51-82FC-6969967BEAE9}.Release|Any CPU.Build.0 = Release|Any CPU + {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Zway-Bot/Events.cs b/Zway-Bot/Events.cs index a252d5c..3dfdbfc 100644 --- a/Zway-Bot/Events.cs +++ b/Zway-Bot/Events.cs @@ -39,6 +39,34 @@ namespace ZwayBot { } } + public class MqttEvent : ModulEventArgs { + public MqttEvent() { + } + public MqttEvent(String topic, String text) { + this.Address = topic; + this.Value = text; + this.Source = "MQTT"; + } + public override String ToString() { + return this.Source + ": on " + this.Address + " set " + this.Value; + } + } + + public class StatusPollingEvent : ModulEventArgs { + public StatusPollingEvent() { + } + + public StatusPollingEvent(String text, String node) { + this.Value = text; + this.Address = node; + this.Source = "POLLING"; + } + + public override String ToString() { + return this.Source + ": " + this.Value + " on " + this.Address; + } + } + public class ModulEventArgs : EventArgs { public ModulEventArgs() { } diff --git a/Zway-Bot/Helper.cs b/Zway-Bot/Helper.cs index 9fedb8f..a368d16 100644 --- a/Zway-Bot/Helper.cs +++ b/Zway-Bot/Helper.cs @@ -2,8 +2,8 @@ using System.Reflection; namespace ZwayBot { - class Helper { - public static void SetProperty(Object o, String name, String value) { + static class Helper { + public static void SetProperty(this Object o, String name, String value) { PropertyInfo prop = o.GetType().GetProperty(name); if (prop.CanWrite) { if (prop.PropertyType == typeof(Boolean) && Boolean.TryParse(value, out Boolean vb)) { @@ -17,7 +17,8 @@ namespace ZwayBot { } } } - public static Boolean HasProperty(Object o, String type) { + + internal static Boolean HasProperty(this Object o, String type) { Type t = o.GetType(); foreach (PropertyInfo item in t.GetProperties()) { if (item.Name == type) { @@ -27,7 +28,7 @@ namespace ZwayBot { return false; } - internal static Object GetProperty(Object o, String name) { + internal static Object GetProperty(this Object o, String name) { PropertyInfo prop = o.GetType().GetProperty(name); if(prop.CanRead) { return prop.GetValue(o); @@ -35,9 +36,15 @@ namespace ZwayBot { return null; } - internal static Boolean HasInterface(Object o, String type) { - Type t = o.GetType(); - foreach (Type item in t.GetInterfaces()) { + internal static Boolean HasAbstract(this Object o, Type type) { + if(o.GetType().BaseType == type) { + return true; + } + return false; + } + + internal static Boolean HasInterface(this Type o, String type) { + foreach (Type item in o.GetInterfaces()) { if(item.Name == type) { return true; } diff --git a/Zway-Bot/Interfaces/IForceLoad.cs b/Zway-Bot/Interfaces/IForceLoad.cs new file mode 100644 index 0000000..3fb24f9 --- /dev/null +++ b/Zway-Bot/Interfaces/IForceLoad.cs @@ -0,0 +1,4 @@ +namespace ZwayBot.Interfaces { + interface IForceLoad { + } +} diff --git a/Zway-Bot/Moduls/AModul.cs b/Zway-Bot/Moduls/AModul.cs index 9c7c161..38bcfdf 100644 --- a/Zway-Bot/Moduls/AModul.cs +++ b/Zway-Bot/Moduls/AModul.cs @@ -8,21 +8,18 @@ namespace ZwayBot { protected ZwayController zw; protected InIReader ini; + public delegate void ModulEvent(Object sender, ModulEventArgs e); + public abstract event ModulEvent Update; + public AModul(ZwayController zway, InIReader settings) { this.zw = zway; this.ini = settings; } - public delegate void ModulEvent(Object sender, ModulEventArgs e); - public abstract event ModulEvent Update; + public virtual void Interconnect(Dictionary moduls) { } + + public virtual void SetInterconnection(String param, Action hook, Object data) { } public abstract void Dispose(); - public virtual void Interconnect(Dictionary moduls) { - - } - - public virtual void SetInterconnection(String param, Action hook) { - - } } } diff --git a/Zway-Bot/Moduls/CronJob.cs b/Zway-Bot/Moduls/CronJob.cs index bae6d58..b5f734d 100644 --- a/Zway-Bot/Moduls/CronJob.cs +++ b/Zway-Bot/Moduls/CronJob.cs @@ -6,12 +6,13 @@ using System.Threading; using BlubbFish.IoT.Zway; using BlubbFish.IoT.Zway.Interfaces; using BlubbFish.Utils; +using ZwayBot.Interfaces; namespace ZwayBot.Moduls { - internal class CronJob : AModul, IDisposable { + internal class CronJob : AModul, IDisposable, IForceLoad { private DateTime crontime; private Thread thread; - private List> internalCron = new List>(); + private List, Object>> internalCron = new List, Object>>(); public override event ModulEvent Update; @@ -35,14 +36,16 @@ namespace ZwayBot.Moduls { while (true) { if(this.crontime.Minute != DateTime.Now.Minute) { this.crontime = DateTime.Now; - foreach (String item in this.ini.GetSections()) { - if(this.ParseCronString(this.ini.GetValue(item, "cron"))) { - this.SetValues(this.ini.GetValue(item, "set")); + if (this.ini != null) { + foreach (String item in this.ini.GetSections()) { + if (this.ParseCronString(this.ini.GetValue(item, "cron"))) { + this.SetValues(this.ini.GetValue(item, "set")); + } } } - foreach (Tuple item in this.internalCron) { + foreach (Tuple, Object> item in this.internalCron) { if(this.ParseCronString(item.Item1)) { - item.Item2?.Invoke(); + item.Item2?.Invoke(item.Item3); } } } @@ -54,24 +57,12 @@ namespace ZwayBot.Moduls { foreach (String item in value.Split(';')) { String[] items = item.Split(':'); if(items.Length == 2) { - String[] addr = items[0].Split('-'); String[] values = items[1].Split('-'); - if(addr.Length == 3 || addr.Length == 4) { - Int32 deviceid = Int32.Parse(addr[0]); - Int32 instanceid = Int32.Parse(addr[1]); - Int32 classid = Int32.Parse(addr[2]); - ICommandClass c; - if(addr.Length == 4) { - Int32 subcid = Int32.Parse(addr[3]); - c = this.zw.GetCommandClassSub(deviceid, instanceid, classid, subcid); - } else { - c = this.zw.GetCommandClass(deviceid, instanceid, classid); - } - if (c != null && values.Length == 2) { - if (Helper.HasProperty(c, values[0])) { - Helper.SetProperty(c, values[0], values[1]); - this.Update?.Invoke(this, new CronEvent(items[0], values[0], values[1])); - } + ACommandClass c = this.zw.GetCommandClass(items[0]); + if (c != null && values.Length == 2) { + if (c.HasProperty(values[0])) { + c.SetProperty(values[0], values[1]); + this.Update?.Invoke(this, new CronEvent(items[0], values[0], values[1])); } } } @@ -118,7 +109,7 @@ namespace ZwayBot.Moduls { cron = cron.Replace(DateTime.Parse("2015-01-" + (4 + i) + "T00:00:00").ToString("dddd", CultureInfo.CreateSpecificCulture("en-US")), i.ToString()); } for (Int32 i = 1; i <= 12; i++) { - cron = cron.Replace(DateTime.Parse("2015-"+i+"-01T00:00:00").ToString("MMM", CultureInfo.CreateSpecificCulture("en-US")), i.ToString()); + cron = cron.Replace(DateTime.Parse("2015-" + i + "-01T00:00:00").ToString("MMM", CultureInfo.CreateSpecificCulture("en-US")), i.ToString()); cron = cron.Replace(DateTime.Parse("2015-" + i + "-01T00:00:00").ToString("MMMM", CultureInfo.CreateSpecificCulture("en-US")), i.ToString()); } if (cron.Contains("*")) { @@ -162,8 +153,8 @@ namespace ZwayBot.Moduls { return ret.ContainsKey(Int32.Parse(date)); } - public override void SetInterconnection(String cron, Action hook) { - this.internalCron.Add(new Tuple(cron, hook)); + public override void SetInterconnection(String cron, Action hook, Object data) { + this.internalCron.Add(new Tuple, Object>(cron, hook, data)); } #region IDisposable Support diff --git a/Zway-Bot/Moduls/Flex4Grid.cs b/Zway-Bot/Moduls/Flex4Grid.cs index e67d627..a093c12 100644 --- a/Zway-Bot/Moduls/Flex4Grid.cs +++ b/Zway-Bot/Moduls/Flex4Grid.cs @@ -6,6 +6,7 @@ using BlubbFish.IoT.Zway.Devices; using BlubbFish.IoT.Zway.Devices.CommandClasses; using BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs; using BlubbFish.IoT.Zway.Events; +using BlubbFish.IoT.Zway.Interfaces; using BlubbFish.Utils; using BlubbFish.Utils.IoT.Connector; using LitJson; @@ -41,26 +42,27 @@ namespace ZwayBot.Moduls { private void DeviceUpdate(Object sender, DeviceUpdateEvent e) { Instance instance = (Instance)sender; if(e.Parent.GetType() == typeof(Switchbinary)) { - if (instance.CommandClasses.ContainsKey(37)) { //SwitchBinary + if (instance.CommandClasses.ContainsKey(ACommandClass.Classes.SwitchBinary)) { String topic = "/flex4grid/v1/households/" + this.household + "/device/state"; String text = JsonMapper.ToJson(new Dictionary() { - { "status", ((Switchbinary)instance.CommandClasses[37]).Level?"active":"idle" }, + { "status", ((Switchbinary)instance.CommandClasses[ACommandClass.Classes.SwitchBinary]).Level?"active":"idle" }, { "timestamp", DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffff'Z'") }, - { "type", ((Switchbinary)instance.CommandClasses[37]).Name }, + { "type", ((Switchbinary)instance.CommandClasses[ACommandClass.Classes.SwitchBinary]).Name }, { "id", instance.DeviceId.ToString() } }).ToString(); this.mqtt.Send(topic, text); this.Update?.Invoke(this, new Flex4gridEvent(topic, text)); } } else if(e.Parent.GetType() == typeof(Sensormultilevelsub) || e.Parent.GetType() == typeof(Metersub)) { - if (instance.CommandClasses.ContainsKey(49) && ((Sensormultilevel)instance.CommandClasses[49]).Sub.ContainsKey(4) && //SensorMultilevel - instance.CommandClasses.ContainsKey(50) && ((Meter)instance.CommandClasses[50]).Sub.ContainsKey(0)) { //Meter + if (instance.CommandClasses.ContainsKey(ACommandClass.Classes.SensorMultilevel) && + ((Sensormultilevel)instance.CommandClasses[ACommandClass.Classes.SensorMultilevel]).Sub.ContainsKey(4) && + instance.CommandClasses.ContainsKey(ACommandClass.Classes.Meter) && ((Meter)instance.CommandClasses[ACommandClass.Classes.Meter]).Sub.ContainsKey(0)) { String topic = "/flex4grid/v1/households/" + this.household + "/device/consumption"; String text = JsonMapper.ToJson(new Dictionary() { { "timestamp", DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffff'Z'") }, { "id", instance.DeviceId.ToString() }, - { "power", Math.Round(((Sensormultilevelsub)((Sensormultilevel)instance.CommandClasses[49]).Sub[4]).Level).ToString("F0") }, - { "energyCumul", ((Metersub)((Meter)instance.CommandClasses[50]).Sub[0]).Level.ToString() } + { "power", Math.Round(((Sensormultilevelsub)((Sensormultilevel)instance.CommandClasses[ACommandClass.Classes.SensorMultilevel]).Sub[4]).Level).ToString("F0") }, + { "energyCumul", ((Metersub)((Meter)instance.CommandClasses[ACommandClass.Classes.Meter]).Sub[0]).Level.ToString() } }).ToString(); this.mqtt.Send(topic, text); this.Update?.Invoke(this, new Flex4gridEvent(topic, text)); @@ -87,8 +89,9 @@ namespace ZwayBot.Moduls { foreach (String item in this.ini.GetValue("zway", "devices").Split(',')) { if (item == device) { Int32 deviceid = Int32.Parse(device); - if (this.zw.Devices.ContainsKey(deviceid) && this.zw.Devices[deviceid].Instances.ContainsKey(0) && this.zw.Devices[deviceid].Instances[0].CommandClasses.ContainsKey(37)) { - ((Switchbinary)this.zw.Devices[deviceid].Instances[0].CommandClasses[37]).Level = message["command"].ToString() == "ON"; + if (this.zw.Devices.ContainsKey(deviceid) && this.zw.Devices[deviceid].Instances.ContainsKey(0) && + this.zw.Devices[deviceid].Instances[0].CommandClasses.ContainsKey(ACommandClass.Classes.SwitchBinary)) { + ((Switchbinary)this.zw.Devices[deviceid].Instances[0].CommandClasses[ACommandClass.Classes.SwitchBinary]).Level = message["command"].ToString() == "ON"; } } } @@ -101,8 +104,8 @@ namespace ZwayBot.Moduls { foreach (String device in this.ini.GetValue("zway", "devices").Split(',')) { Int32 deviceid = Int32.Parse(device); if (this.zw.Devices.ContainsKey(deviceid) && this.zw.Devices[deviceid].Instances.ContainsKey(0)) { - if (this.zw.Devices[deviceid].Instances[0].CommandClasses.ContainsKey(37)) { - Switchbinary sw = ((Switchbinary)this.zw.Devices[deviceid].Instances[0].CommandClasses[37]); + if (this.zw.Devices[deviceid].Instances[0].CommandClasses.ContainsKey(ACommandClass.Classes.SwitchBinary)) { + Switchbinary sw = ((Switchbinary)this.zw.Devices[deviceid].Instances[0].CommandClasses[ACommandClass.Classes.SwitchBinary]); response.Add(sw.DeviceId.ToString(), sw.Level ? "active" : "idle"); } } @@ -116,7 +119,7 @@ namespace ZwayBot.Moduls { } } - private void RequestAlive() { + private void RequestAlive(Object o) { String raspi = this.ini.GetValue("f4g", "raspi"); lock (this.requestalivelock) { String req = "https://wiki.flex4grid.eu/rupdate/rupdate_general.yml.gpg.asc?gw=" + raspi; @@ -151,7 +154,7 @@ namespace ZwayBot.Moduls { if (this.ini.GetValue("f4g", "raspi") != null) { foreach (KeyValuePair item in moduls) { if (item.Value is CronJob) { - item.Value.SetInterconnection("10,40 * * * *", this.RequestAlive); + item.Value.SetInterconnection("10,40 * * * *", new Action(this.RequestAlive), null); } } } diff --git a/Zway-Bot/Moduls/Mqtt.cs b/Zway-Bot/Moduls/Mqtt.cs new file mode 100644 index 0000000..abc8ba7 --- /dev/null +++ b/Zway-Bot/Moduls/Mqtt.cs @@ -0,0 +1,62 @@ +using System; +using BlubbFish.IoT.Zway; +using BlubbFish.IoT.Zway.Events; +using BlubbFish.IoT.Zway.Interfaces; +using BlubbFish.Utils; +using BlubbFish.Utils.IoT.Connector; + +namespace ZwayBot.Moduls { + class Mqtt : AModul, IDisposable { + private ADataBackend mqtt; + + public override event ModulEvent Update; + + public Mqtt(ZwayController zway, InIReader settings) : base(zway, settings) { + this.mqtt = ADataBackend.GetInstance(this.ini.GetSection("settings")); + this.mqtt.MessageIncomming += this.Mqtt_MessageIncomming; + this.zw.Update += this.ZwayEvent; + } + + private void ZwayEvent(Object sender, DeviceUpdateEvent e) { + String topic = ""; + String data = ""; + if(e.Parent.HasAbstract(typeof(ACommandClass))) { + ACommandClass sensor = (ACommandClass)e.Parent; + topic = "/zwavebot/devices/" + sensor.MqttTopic(); + data = sensor.ToJson(); + } + if(topic != "" && data != "") { + this.mqtt.Send(topic, data); + this.Update?.Invoke(this, new MqttEvent(topic, data)); + } + } + + private void Mqtt_MessageIncomming(Object sender, MqttEventArgs e) { + if(e.Message.StartsWith("/zwavebot/devices/") && e.Message.EndsWith("set")) { + + } + } + + #region IDisposable Support + private Boolean disposedValue = false; + + protected virtual void Dispose(Boolean disposing) { + if (!this.disposedValue) { + if (disposing) { + this.mqtt.Dispose(); + } + this.disposedValue = true; + } + } + + ~Mqtt() { + Dispose(false); + } + + public override void Dispose() { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/Zway-Bot/Moduls/Overtaker.cs b/Zway-Bot/Moduls/Overtaker.cs index ccaea26..0a8f857 100644 --- a/Zway-Bot/Moduls/Overtaker.cs +++ b/Zway-Bot/Moduls/Overtaker.cs @@ -20,30 +20,18 @@ namespace ZwayBot.Moduls { String from = this.ini.GetValue(item, "from"); String[] source = from.Split(':'); this.events.Add(source[0], this.ini.GetSection(item)); - String[] addr = source[0].Split('-'); - ICommandClass c; - if (addr.Length == 3 || addr.Length == 4) { - Int32 deviceid = Int32.Parse(addr[0]); - Int32 instanceid = Int32.Parse(addr[1]); - Int32 classid = Int32.Parse(addr[2]); - if (addr.Length == 4) { - Int32 subcid = Int32.Parse(addr[3]); - c = this.zw.GetCommandClassSub(deviceid, instanceid, classid, subcid); - } else { - c = this.zw.GetCommandClass(deviceid, instanceid, classid); - } - if (c != null) { - c.Polling = true; - c.Update += this.ChangedEvent; - } + ACommandClass c = this.zw.GetCommandClass(source[0]); + if (c != null) { + c.Polling = true; + c.Update += this.ChangedEvent; } } } private void ChangedEvent(Object sender, DeviceUpdateEvent e) { - if(Helper.HasInterface(sender, "ICommandClass")) { - if (this.events.ContainsKey(((ICommandClass)sender).Id)) { - this.SetValues(sender, ((ICommandClass)sender).Id, this.events[((ICommandClass)sender).Id]); + if(sender.HasAbstract(typeof(ACommandClass))) { + if (this.events.ContainsKey(((ACommandClass)sender).Id)) { + this.SetValues(sender, ((ACommandClass)sender).Id, this.events[((ACommandClass)sender).Id]); } } } @@ -55,8 +43,8 @@ namespace ZwayBot.Moduls { return; } String source_value; - if (Helper.HasProperty(sender, source[1])) { - source_value = Helper.GetProperty(sender, source[1]).ToString(); + if (sender.HasProperty(source[1])) { + source_value = sender.GetProperty(source[1]).ToString(); } else { return; } @@ -71,26 +59,12 @@ namespace ZwayBot.Moduls { foreach (String to in dictionary["to"].Split(';')) { String[] target = to.Split(':'); if(target.Length == 2) { - String[] addr = target[0].Split('-'); - if (addr.Length == 3 || addr.Length == 4) { - Int32 deviceid = Int32.Parse(addr[0]); - Int32 instanceid = Int32.Parse(addr[1]); - Int32 classid = Int32.Parse(addr[2]); - ICommandClass c; - if (addr.Length == 4) { - Int32 subcid = Int32.Parse(addr[3]); - c = this.zw.GetCommandClassSub(deviceid, instanceid, classid, subcid); - } else { - c = this.zw.GetCommandClass(deviceid, instanceid, classid); - } - if (c != null) { - String target_value; - if (Helper.HasProperty(c, target[1])) { - target_value = Helper.GetProperty(c, target[1]).ToString(); - if (target_value != source_value) { - Helper.SetProperty(c, target[1], source_value); - this.Update?.Invoke(this, new OvertakerEvent(target[0], target[1], source_value)); - } + ACommandClass c = this.zw.GetCommandClass(target[0]); + if (c != null) { + if (c.HasProperty(target[1])) { + if (c.GetProperty(target[1]).ToString() != source_value) { + c.SetProperty(target[1], source_value); + this.Update?.Invoke(this, new OvertakerEvent(target[0], target[1], source_value)); } } } diff --git a/Zway-Bot/Moduls/StatusPolling.cs b/Zway-Bot/Moduls/StatusPolling.cs new file mode 100644 index 0000000..d394846 --- /dev/null +++ b/Zway-Bot/Moduls/StatusPolling.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using BlubbFish.IoT.Zway; +using BlubbFish.IoT.Zway.Devices; +using BlubbFish.IoT.Zway.Interfaces; +using BlubbFish.Utils; +using ZwayBot.Interfaces; + +namespace ZwayBot.Moduls { + class Statuspolling : AModul, IDisposable, IForceLoad { + public override event ModulEvent Update; + + public Statuspolling(ZwayController zway, InIReader settings) : base(zway, settings) { } + + + public override void Interconnect(Dictionary moduls) { + foreach (KeyValuePair item in moduls) { + if (item.Value is CronJob) { + item.Value.SetInterconnection("0 0 * * *", new Action(this.PollAll), null); + if (this.ini != null) { + foreach (String section in this.ini.GetSections()) { + if (this.ini.GetValue(section, "cron") != null && this.ini.GetValue(section, "devices") != null) { + item.Value.SetInterconnection(this.ini.GetValue(section, "cron"), new Action(this.PollSpecific), this.ini.GetValue(section, "devices")); + } + } + } + } + } + } + + private void PollSpecific(Object obj) { + String devices = (String)obj; + foreach (String item in devices.Split(',')) { + ACommandClass c = this.zw.GetCommandClass(item); + c.PollOnce = true; + this.Update?.Invoke(this, new StatusPollingEvent("Polling", item)); + } + } + + private void PollAll(Object o) { + foreach (KeyValuePair device in this.zw.Devices) { + foreach (KeyValuePair instance in device.Value.Instances) { + foreach (KeyValuePair commandclass in instance.Value.CommandClasses) { + commandclass.Value.PollOnce = true; + if(commandclass.Value.HasSub) { + foreach (KeyValuePair subclass in commandclass.Value.Sub) { + subclass.Value.PollOnce = true; + } + } + } + } + } + this.Update?.Invoke(this, new StatusPollingEvent("Polling", "all nodes")); + } + + public override void Dispose() {} + } +} diff --git a/Zway-Bot/Program.cs b/Zway-Bot/Program.cs index 60bdf4d..2599710 100644 --- a/Zway-Bot/Program.cs +++ b/Zway-Bot/Program.cs @@ -4,7 +4,6 @@ using System.IO; using System.Reflection; using BlubbFish.IoT.Zway; using BlubbFish.Utils; -using ZwayBot.Moduls; namespace ZwayBot { class Program { @@ -78,6 +77,9 @@ namespace ZwayBot { if (File.Exists(name.ToLower() + ".ini")) { this.moduls.Add(name, (AModul)t.GetConstructor(new Type[] { typeof(ZwayController), typeof(InIReader) }).Invoke(new Object[] { this.zw, InIReader.GetInstance(name.ToLower() + ".ini") })); Console.WriteLine("Load Modul " + name); + } else if(t.HasInterface("IForceLoad")) { + this.moduls.Add(name, (AModul)t.GetConstructor(new Type[] { typeof(ZwayController), typeof(InIReader) }).Invoke(new Object[] { this.zw, null })); + Console.WriteLine("Load Modul Forced " + name); } } } diff --git a/Zway-Bot/Properties/AssemblyInfo.cs b/Zway-Bot/Properties/AssemblyInfo.cs index 56ee4f4..6fbcffc 100644 --- a/Zway-Bot/Properties/AssemblyInfo.cs +++ b/Zway-Bot/Properties/AssemblyInfo.cs @@ -33,8 +33,8 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.2.1")] -[assembly: AssemblyFileVersion("1.1.2.1")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] [assembly: NeutralResourcesLanguage("de-DE")] // “Internet Of Things” icon by By Michael Wohlwend, US, from thenounproject.com. diff --git a/Zway-Bot/Zway-Bot.csproj b/Zway-Bot/Zway-Bot.csproj index ad89603..3203e82 100644 --- a/Zway-Bot/Zway-Bot.csproj +++ b/Zway-Bot/Zway-Bot.csproj @@ -54,12 +54,14 @@ + + @@ -73,6 +75,10 @@ {39235fad-ba9d-4b51-82fc-6969967beae9} ConnectorDataMosquitto + + {ee6c8f68-ed46-4c1c-abdd-cfcdf75104f2} + ConnectorDataMqtt + {b870e4d5-6806-4a0b-b233-8907eedc5afc} Utils-IoT diff --git a/Zway-Bot/bin/Release/ConnectorDataMosquitto.dll b/Zway-Bot/bin/Release/ConnectorDataMosquitto.dll index 6d022e4..d2acc00 100644 Binary files a/Zway-Bot/bin/Release/ConnectorDataMosquitto.dll and b/Zway-Bot/bin/Release/ConnectorDataMosquitto.dll differ diff --git a/Zway-Bot/bin/Release/ConnectorDataMqtt.dll b/Zway-Bot/bin/Release/ConnectorDataMqtt.dll new file mode 100644 index 0000000..85696c5 Binary files /dev/null and b/Zway-Bot/bin/Release/ConnectorDataMqtt.dll differ diff --git a/Zway-Bot/bin/Release/M2Mqtt.Net.dll b/Zway-Bot/bin/Release/M2Mqtt.Net.dll new file mode 100644 index 0000000..154580d Binary files /dev/null and b/Zway-Bot/bin/Release/M2Mqtt.Net.dll differ diff --git a/Zway-Bot/bin/Release/Utils-IoT.dll b/Zway-Bot/bin/Release/Utils-IoT.dll index cd3c0b9..5cd32d8 100644 Binary files a/Zway-Bot/bin/Release/Utils-IoT.dll and b/Zway-Bot/bin/Release/Utils-IoT.dll differ diff --git a/Zway-Bot/bin/Release/Utils.dll b/Zway-Bot/bin/Release/Utils.dll index 1a507db..1dc6a23 100644 Binary files a/Zway-Bot/bin/Release/Utils.dll and b/Zway-Bot/bin/Release/Utils.dll differ diff --git a/Zway-Bot/bin/Release/Zway-Bot.exe b/Zway-Bot/bin/Release/Zway-Bot.exe index a269be5..fdd2575 100644 Binary files a/Zway-Bot/bin/Release/Zway-Bot.exe and b/Zway-Bot/bin/Release/Zway-Bot.exe differ diff --git a/Zway-Bot/bin/Release/Zway.dll b/Zway-Bot/bin/Release/Zway.dll index dd67fc5..2489e42 100644 Binary files a/Zway-Bot/bin/Release/Zway.dll and b/Zway-Bot/bin/Release/Zway.dll differ