Compare commits

..
37 Commits
Author SHA1 Message Date
BlubbFish a9c77c6614 [BF] Fixing Bug in after installation script 2018-06-02 19:08:05 +00:00
BlubbFish 1c84703ac6 [BF] Making service linux running 2018-06-02 18:41:21 +00:00
BlubbFish 25e1e5165d 2018-06-02 17:14:42 +00:00
BlubbFish a76234f43d 2018-06-01 18:23:30 +00:00
BlubbFish a3afadd5f5 [NF] Move 2018-05-31 18:03:57 +00:00
BlubbFish 002b3cf338 [NF] Logrotate 2018-05-29 20:07:50 +00:00
BlubbFish a7895ef59a 2018-05-29 16:15:17 +00:00
BlubbFish 852a096f1d [NF] Now sould dedect Strg+c on Linux 2018-05-15 20:52:54 +00:00
BlubbFish 69030796f5 [BF] Fixinig installations dpkg script 2018-05-15 19:04:19 +00:00
BlubbFish 19d92c8cac [BF] Fixinig installations dpkg script 2018-05-15 18:59:32 +00:00
BlubbFish c792ea20ad Utils.csproj
[NF] Programmlogger added (v1.1.0)
[NF] Utils fixing tiny issues

Zway-Bot.csproj
[NF] changes Topics without beginning /
[NF] Using programmlogger (v1.4.0)
2018-05-15 18:49:03 +00:00
BlubbFish 611205e78f [BF] Fixing Issue with Math.Abs(l) 2018-05-12 12:36:32 +00:00
BlubbFish 4be8bb72f4 [BF] Some sensors make wrong measurements near 0 not exactly 0, so ABS(value) >= 0.1 is alse false 2018-05-10 06:26:39 +00:00
BlubbFish 76cb025606 [NF] Cleaning up
[NF] Create Debian Package
2018-05-08 17:25:39 +00:00
BlubbFish aa84aa0539 [BF] BOM from Settings file removed 2018-05-08 07:39:13 +00:00
BlubbFish 04f43b95ff [BF] Fixing Senml
[NF] Senml now has a configure option to setup the guid
[NF] Zway-Bot now listen on /exit
[NF] Implment searchpath for Zway-Bot (/etc/zwaybot and %appdata%/zwaybot)
2018-05-07 16:52:24 +00:00
BlubbFish a1009b5293 [NF] Now creating correct Senml for Linksmart 2018-05-07 14:02:57 +00:00
BlubbFish 91a05f882e [NF] Create Senml Messages for Linksmart 2018-05-03 14:43:50 +00:00
BlubbFish 74d270b6d2 [NF] Create Senml Messages for Linksmart 2018-05-03 14:39:08 +00:00
BlubbFish 200420c9b0 [NF] Create Senml Messages for Linksmart 2018-05-03 14:35:02 +00:00
BlubbFish acf5cea593 [DW] Flex4Grid deleted
[NF] BosMon Mqtt Plugin created
2018-03-31 20:42:28 +00:00
BlubbFish 307f03c7c0 [NF] v1.3.6.0 Better levelcheck and Alarmsensor added 2018-01-01 02:09:55 +00:00
BlubbFish 32b4daf3fb [BF] v1.3.5.3 Change Level to numeric and create State for Bollean values, because telegraf only parse numeric 2017-12-25 18:11:01 +00:00
BlubbFish 55e88f7b45 [[BF] v1.3.5.2 Check to avoid megapeaks in data now also for temperature 2017-12-24 10:43:58 +00:00
BlubbFish 8baef3b2b5 [BF] v1.3.5.1 Check to avoid megapeaks in Data 2017-12-23 22:37:36 +00:00
BlubbFish 80baca45e5 [NF] v.1.3 add possability to modify the config over mqtt 2017-12-22 22:13:28 +00:00
BlubbFish 75eac65510 [BF] v1.3.4.0 Fixing Json Names
[NF] v1.2.2.0 Mqtt can now get and set values
2017-12-19 20:18:30 +00:00
BlubbFish 44b8daa325 [BF] v.1.3.3 fixing polling once bug 2017-12-19 17:33:31 +00:00
BlubbFish 2cd2c7c02e [BF] v1.3.1.0 Forgot some settings, now configuration setting also works again 2017-12-18 16:02:18 +00:00
BlubbFish 33b1b6527c [NF] Tiny fix for mqtt 2017-12-17 21:53:16 +00:00
BlubbFish 9e60264d7d [NF] v1.3.0.0 Adding Status Polling and Mqtt (not compelete)
[NF] Able to force loading modules, so dependencys are ok
[NF] Cleanup because its now easyer to implement Zway
2017-12-17 20:09:28 +00:00
BlubbFish c96b2393d3 [BF] v.1.2.1.1 Next try to emulate F4G Events 2017-12-09 12:33:15 +00:00
BlubbFish 5fa97ea82b [NF] v1.1.2 Now complete Emulation of F4G Node
[NF] Possibility to attach internal cron events
2017-12-08 19:30:29 +00:00
BlubbFish 74027d705d [NF] Filter topics if usefull 2017-12-05 23:22:33 +00:00
BlubbFish 8dfc339194 [NF] Now possible to emulate F4G 2017-12-05 23:10:52 +00:00
BlubbFish f4545af4fe 2017-12-03 22:18:29 +00:00
BlubbFish 81737d5d3a [NF] Flex4Grid Plugin for Zway-Bot beginning 2017-12-03 22:07:33 +00:00
51 changed files with 1067 additions and 116 deletions
+31 -1
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.26730.16 VisualStudioVersion = 15.0.27004.2010
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zway-Bot", "Zway-Bot\Zway-Bot.csproj", "{AEF8059F-8AEF-45C7-85C4-318C8F797900}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zway-Bot", "Zway-Bot\Zway-Bot.csproj", "{AEF8059F-8AEF-45C7-85C4-318C8F797900}"
EndProject EndProject
@@ -9,6 +9,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zway", "..\Zway\Zway\Zway.c
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils\IoT\Utils-IoT.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorDataMqtt", "..\Utils\IoT\Connector\Data\Mqtt\ConnectorDataMqtt.csproj", "{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iot-Interfaces", "..\Utils\IoT\Interfaces\Iot-Interfaces.csproj", "{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "litjson_4.7.1", "..\Librarys\litjson\litjson\litjson_4.7.1.csproj", "{91A14CD2-2940-4500-8193-56D37EDDDBAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "M2Mqtt", "..\Librarys\mqtt\M2Mqtt\M2Mqtt_4.7.1.csproj", "{A11AEF5A-B246-4FE8-8330-06DB73CC8074}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -27,6 +37,26 @@ Global
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.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
{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Release|Any CPU.Build.0 = Release|Any CPU
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.Build.0 = Release|Any CPU
{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
+44
View File
@@ -26,6 +26,47 @@ namespace ZwayBot {
} }
} }
public class Flex4gridEvent : ModulEventArgs {
public Flex4gridEvent() {
}
public Flex4gridEvent(String topic, String text) {
this.Address = topic;
this.Value = text;
this.Source = "Flex4Grid";
}
public override String ToString() {
return this.Source + ": on " + this.Address + " set " + this.Value;
}
}
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 class ModulEventArgs : EventArgs {
public ModulEventArgs() { public ModulEventArgs() {
} }
@@ -33,5 +74,8 @@ namespace ZwayBot {
public String Property { get; protected set; } public String Property { get; protected set; }
public String Value { get; protected set; } public String Value { get; protected set; }
public String Source { get; protected set; } public String Source { get; protected set; }
public override String ToString() {
return this.Source + ": " + this.Address + " set " + this.Property + " to " + this.Value;
}
} }
} }
+35 -7
View File
@@ -2,8 +2,8 @@
using System.Reflection; using System.Reflection;
namespace ZwayBot { namespace ZwayBot {
class Helper { static class Helper {
public static void SetProperty(Object o, String name, String value) { public static void SetProperty(this Object o, String name, String value) {
PropertyInfo prop = o.GetType().GetProperty(name); PropertyInfo prop = o.GetType().GetProperty(name);
if (prop.CanWrite) { if (prop.CanWrite) {
if (prop.PropertyType == typeof(Boolean) && Boolean.TryParse(value, out Boolean vb)) { if (prop.PropertyType == typeof(Boolean) && Boolean.TryParse(value, out Boolean vb)) {
@@ -12,12 +12,15 @@ namespace ZwayBot {
prop.SetValue(o, v32); prop.SetValue(o, v32);
} else if (prop.PropertyType == typeof(Single) && Single.TryParse(value, out Single vs)) { } else if (prop.PropertyType == typeof(Single) && Single.TryParse(value, out Single vs)) {
prop.SetValue(o, vs); prop.SetValue(o, vs);
} else if (prop.PropertyType == typeof(Double) && Double.TryParse(value, out Double vd)) {
prop.SetValue(o, vd);
} else if (prop.PropertyType == typeof(Int64) && Int64.TryParse(value, out Int64 v64)) { } else if (prop.PropertyType == typeof(Int64) && Int64.TryParse(value, out Int64 v64)) {
prop.SetValue(o, v64); prop.SetValue(o, v64);
} }
} }
} }
public static Boolean HasProperty(Object o, String type) {
internal static Boolean HasProperty(this Object o, String type) {
Type t = o.GetType(); Type t = o.GetType();
foreach (PropertyInfo item in t.GetProperties()) { foreach (PropertyInfo item in t.GetProperties()) {
if (item.Name == type) { if (item.Name == type) {
@@ -27,7 +30,7 @@ namespace ZwayBot {
return false; 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); PropertyInfo prop = o.GetType().GetProperty(name);
if(prop.CanRead) { if(prop.CanRead) {
return prop.GetValue(o); return prop.GetValue(o);
@@ -35,9 +38,15 @@ namespace ZwayBot {
return null; return null;
} }
internal static Boolean HasInterface(Object o, String type) { internal static Boolean HasAbstract(this Object o, Type type) {
Type t = o.GetType(); if(o.GetType().BaseType == type) {
foreach (Type item in t.GetInterfaces()) { return true;
}
return false;
}
internal static Boolean HasInterface(this Type o, String type) {
foreach (Type item in o.GetInterfaces()) {
if(item.Name == type) { if(item.Name == type) {
return true; return true;
} }
@@ -45,10 +54,29 @@ namespace ZwayBot {
return false; return false;
} }
internal static Boolean HasInterface(this Object o, Type interf) {
foreach(Type item in o.GetType().GetInterfaces()) {
if(item == interf) {
return true;
}
}
return false;
}
internal static void WriteError(String text) { internal static void WriteError(String text) {
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
Console.Error.WriteLine("ERROR: " + text); Console.Error.WriteLine("ERROR: " + text);
Console.ResetColor(); Console.ResetColor();
} }
internal static String ToUpperLower(this String s) {
if(s.Length == 0) {
return "";
}
if(s.Length == 1) {
return s.ToUpper();
}
return s[0].ToString().ToUpper() + s.Substring(1).ToLower();
}
} }
} }
+4
View File
@@ -0,0 +1,4 @@
namespace ZwayBot.Interfaces {
interface IForceLoad {
}
}
+56 -5
View File
@@ -1,20 +1,71 @@
using System; using System;
using System.Collections.Generic;
using BlubbFish.IoT.Zway; using BlubbFish.IoT.Zway;
using BlubbFish.Utils; using BlubbFish.Utils;
namespace ZwayBot { namespace ZwayBot {
abstract class AModul { abstract class AModul {
protected ZwayController zw; protected ZwayController zw;
protected InIReader ini; private readonly InIReader settings;
protected Dictionary<String, Dictionary<String, String>> config = new Dictionary<String, Dictionary<String, String>>();
public AModul(ZwayController zway, InIReader settings) { public Boolean HasConfig { get; private set; }
this.zw = zway; public Boolean ConfigPublic { get; private set; }
this.ini = settings;
}
public delegate void ModulEvent(Object sender, ModulEventArgs e); public delegate void ModulEvent(Object sender, ModulEventArgs e);
public abstract event ModulEvent Update; public abstract event ModulEvent Update;
public AModul(ZwayController zway, InIReader settings) {
this.HasConfig = false;
this.ConfigPublic = false;
this.zw = zway;
this.settings = settings;
this.ParseConfig();
}
private void ParseConfig() {
if (this.settings != null) {
this.HasConfig = true;
foreach (String item in this.settings.GetSections(false)) {
this.config.Add(item, this.settings.GetSection(item));
}
if(this.config.ContainsKey("modul")) {
this.ConfigPublic = this.config["modul"].ContainsKey("config") && this.config["modul"]["config"].ToLower() == "public";
}
}
}
public Dictionary<String, Dictionary<String, String>> GetConfig() {
if (this.HasConfig && this.ConfigPublic) {
Dictionary<String, Dictionary<String, String>> ret = new Dictionary<String, Dictionary<String, String>>(this.config);
if(ret.ContainsKey("modul")) {
ret.Remove("modul");
}
return ret;
}
return new Dictionary<String, Dictionary<String, String>>();
}
public virtual void Interconnect(Dictionary<String, AModul> moduls) { }
public virtual void SetInterconnection(String param, Action<Object> hook, Object data) { }
public abstract void Dispose(); public abstract void Dispose();
internal void SetConfig(Dictionary<String, Dictionary<String, String>> newconf) {
if (this.HasConfig && this.ConfigPublic) {
if (newconf.ContainsKey("modul")) {
newconf.Remove("modul");
}
if (this.config.ContainsKey("modul")) {
newconf.Add("modul", this.config["modul"]);
}
this.config = newconf;
this.settings.SetSections(this.config);
this.UpdateConfig();
}
}
protected abstract void UpdateConfig();
} }
} }
+24 -27
View File
@@ -6,15 +6,17 @@ using System.Threading;
using BlubbFish.IoT.Zway; using BlubbFish.IoT.Zway;
using BlubbFish.IoT.Zway.Interfaces; using BlubbFish.IoT.Zway.Interfaces;
using BlubbFish.Utils; using BlubbFish.Utils;
using ZwayBot.Interfaces;
namespace ZwayBot.Moduls { namespace ZwayBot.Moduls {
internal class CronJob : AModul, IDisposable { internal class CronJob : AModul, IDisposable, IForceLoad {
private DateTime crontime; private DateTime crontime;
private Thread thread; private Thread thread;
private List<Tuple<String, Action<Object>, Object>> internalCron = new List<Tuple<String, Action<Object>, Object>>();
public override event ModulEvent Update; public override event ModulEvent Update;
private Dictionary<String, String> cron_named = new Dictionary<String, String> { private readonly Dictionary<String, String> cron_named = new Dictionary<String, String> {
{ "@yearly", "0 0 1 1 *" }, { "@yearly", "0 0 1 1 *" },
{ "@annually", "0 0 1 1 *" }, { "@annually", "0 0 1 1 *" },
{ "@monthly", "0 0 1 * *" }, { "@monthly", "0 0 1 * *" },
@@ -34,9 +36,16 @@ namespace ZwayBot.Moduls {
while (true) { while (true) {
if(this.crontime.Minute != DateTime.Now.Minute) { if(this.crontime.Minute != DateTime.Now.Minute) {
this.crontime = DateTime.Now; this.crontime = DateTime.Now;
foreach (String item in this.ini.GetSections()) { if (this.config.Count != 0) {
if(ParseCronString(this.ini.GetValue(item, "cron"))) { foreach (KeyValuePair<String, Dictionary<String, String>> item in this.config) {
this.SetValues(this.ini.GetValue(item, "set")); if (item.Value.ContainsKey("cron") && item.Value.ContainsKey("set") && this.ParseCronString(item.Value["cron"])) {
this.SetValues(item.Value["set"]);
}
}
}
foreach (Tuple<String, Action<Object>, Object> item in this.internalCron) {
if(this.ParseCronString(item.Item1)) {
item.Item2?.Invoke(item.Item3);
} }
} }
} }
@@ -48,29 +57,17 @@ namespace ZwayBot.Moduls {
foreach (String item in value.Split(';')) { foreach (String item in value.Split(';')) {
String[] items = item.Split(':'); String[] items = item.Split(':');
if(items.Length == 2) { if(items.Length == 2) {
String[] addr = items[0].Split('-');
String[] values = items[1].Split('-'); String[] values = items[1].Split('-');
if(addr.Length == 3 || addr.Length == 4) { ACommandClass c = this.zw.GetCommandClass(items[0]);
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 (c != null && values.Length == 2) {
if (Helper.HasProperty(c, values[0])) { if (c.HasProperty(values[0])) {
Helper.SetProperty(c, values[0], values[1]); c.SetProperty(values[0], values[1]);
this.Update?.Invoke(this, new CronEvent(items[0], values[0], values[1])); this.Update?.Invoke(this, new CronEvent(items[0], values[0], values[1]));
} }
} }
} }
} }
} }
}
private Boolean ParseCronString(String str) { private Boolean ParseCronString(String str) {
str = str.Trim(); str = str.Trim();
@@ -156,6 +153,12 @@ namespace ZwayBot.Moduls {
return ret.ContainsKey(Int32.Parse(date)); return ret.ContainsKey(Int32.Parse(date));
} }
public override void SetInterconnection(String cron, Action<Object> hook, Object data) {
this.internalCron.Add(new Tuple<String, Action<Object>, Object>(cron, hook, data));
}
protected override void UpdateConfig() { }
#region IDisposable Support #region IDisposable Support
private Boolean disposedValue = false; private Boolean disposedValue = false;
@@ -163,19 +166,13 @@ namespace ZwayBot.Moduls {
if (!this.disposedValue) { if (!this.disposedValue) {
if (disposing) { if (disposing) {
this.thread.Abort(); this.thread.Abort();
while(this.thread.ThreadState != ThreadState.Aborted) { Thread.Sleep(100); } while(this.thread.ThreadState == ThreadState.Running) { Thread.Sleep(100); }
} }
this.thread = null; this.thread = null;
this.disposedValue = true; this.disposedValue = true;
} }
} }
~CronJob() {
Dispose(false);
}
public override void Dispose() { public override void Dispose() {
Dispose(true); Dispose(true);
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
+134
View File
@@ -0,0 +1,134 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using BlubbFish.IoT.Zway;
using BlubbFish.IoT.Zway.Events;
using BlubbFish.IoT.Zway.Interfaces;
using BlubbFish.Utils;
using BlubbFish.Utils.IoT.Connector;
using BlubbFish.Utils.IoT.Events;
using LitJson;
namespace ZwayBot.Moduls {
class Mqtt : AModul, IDisposable {
private readonly ABackend mqtt;
private Dictionary<String, AModul> modules;
public override event ModulEvent Update;
public Mqtt(ZwayController zway, InIReader settings) : base(zway, settings) {
if (this.config.ContainsKey("settings")) {
this.mqtt = ABackend.GetInstance(this.config["settings"], ABackend.BackendType.Data);
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 != "") {
((ADataBackend)this.mqtt).Send(topic, data);
this.Update?.Invoke(this, new MqttEvent(topic, data));
}
}
private void Mqtt_MessageIncomming(Object sender, BackendEvent e) {
if (e.From.ToString().StartsWith("zwavebot/devices/") && (e.From.ToString().EndsWith("/set") || e.From.ToString().EndsWith("/get"))) {
Match m = new Regex("^zwavebot/devices/(\\d+)/(\\d+)/(\\d+)/[gs]et$|^zwavebot/devices/(\\d+)/(\\d+)/(\\d+)/(\\d+)/[gs]et$").Match(e.From.ToString());
String id = "";
if(m.Groups[1].Success) {
id = m.Groups[1].Value + "-" + m.Groups[2].Value + "-" + m.Groups[3].Value;
}
if(m.Groups[4].Success) {
id = m.Groups[4].Value + "-" + m.Groups[5].Value + "-" + m.Groups[6].Value + "-" + m.Groups[7].Value;
}
ACommandClass c = this.zw.GetCommandClass(id);
if(c == null) {
return;
}
if (e.From.ToString().EndsWith("/set")) {
try {
JsonData a = JsonMapper.ToObject(e.Message);
foreach (String item in a.Keys) {
String key = item.ToUpperLower();
if (c.HasProperty(key)) {
c.SetProperty(key, a[item].ToString());
this.Update?.Invoke(this, new MqttEvent(c.Id, a[item].ToString()));
}
}
} catch (Exception) { }
} else if(e.From.ToString().EndsWith("/get")) {
c.PollOnce = true;
((ADataBackend)this.mqtt).Send("zwavebot/devices/" + c.MqttTopic(), c.ToJson());
this.Update?.Invoke(this, new MqttEvent(e.From.ToString(), "Dataget"));
}
}
if (e.From.ToString().StartsWith("zwavebot/config/") && (e.From.ToString().EndsWith("/set") || e.From.ToString().EndsWith("/get"))) {
Match m = new Regex("^zwavebot/config/(\\w+)/[gs]et$|").Match(e.From.ToString());
if (!m.Groups[1].Success) {
return;
}
AModul modul = null;
foreach (KeyValuePair<String, AModul> item in this.modules) {
if (item.Key.ToLower() == m.Groups[1].Value) {
modul = item.Value;
}
}
if (modul == null) {
return;
}
if(e.From.ToString().EndsWith("/get") && modul.HasConfig && modul.ConfigPublic) {
String topic = "zwavebot/config/" + m.Groups[1].Value;
String data = JsonMapper.ToJson(modul.GetConfig()).ToString();
((ADataBackend)this.mqtt).Send(topic, data);
this.Update?.Invoke(this, new MqttEvent(topic, data));
}
if (e.From.ToString().EndsWith("/set") && modul.HasConfig && modul.ConfigPublic) {
try {
JsonData a = JsonMapper.ToObject(e.Message);
Dictionary<String, Dictionary<String, String>> newconf = new Dictionary<String, Dictionary<String, String>>();
foreach (String section in a.Keys) {
Dictionary<String, String> sectiondata = new Dictionary<String, String>();
foreach (String item in a[section].Keys) {
sectiondata.Add(item, a[section][item].ToString());
}
newconf.Add(section, sectiondata);
}
modul.SetConfig(newconf);
this.Update?.Invoke(this, new MqttEvent("New Config", "Write"));
} catch (Exception) { }
}
}
}
public override void Interconnect(Dictionary<String, AModul> moduls) {
this.modules = moduls;
}
protected override void UpdateConfig() { }
#region IDisposable Support
private Boolean disposedValue = false;
protected virtual void Dispose(Boolean disposing) {
if (!this.disposedValue) {
if (disposing) {
this.mqtt.Dispose();
}
this.disposedValue = true;
}
}
public override void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
}
}
+18 -42
View File
@@ -7,7 +7,7 @@ using BlubbFish.Utils;
namespace ZwayBot.Moduls { namespace ZwayBot.Moduls {
internal class Overtaker : AModul, IDisposable { internal class Overtaker : AModul, IDisposable {
private Dictionary<String, Dictionary<String, String>> events = new Dictionary<String, Dictionary<String, String>>(); private readonly Dictionary<String, Dictionary<String, String>> events = new Dictionary<String, Dictionary<String, String>>();
public override event ModulEvent Update; public override event ModulEvent Update;
@@ -16,22 +16,12 @@ namespace ZwayBot.Moduls {
} }
private void ParseIni() { private void ParseIni() {
foreach (String item in this.ini.GetSections()) { foreach (KeyValuePair<String, Dictionary<String, String>> item in this.config) {
String from = this.ini.GetValue(item, "from"); if (item.Value.ContainsKey("from")) {
String from = item.Value["from"];
String[] source = from.Split(':'); String[] source = from.Split(':');
this.events.Add(source[0], this.ini.GetSection(item)); this.events.Add(source[0], item.Value);
String[] addr = source[0].Split('-'); ACommandClass c = this.zw.GetCommandClass(source[0]);
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) { if (c != null) {
c.Polling = true; c.Polling = true;
c.Update += this.ChangedEvent; c.Update += this.ChangedEvent;
@@ -41,9 +31,9 @@ namespace ZwayBot.Moduls {
} }
private void ChangedEvent(Object sender, DeviceUpdateEvent e) { private void ChangedEvent(Object sender, DeviceUpdateEvent e) {
if(Helper.HasInterface(sender, "ICommandClass")) { if(sender.HasAbstract(typeof(ACommandClass))) {
if (this.events.ContainsKey(((ICommandClass)sender).Id)) { if (this.events.ContainsKey(((ACommandClass)sender).Id)) {
this.SetValues(sender, ((ICommandClass)sender).Id, this.events[((ICommandClass)sender).Id]); this.SetValues(sender, ((ACommandClass)sender).Id, this.events[((ACommandClass)sender).Id]);
} }
} }
} }
@@ -55,8 +45,8 @@ namespace ZwayBot.Moduls {
return; return;
} }
String source_value; String source_value;
if (Helper.HasProperty(sender, source[1])) { if (sender.HasProperty(source[1])) {
source_value = Helper.GetProperty(sender, source[1]).ToString(); source_value = sender.GetProperty(source[1]).ToString();
} else { } else {
return; return;
} }
@@ -68,27 +58,15 @@ namespace ZwayBot.Moduls {
} }
} }
} }
if (dictionary.ContainsKey("to")) {
foreach (String to in dictionary["to"].Split(';')) { foreach (String to in dictionary["to"].Split(';')) {
String[] target = to.Split(':'); String[] target = to.Split(':');
if (target.Length == 2) { if (target.Length == 2) {
String[] addr = target[0].Split('-'); ACommandClass c = this.zw.GetCommandClass(target[0]);
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) { if (c != null) {
String target_value; if (c.HasProperty(target[1])) {
if (Helper.HasProperty(c, target[1])) { if (c.GetProperty(target[1]).ToString() != source_value) {
target_value = Helper.GetProperty(c, target[1]).ToString(); c.SetProperty(target[1], source_value);
if (target_value != source_value) {
Helper.SetProperty(c, target[1], source_value);
this.Update?.Invoke(this, new OvertakerEvent(target[0], target[1], source_value)); this.Update?.Invoke(this, new OvertakerEvent(target[0], target[1], source_value));
} }
} }
@@ -98,6 +76,8 @@ namespace ZwayBot.Moduls {
} }
} }
protected override void UpdateConfig() { }
#region IDisposable Support #region IDisposable Support
private Boolean disposedValue = false; private Boolean disposedValue = false;
@@ -109,10 +89,6 @@ namespace ZwayBot.Moduls {
} }
} }
~Overtaker() {
Dispose(false);
}
public override void Dispose() { public override void Dispose() {
Dispose(true); Dispose(true);
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
+64
View File
@@ -0,0 +1,64 @@
using System;
using BlubbFish.IoT.Zway;
using BlubbFish.IoT.Zway.Events;
using BlubbFish.Utils;
using BlubbFish.Utils.IoT.Connector;
using BlubbFish.Utils.IoT.Events;
using BlubbFish.Utils.IoT.Interfaces;
namespace ZwayBot.Moduls {
class Senml : AModul {
public override event ModulEvent Update;
private readonly ABackend mqtt;
private readonly String SenmlGuid;
public Senml(ZwayController zway, InIReader settings) : base(zway, settings) {
if (this.config.ContainsKey("settings")) {
this.mqtt = ABackend.GetInstance(this.config["settings"], ABackend.BackendType.Data);
this.mqtt.MessageIncomming += this.EventInput;
this.zw.Update += this.EventOutput;
this.SenmlGuid = this.config["settings"]["guid"];
}
}
#region Events
private void EventOutput(Object sender, DeviceUpdateEvent e) {
String topic = "";
String data = "";
if (e.Parent.HasInterface(typeof(ISenml))) {
ISenml sensor = (ISenml)e.Parent;
topic = sensor.SenmlTopic() + this.SenmlGuid+ "/senml";
data = sensor.ToSenml();
}
if (topic != "" && data != null && data != "") {
((ADataBackend)this.mqtt).Send(topic, data);
this.Update?.Invoke(this, new MqttEvent(topic, data));
}
}
private void EventInput(Object sender, BackendEvent e) { }
#endregion
#region Config
protected override void UpdateConfig() { }
#endregion
#region IDisposable Support
private Boolean disposedValue = false;
protected virtual void Dispose(Boolean disposing) {
if (!this.disposedValue) {
if (disposing) {
this.mqtt.Dispose();
}
this.disposedValue = true;
}
}
public override void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
}
}
+60
View File
@@ -0,0 +1,60 @@
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<String, AModul> moduls) {
foreach (KeyValuePair<String, AModul> item in moduls) {
if (item.Value is CronJob) {
item.Value.SetInterconnection("0 0 * * *", new Action<Object>(this.PollAll), null);
if (this.config.Count != 0) {
foreach (KeyValuePair<String, Dictionary<String, String>> section in this.config) {
if (section.Value.ContainsKey("cron") && section.Value.ContainsKey("devices")) {
item.Value.SetInterconnection(section.Value["cron"], new Action<Object>(this.PollSpecific), section.Value["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<Int32, Device> device in this.zw.Devices) {
foreach (KeyValuePair<Int32, Instance> instance in device.Value.Instances) {
foreach (KeyValuePair<ACommandClass.Classes, ACommandClass> commandclass in instance.Value.CommandClasses) {
commandclass.Value.PollOnce = true;
if(commandclass.Value.HasSub) {
foreach (KeyValuePair<Int32, ACommandClass> subclass in commandclass.Value.Sub) {
subclass.Value.PollOnce = true;
}
}
}
}
}
this.Update?.Invoke(this, new StatusPollingEvent("Polling", "all nodes"));
}
protected override void UpdateConfig() { }
public override void Dispose() {}
}
}
+52 -16
View File
@@ -1,47 +1,77 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Reflection; using System.Reflection;
using System.Threading;
using BlubbFish.IoT.Zway; using BlubbFish.IoT.Zway;
using BlubbFish.Utils; using BlubbFish.Utils;
using ZwayBot.Moduls;
namespace ZwayBot { namespace ZwayBot {
class Program { class Program {
static void Main(String[] args) => new Program(args); static void Main(String[] args) => new Program(args);
private ZwayController zw; private readonly ZwayController zw;
private Dictionary<String, AModul> moduls = new Dictionary<String, AModul>(); private readonly Dictionary<String, AModul> moduls = new Dictionary<String, AModul>();
private Boolean RunningProcess = true;
private Thread sig_thread;
private readonly ProgramLogger logger = new ProgramLogger();
public Program(String[] args) { public Program(String[] args) {
InIReader.SetSearchPath(new List<String>() { "/etc/zwaybot", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\zwaybot" });
Dictionary<String, String> names; Dictionary<String, String> names;
if(File.Exists("names.ini")) { if(InIReader.ConfigExist("names")) {
names = InIReader.GetInstance("names.ini").GetSection("names"); names = InIReader.GetInstance("names").GetSection("names");
} else { } else {
names = new Dictionary<String, String>(); names = new Dictionary<String, String>();
} }
if(!File.Exists("settings.ini")) { if(!InIReader.ConfigExist("settings")) {
Helper.WriteError("No settings.ini found. Abord!"); Helper.WriteError("No settings.ini found. Abord!");
return; return;
} }
this.zw = new ZwayController(InIReader.GetInstance("settings.ini").GetSection("zway"), names, false); this.logger.SetPath(InIReader.GetInstance("settings").GetValue("logging", "path"));
this.zw = new ZwayController(InIReader.GetInstance("settings").GetSection("zway"), names, false);
this.zw.Update += this.ZwayDataUpate; this.zw.Update += this.ZwayDataUpate;
this.ModulLoader(); this.ModulLoader();
this.ModulInterconnect();
this.ModulEvents(); this.ModulEvents();
this.WaitForShutdown(); this.WaitForShutdown();
this.ModulDispose(); this.ModulDispose();
} }
private void ModulInterconnect() {
foreach (KeyValuePair<String, AModul> item in this.moduls) {
item.Value.Interconnect(this.moduls);
}
}
private void WaitForShutdown() { private void WaitForShutdown() {
if (Type.GetType("Mono.Runtime") != null) {
this.sig_thread = new Thread(delegate () {
Mono.Unix.UnixSignal[] signals = new Mono.Unix.UnixSignal[] {
new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM),
new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGINT)
};
Console.WriteLine("Signalhandler Mono attached.");
while (true) { while (true) {
System.Threading.Thread.Sleep(100); Int32 i = Mono.Unix.UnixSignal.WaitAny(signals, -1);
if (Console.KeyAvailable) { Console.WriteLine("Signalhandler Mono INT recieved " + i + ".");
ConsoleKeyInfo key = Console.ReadKey(false); this.RunningProcess = false; // TODO BUG
if (key.Key == ConsoleKey.Escape) {
break; break;
} }
});
this.sig_thread.Start();
} else {
Console.CancelKeyPress += new ConsoleCancelEventHandler(this.SetupShutdown);
Console.WriteLine("Signalhandler Windows attached.");
}
while (this.RunningProcess) {
Thread.Sleep(100);
} }
} }
private void SetupShutdown(Object sender, ConsoleCancelEventArgs e) {
e.Cancel = true;
Console.WriteLine("Signalhandler Windows INT recieved.");
this.RunningProcess = false;
} }
private void ModulDispose() { private void ModulDispose() {
@@ -50,6 +80,9 @@ namespace ZwayBot {
Console.WriteLine("Modul entladen: " + item.Key); Console.WriteLine("Modul entladen: " + item.Key);
} }
this.zw.Dispose(); this.zw.Dispose();
if (this.sig_thread != null && this.sig_thread.IsAlive) {
this.sig_thread.Abort();
}
} }
private void ModulEvents() { private void ModulEvents() {
@@ -59,7 +92,7 @@ namespace ZwayBot {
} }
private void ModulUpdate(Object sender, ModulEventArgs e) { private void ModulUpdate(Object sender, ModulEventArgs e) {
Console.WriteLine(e.Source+": " + e.Address + " set " + e.Property + " to " + e.Value); Console.WriteLine(e.ToString());
} }
private void ModulLoader() { private void ModulLoader() {
@@ -68,16 +101,19 @@ namespace ZwayBot {
if(item.Namespace == "ZwayBot.Moduls") { if(item.Namespace == "ZwayBot.Moduls") {
Type t = item; Type t = item;
String name = t.Name; String name = t.Name;
if (File.Exists(name.ToLower() + ".ini")) { if (InIReader.ConfigExist(name.ToLower())) {
this.moduls.Add(name, (AModul)t.GetConstructor(new Type[] { typeof(ZwayController), typeof(InIReader) }).Invoke(new Object[] { this.zw, InIReader.GetInstance(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()) }));
Console.WriteLine("Load Modul " + name); 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);
} }
} }
} }
} }
private void ZwayDataUpate(Object sender, BlubbFish.IoT.Zway.Events.DeviceUpdateEvent e) { private void ZwayDataUpate(Object sender, BlubbFish.IoT.Zway.Events.DeviceUpdateEvent e) {
Console.WriteLine("-> ZW [" + e.UpdateTime + "]: " + sender.ToString()); Console.WriteLine("-> ZW [" + e.UpdateTime + "]: " + e.Parent.ToString());
} }
} }
} }
+10 -8
View File
@@ -1,17 +1,17 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Resources;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden // Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind. // die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("Zway-Bot")] [assembly: AssemblyTitle("Zway-Bot")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("Is a Bot for Zwave Devices")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("BlubbFish")]
[assembly: AssemblyProduct("Zway-Bot")] [assembly: AssemblyProduct("Zway-Bot")]
[assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyCopyright("Copyright © 2017 - 15.05.2018")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("BlubbFish")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
@@ -27,10 +27,12 @@ using System.Runtime.InteropServices;
// Hauptversion // Hauptversion
// Nebenversion // Nebenversion
// Buildnummer // Buildnummer
// Revision
// //
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.5.4")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.5.4")]
[assembly: NeutralResourcesLanguage("de-DE")]
// “Internet Of Things” icon by By Michael Wohlwend, US, from thenounproject.com.
+73
View File
@@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ZwayBot.Properties {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ZwayBot.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Icon ähnlich wie (Symbol).
/// </summary>
public static System.Drawing.Icon Icon {
get {
object obj = ResourceManager.GetObject("Icon", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}
+124
View File
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

+1
View File
@@ -0,0 +1 @@
<svg width='200' height='200' fill="#000000" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><path d="M21,57.9v-6.5c0-2.9,2.4-5.3,5.3-5.3H41v-6.1c0-1.1,0.9-2,2-2s2,0.9,2,2v14.7c0,0.7,0.6,1.3,1.3,1.3h15.8c1.1,0,2,0.9,2,2 s-0.9,2-2,2H46.3c-2.9,0-5.3-2.4-5.3-5.3V50H26.3c-0.7,0-1.3,0.6-1.3,1.3v6.5c0,1.1-0.9,2-2,2S21,59,21,57.9z M79.8,72.9 c-1.1,0-2,0.9-2,2v1.7c0,0.7-0.6,1.3-1.3,1.3H62.2c-0.7,0-1.3-0.6-1.3-1.3c0-3.1-3.3-5.7-6.1-5.7H42.3c-1.1,0-2,0.9-2,2s0.9,2,2,2 h12.5c0.9,0,2.1,1.1,2.1,1.7c0,2.9,2.4,5.3,5.3,5.3h14.3c2.9,0,5.3-2.4,5.3-5.3v-1.7C81.8,73.8,80.9,72.9,79.8,72.9z M36,70.1 C36,70.1,36,70.1,36,70.1l0,14.4c0,0.8-0.4,1.4-1.1,1.8l-11,5.5c-0.1,0-0.2,0.1-0.2,0.1c-0.1,0-0.1,0-0.2,0.1C23.3,92,23.2,92,23,92 c0,0,0,0,0,0c-0.2,0-0.3,0-0.5-0.1c-0.1,0-0.1,0-0.2-0.1c-0.1,0-0.2,0-0.2-0.1l-11-5.5c-0.7-0.3-1.1-1-1.1-1.8V70.2c0,0,0-0.1,0-0.1 c0-0.1,0-0.2,0-0.3c0,0,0-0.1,0-0.1c0.1-0.3,0.2-0.6,0.4-0.8c0,0,0.1-0.1,0.1-0.1c0.1-0.1,0.2-0.2,0.3-0.2c0,0,0,0,0.1-0.1 c0,0,0,0,0.1,0c0,0,0.1,0,0.1-0.1l11-5.5c0.6-0.3,1.2-0.3,1.8,0l11,5.5c0,0,0.1,0,0.1,0.1c0,0,0,0,0.1,0c0,0,0,0,0.1,0.1 c0.1,0.1,0.2,0.1,0.3,0.2c0,0,0.1,0.1,0.1,0.1c0.2,0.2,0.4,0.5,0.4,0.8c0,0,0,0.1,0,0.1C36,69.9,36,70,36,70.1z M16.4,70.2l6.6,3.3 l6.6-3.3L23,66.9L16.4,70.2z M21,76.9l-7-3.5v9.8l7,3.5V76.9z M32,73.4l-7,3.5v9.8l7-3.5V73.4z M90.3,57.5c0,6.2-5.1,11.3-11.3,11.3 s-11.3-5.1-11.3-11.3S72.8,46.2,79,46.2S90.3,51.3,90.3,57.5z M86.3,57.5c0-4-3.3-7.3-7.3-7.3s-7.3,3.3-7.3,7.3s3.3,7.3,7.3,7.3 S86.3,61.5,86.3,57.5z M29.1,26.5c-0.1-0.6,0-1.2,0.3-1.6l12-17.1c0-0.1,0.1-0.1,0.2-0.2c0.1-0.1,0.1-0.1,0.2-0.2 C42,7.1,42.5,6.9,43,6.9c0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0c0,0,0,0,0,0s0,0,0,0c0.5,0,1,0.2,1.3,0.5c0.1,0.1,0.1,0.1,0.2,0.2 c0.1,0.1,0.1,0.1,0.2,0.2l12,17.1c0.3,0.5,0.4,1.1,0.3,1.6c-0.1,0.6-0.5,1-1,1.3l-12,6c-0.1,0-0.1,0.1-0.2,0.1 c-0.1,0-0.2,0.1-0.3,0.1C43.3,34,43.2,34,43,34c-0.3,0-0.6-0.1-0.8-0.2c0,0,0,0,0,0c0,0-0.1,0-0.1,0l-12-6 C29.6,27.5,29.2,27.1,29.1,26.5z M45,28.8l7-3.5l-7-10V28.8z M34,25.2l7,3.5V15.2L34,25.2z M78.2,51.6c-2.5,0.3-4.5,2.1-4.9,4.6 c-0.2,1.1,0.5,2.1,1.6,2.3c0.1,0,0.2,0,0.4,0c0.9,0,1.8-0.7,2-1.6c0.1-0.7,0.7-1.3,1.4-1.3c1.1-0.1,1.9-1.1,1.8-2.2 C80.3,52.3,79.2,51.5,78.2,51.6z M92.9,34.5c-3.8-3.8-8.8-5.8-14.1-5.8s-10.3,2.1-14.1,5.8c-0.8,0.8-0.8,2,0,2.8 c0.8,0.8,2,0.8,2.8,0c3-3,7-4.7,11.3-4.7s8.3,1.7,11.3,4.7c0.4,0.4,0.9,0.6,1.4,0.6s1-0.2,1.4-0.6C93.7,36.5,93.7,35.3,92.9,34.5z M73.1,42.8c1.5-1.5,3.6-2.4,5.8-2.4c2.2,0,4.2,0.8,5.8,2.4c0.4,0.4,0.9,0.6,1.4,0.6s1-0.2,1.4-0.6c0.8-0.8,0.8-2,0-2.8 c-2.3-2.3-5.3-3.6-8.6-3.6c-3.2,0-6.3,1.3-8.6,3.6c-0.8,0.8-0.8,2,0,2.8C71,43.6,72.3,43.6,73.1,42.8z"/></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

+82 -1
View File
@@ -8,9 +8,12 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>ZwayBot</RootNamespace> <RootNamespace>ZwayBot</RootNamespace>
<AssemblyName>Zway-Bot</AssemblyName> <AssemblyName>Zway-Bot</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@@ -34,9 +37,13 @@
<PropertyGroup> <PropertyGroup>
<StartupObject>ZwayBot.Program</StartupObject> <StartupObject>ZwayBot.Program</StartupObject>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\Icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
@@ -45,15 +52,42 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="dpkg\preinst" />
<None Include="dpkg\postinst" />
<Compile Include="Events.cs" /> <Compile Include="Events.cs" />
<Compile Include="Interfaces\IForceLoad.cs" />
<Compile Include="Moduls\AModul.cs" /> <Compile Include="Moduls\AModul.cs" />
<Compile Include="Moduls\CronJob.cs" /> <Compile Include="Moduls\CronJob.cs" />
<Compile Include="Helper.cs" /> <Compile Include="Helper.cs" />
<Compile Include="Moduls\Mqtt.cs" />
<Compile Include="Moduls\Overtaker.cs" /> <Compile Include="Moduls\Overtaker.cs" />
<Compile Include="Moduls\Senml.cs" />
<Compile Include="Moduls\StatusPolling.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Librarys\litjson\litjson\litjson_4.7.1.csproj">
<Project>{91a14cd2-2940-4500-8193-56d37edddbaa}</Project>
<Name>litjson_4.7.1</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utils\IoT\Connector\Data\Mqtt\ConnectorDataMqtt.csproj">
<Project>{ee6c8f68-ed46-4c1c-abdd-cfcdf75104f2}</Project>
<Name>ConnectorDataMqtt</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utils\IoT\Interfaces\Iot-Interfaces.csproj">
<Project>{4daada29-c600-4cf3-8ad3-9c97c8d7f632}</Project>
<Name>Iot-Interfaces</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utils\IoT\Utils-IoT.csproj">
<Project>{b870e4d5-6806-4a0b-b233-8907eedc5afc}</Project>
<Name>Utils-IoT</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utils\Utils\Utils.csproj"> <ProjectReference Include="..\..\Utils\Utils\Utils.csproj">
<Project>{fac8ce64-bf13-4ece-8097-aeb5dd060098}</Project> <Project>{fac8ce64-bf13-4ece-8097-aeb5dd060098}</Project>
<Name>Utils</Name> <Name>Utils</Name>
@@ -63,5 +97,52 @@
<Name>Zway</Name> <Name>Zway</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="config-example\cronjob.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config-example\names.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config-example\senml.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config-example\settings.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config-example\statuspolling.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="config-example\mqtt.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config-example\overtaker.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="dpkg\control" />
<None Include="dpkg\create-Builds.bat" />
<None Include="dpkg\make-deb.sh" />
<None Include="dpkg\prerm" />
<None Include="dpkg\zwaybot-logrotate" />
<None Include="dpkg\zwaybot.service" />
<None Include="packages.config" />
<None Include="Resources\Icon.ico" />
<Content Include="Resources\icon.svg" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Mono.Posix.5.4.0.201\build\net45\Mono.Posix.targets" Condition="Exists('..\packages\Mono.Posix.5.4.0.201\build\net45\Mono.Posix.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Mono.Posix.5.4.0.201\build\net45\Mono.Posix.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Mono.Posix.5.4.0.201\build\net45\Mono.Posix.targets'))" />
</Target>
</Project> </Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,10 @@
[modul]
config=public
[cold]
cron=0 23 * * 0-4
set=7-0-67-2:Level-19;7-0-112-8:Level-2
[hot]
cron=0 16 * * 1-5
set=7-0-67-1:Level-22;7-0-112-8:Level-1
@@ -0,0 +1,6 @@
[modul]
config=private
[settings]
type=mqtt
server=localhost
@@ -0,0 +1,24 @@
[names]
2-0-37=Kühlschrank Schalter
2-0-49-4=Kühlschrank Leistung
2-0-50-0=Kühlschrank Verbrauch [kWh]
2-0-50-2=Kühlschrank Verbrauch [Wh]
2-0-112-1=Kühlschrank Config (Immer AN)
2-0-112-16=Kühlschrank Config (Zurück zu altem Status nach Stromausfall)
2-0-112-34=Kühlschrank Config (Reaktion auf Alarm)
2-0-112-35=Kühlschrank Config (Antwort auf Alarmmeldung)
2-0-112-39=Kühlschrank Config (Alarm Dauer)
2-0-112-40=Kühlschrank Config (Sofortiger Bericht über Stromverbrauch)
2-0-112-42=Kühlschrank Config (Änderung der Leistung zum Generieren eines Reports)
2-0-112-43=Kühlschrank Config (Regelmäßiges Senden eines Reports über die Stromaufnahme)
2-0-112-45=Kühlschrank Config (Automatisches Senden eines Reportes über Stromverbrauch bei Verbrauchsänderung)
2-0-112-47=Kühlschrank Config (Zeitinterval zum Senden eines Reportes ohne Änderung im Verbrauch)
2-0-112-49=Kühlschrank Config (Messen des Eigenstromverbrauches)
2-0-112-50=Kühlschrank Config (unterer Leistungsschwellwert)
2-0-112-51=Kühlschrank Config (oberer Leistungsschwellwert)
2-0-112-52=Kühlschrank Config (Aktion bei Erreichen des definierten Schwellwertes (Parameter 50/51))
2-0-112-60=Kühlschrank Config (Leistungsschwellwert für violettes Blinken)
2-0-112-61=Kühlschrank Config (LED Ring Farbe im Einschaltzustand)
2-0-112-62=Kühlschrank Config (LED Ring Farbe im Ausschaltzustand)
2-0-112-63=Kühlschrank Config (LED Ring Farbe bei Z-Wave Alarmmeldungen)
2-0-112-70=Kühlschrank Config (Überlastabschaltung)
@@ -0,0 +1,12 @@
[hot]
from=7-0-67-1:Level
to=8-0-67-1:Level;9-0-67-1:Level
[cold]
from=7-0-67-2:Level
to=8-0-67-11:Level;9-0-67-11:Level
[mode]
from=7-0-112-8:Level
to=8-0-64:Level;9-0-64:Level
convert=1-1;2-11
@@ -0,0 +1,7 @@
[modul]
config=private
[settings]
type=mqtt
server=localhost
guid=linksmart-zwaybot
@@ -0,0 +1,7 @@
[zway]
server=localhost
user=admin
pass=pass
[logging]
path=/var/log/zwaybot.log
@@ -0,0 +1,3 @@
[temp]
cron=30 * * * *
devices=7-0-49-1,8-0-49-1,9-0-49-1,10-0-49-1,11-0-49-1
Binary file not shown.
@@ -0,0 +1,10 @@
[modul]
config=public
[cold]
cron=0 23 * * 0-4
set=7-0-67-2:Level-19;7-0-112-8:Level-2
[hot]
cron=0 16 * * 1-5
set=7-0-67-1:Level-22;7-0-112-8:Level-1
@@ -0,0 +1,6 @@
[modul]
config=private
[settings]
type=mqtt
server=localhost
@@ -0,0 +1,24 @@
[names]
2-0-37=Kühlschrank Schalter
2-0-49-4=Kühlschrank Leistung
2-0-50-0=Kühlschrank Verbrauch [kWh]
2-0-50-2=Kühlschrank Verbrauch [Wh]
2-0-112-1=Kühlschrank Config (Immer AN)
2-0-112-16=Kühlschrank Config (Zurück zu altem Status nach Stromausfall)
2-0-112-34=Kühlschrank Config (Reaktion auf Alarm)
2-0-112-35=Kühlschrank Config (Antwort auf Alarmmeldung)
2-0-112-39=Kühlschrank Config (Alarm Dauer)
2-0-112-40=Kühlschrank Config (Sofortiger Bericht über Stromverbrauch)
2-0-112-42=Kühlschrank Config (Änderung der Leistung zum Generieren eines Reports)
2-0-112-43=Kühlschrank Config (Regelmäßiges Senden eines Reports über die Stromaufnahme)
2-0-112-45=Kühlschrank Config (Automatisches Senden eines Reportes über Stromverbrauch bei Verbrauchsänderung)
2-0-112-47=Kühlschrank Config (Zeitinterval zum Senden eines Reportes ohne Änderung im Verbrauch)
2-0-112-49=Kühlschrank Config (Messen des Eigenstromverbrauches)
2-0-112-50=Kühlschrank Config (unterer Leistungsschwellwert)
2-0-112-51=Kühlschrank Config (oberer Leistungsschwellwert)
2-0-112-52=Kühlschrank Config (Aktion bei Erreichen des definierten Schwellwertes (Parameter 50/51))
2-0-112-60=Kühlschrank Config (Leistungsschwellwert für violettes Blinken)
2-0-112-61=Kühlschrank Config (LED Ring Farbe im Einschaltzustand)
2-0-112-62=Kühlschrank Config (LED Ring Farbe im Ausschaltzustand)
2-0-112-63=Kühlschrank Config (LED Ring Farbe bei Z-Wave Alarmmeldungen)
2-0-112-70=Kühlschrank Config (Überlastabschaltung)
@@ -0,0 +1,12 @@
[hot]
from=7-0-67-1:Level
to=8-0-67-1:Level;9-0-67-1:Level
[cold]
from=7-0-67-2:Level
to=8-0-67-11:Level;9-0-67-11:Level
[mode]
from=7-0-112-8:Level
to=8-0-64:Level;9-0-64:Level
convert=1-1;2-11
@@ -0,0 +1,7 @@
[modul]
config=private
[settings]
type=mqtt
server=localhost
guid=linksmart-zwaybot
@@ -0,0 +1,7 @@
[zway]
server=localhost
user=admin
pass=pass
[logging]
path=/var/log/zwaybot.log
@@ -0,0 +1,3 @@
[temp]
cron=30 * * * *
devices=7-0-49-1,8-0-49-1,9-0-49-1,10-0-49-1,11-0-49-1
+10
View File
@@ -0,0 +1,10 @@
Package: zwaybot
Version: x.x-x
Section: base
Priority: optional
Architecture: any
Depends: mono-complete (>= 5.4.1.6)
Maintainer: BlubbFish <dev@blubbfish.net>
Description: Zway-Bot
Zway-Bot manage a Zwave.me installation
so that it has more features
+1
View File
@@ -0,0 +1 @@
bash.exe -c "./make-deb.sh armhf"
+49
View File
@@ -0,0 +1,49 @@
#!/bin/bash
HOMEDIR="/home/blubb"
ROOT="$HOMEDIR/deb"
OUTPUT="../bin/Release"
EXEC="$ROOT/usr/local/bin/zwaybot"
CONFIG="$ROOT/etc/zwaybot"
SYSTEMD="$ROOT/etc/systemd/system"
LOGROTATE="$ROOT/etc/logrotate.d"
DEBIAN="$ROOT/DEBIAN"
VMAJOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 1)
VMINOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 2)
VBUILD=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 3)
ARCHT=$1
mkdir -p $EXEC
mkdir -p $CONFIG
mkdir -p $DEBIAN
mkdir -p $SYSTEMD
mkdir -p $LOGROTATE
cp control $DEBIAN
cp preinst $DEBIAN
cp postinst $DEBIAN
cp prerm $DEBIAN
sed -i s/Version:\ x\.x-x/"Version: $VMAJOR.$VMINOR-$VBUILD"/ $DEBIAN/control
sed -i s/Architecture:\ any/"Architecture: $ARCHT"/ $DEBIAN/control
chmod 755 $DEBIAN -R
cp zwaybot.service $SYSTEMD
chmod 644 $SYSTEMD/zwaybot.service
cp $OUTPUT/*.exe $EXEC/
find $OUTPUT -name \*.dll ! -name Mono.Posix.dll -exec cp {} $EXEC/ \;
chmod 644 $EXEC/*
chmod 755 $EXEC
cp $OUTPUT/config-example/* $CONFIG
chmod 644 $CONFIG/*
chmod 755 $CONFIG
cp zwaybot-logrotate $LOGROTATE/zwaybot
chmod 644 $LOGROTATE/*
dpkg-deb --build $ROOT
mv $HOMEDIR/deb.deb ../../../Builds/"$ARCHT-zwaybot_$VMAJOR.$VMINOR-$VBUILD.deb"
rm $HOMEDIR/deb -r
+1
View File
@@ -0,0 +1 @@
Name "Example1"
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
systemctl daemon-reload
systemctl is-active --quiet zwaybot && service zwaybot restart
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
useradd -M zwaybot
usermod -L zwaybot
groupadd zwaybot
usermod -G zwaybot,adm zwaybot
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
service zwaybot stop
+10
View File
@@ -0,0 +1,10 @@
/var/log/zwaybot.log {
compress
copytruncate
daily
delaycompress
missingok
notifempty
rotate 4
size=10M
}
+20
View File
@@ -0,0 +1,20 @@
# If you modify this, please also make sure to edit init.sh
[Unit]
Description=Zway-Bot manage a Zwave.me installation so that it has more features
After=network-online.target
[Service]
User=zwaybot
Group=zwaybot
WorkingDirectory=/usr/local/bin/zwaybot
# ExecStartPre=/bin/rm /var/log/zwaybot.log && /bin/touch /var/log/zwaybot.log && /bin/chown zwaybot:zwaybot /var/log/zwaybot.log && /bin/chmod 644 /var/log/zwaybot.log
ExecStart=/usr/bin/mono /usr/local/bin/zwaybot/Zway-Bot.exe
KillMode=control-group
Restart=on-failure
StandardOutput=null
StandardError=syslog+journal
[Install]
WantedBy=multi-user.target
Alias=zwaybot.service
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Mono.Posix" version="5.4.0.201" targetFramework="net471" />
</packages>