Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7895ef59a | ||
|
|
852a096f1d | ||
|
|
69030796f5 | ||
|
|
19d92c8cac | ||
|
|
c792ea20ad | ||
|
|
611205e78f | ||
|
|
4be8bb72f4 |
@@ -29,7 +29,7 @@ namespace ZwayBot.Moduls {
|
|||||||
String data = "";
|
String data = "";
|
||||||
if(e.Parent.HasAbstract(typeof(ACommandClass))) {
|
if(e.Parent.HasAbstract(typeof(ACommandClass))) {
|
||||||
ACommandClass sensor = (ACommandClass)e.Parent;
|
ACommandClass sensor = (ACommandClass)e.Parent;
|
||||||
topic = "/zwavebot/devices/" + sensor.MqttTopic();
|
topic = "zwavebot/devices/" + sensor.MqttTopic();
|
||||||
data = sensor.ToJson();
|
data = sensor.ToJson();
|
||||||
}
|
}
|
||||||
if(topic != "" && data != "") {
|
if(topic != "" && data != "") {
|
||||||
@@ -39,8 +39,8 @@ namespace ZwayBot.Moduls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void Mqtt_MessageIncomming(Object sender, BackendEvent e) {
|
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"))) {
|
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());
|
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 = "";
|
String id = "";
|
||||||
if(m.Groups[1].Success) {
|
if(m.Groups[1].Success) {
|
||||||
id = m.Groups[1].Value + "-" + m.Groups[2].Value + "-" + m.Groups[3].Value;
|
id = m.Groups[1].Value + "-" + m.Groups[2].Value + "-" + m.Groups[3].Value;
|
||||||
@@ -65,12 +65,12 @@ namespace ZwayBot.Moduls {
|
|||||||
} catch (Exception) { }
|
} catch (Exception) { }
|
||||||
} else if(e.From.ToString().EndsWith("/get")) {
|
} else if(e.From.ToString().EndsWith("/get")) {
|
||||||
c.PollOnce = true;
|
c.PollOnce = true;
|
||||||
((ADataBackend)this.mqtt).Send("/zwavebot/devices/" + c.MqttTopic(), c.ToJson());
|
((ADataBackend)this.mqtt).Send("zwavebot/devices/" + c.MqttTopic(), c.ToJson());
|
||||||
this.Update?.Invoke(this, new MqttEvent(e.From.ToString(), "Dataget"));
|
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"))) {
|
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());
|
Match m = new Regex("^zwavebot/config/(\\w+)/[gs]et$|").Match(e.From.ToString());
|
||||||
if (!m.Groups[1].Success) {
|
if (!m.Groups[1].Success) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ namespace ZwayBot.Moduls {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(e.From.ToString().EndsWith("/get") && modul.HasConfig && modul.ConfigPublic) {
|
if(e.From.ToString().EndsWith("/get") && modul.HasConfig && modul.ConfigPublic) {
|
||||||
String topic = "/zwavebot/config/" + m.Groups[1].Value;
|
String topic = "zwavebot/config/" + m.Groups[1].Value;
|
||||||
String data = JsonMapper.ToJson(modul.GetConfig()).ToString();
|
String data = JsonMapper.ToJson(modul.GetConfig()).ToString();
|
||||||
((ADataBackend)this.mqtt).Send(topic, data);
|
((ADataBackend)this.mqtt).Send(topic, data);
|
||||||
this.Update?.Invoke(this, new MqttEvent(topic, data));
|
this.Update?.Invoke(this, new MqttEvent(topic, data));
|
||||||
|
|||||||
+29
-8
@@ -8,8 +8,11 @@ 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 System.Threading.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" });
|
InIReader.SetSearchPath(new List<String>() { "/etc/zwaybot", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\zwaybot" });
|
||||||
@@ -23,6 +26,7 @@ namespace ZwayBot {
|
|||||||
Helper.WriteError("No settings.ini found. Abord!");
|
Helper.WriteError("No settings.ini found. Abord!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.logger.SetPath(InIReader.GetInstance("settings").GetValue("logging", "path"));
|
||||||
this.zw = new ZwayController(InIReader.GetInstance("settings").GetSection("zway"), names, false);
|
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();
|
||||||
@@ -39,15 +43,29 @@ namespace ZwayBot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void WaitForShutdown() {
|
private void WaitForShutdown() {
|
||||||
while (true) {
|
if (Type.GetType("Mono.Runtime") != null) {
|
||||||
|
this.sig_thread = new System.Threading.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)
|
||||||
|
};
|
||||||
|
while (this.RunningProcess) {
|
||||||
|
Int32 i = Mono.Unix.UnixSignal.WaitAny(signals, -1);
|
||||||
|
this.RunningProcess = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.sig_thread.Start();
|
||||||
|
} else {
|
||||||
|
Console.CancelKeyPress += new ConsoleCancelEventHandler(this.SetupShutdown);
|
||||||
|
}
|
||||||
|
while (this.RunningProcess) {
|
||||||
System.Threading.Thread.Sleep(100);
|
System.Threading.Thread.Sleep(100);
|
||||||
if (Console.KeyAvailable) {
|
|
||||||
String a = Console.ReadLine();
|
|
||||||
if (a.EndsWith("/exit")) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetupShutdown(Object sender, ConsoleCancelEventArgs e) {
|
||||||
|
e.Cancel = true;
|
||||||
|
this.RunningProcess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ModulDispose() {
|
private void ModulDispose() {
|
||||||
@@ -56,6 +74,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() {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("BlubbFish")]
|
[assembly: AssemblyCompany("BlubbFish")]
|
||||||
[assembly: AssemblyProduct("Zway-Bot")]
|
[assembly: AssemblyProduct("Zway-Bot")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2017 - 08.05.2018")]
|
[assembly: AssemblyCopyright("Copyright © 2017 - 15.05.2018")]
|
||||||
[assembly: AssemblyTrademark("BlubbFish")]
|
[assembly: AssemblyTrademark("BlubbFish")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@@ -31,8 +31,8 @@ using System.Runtime.InteropServices;
|
|||||||
// 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.3.2")]
|
[assembly: AssemblyVersion("1.5.0")]
|
||||||
[assembly: AssemblyFileVersion("1.3.2")]
|
[assembly: AssemblyFileVersion("1.5.0")]
|
||||||
[assembly: NeutralResourcesLanguage("de-DE")]
|
[assembly: NeutralResourcesLanguage("de-DE")]
|
||||||
|
|
||||||
// “Internet Of Things” icon by By Michael Wohlwend, US, from thenounproject.com.
|
// “Internet Of Things” icon by By Michael Wohlwend, US, from thenounproject.com.
|
||||||
|
|||||||
+15
-28
@@ -12,6 +12,8 @@
|
|||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -50,6 +52,8 @@
|
|||||||
<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="Interfaces\IForceLoad.cs" />
|
||||||
<Compile Include="Moduls\AModul.cs" />
|
<Compile Include="Moduls\AModul.cs" />
|
||||||
@@ -94,33 +98,6 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="control\control.sh">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="control\join.sh">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="control\loop.sh">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="control\restart.sh">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="control\settings.cfg">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="control\start.sh">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="control\stop.sh">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="control\stuff.sh">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="control\view.sh">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="config-example\cronjob.conf.example">
|
<None Include="config-example\cronjob.conf.example">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
@@ -145,8 +122,11 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="dpkg\control" />
|
<None Include="dpkg\control" />
|
||||||
<None Include="dpkg\create-dkpg.bat" />
|
<None Include="dpkg\create-Builds.bat" />
|
||||||
<None Include="dpkg\make-deb.sh" />
|
<None Include="dpkg\make-deb.sh" />
|
||||||
|
<None Include="dpkg\prerm" />
|
||||||
|
<None Include="dpkg\zwaybot.service" />
|
||||||
|
<None Include="packages.config" />
|
||||||
<None Include="Resources\Icon.ico" />
|
<None Include="Resources\Icon.ico" />
|
||||||
<Content Include="Resources\icon.svg" />
|
<Content Include="Resources\icon.svg" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -157,4 +137,11 @@
|
|||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</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.
@@ -1,4 +1,4 @@
|
|||||||
[modul]
|
[modul]
|
||||||
config=public
|
config=public
|
||||||
|
|
||||||
[cold]
|
[cold]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[modul]
|
[modul]
|
||||||
config=private
|
config=private
|
||||||
|
|
||||||
[settings]
|
[settings]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[names]
|
[names]
|
||||||
2-0-37=Kühlschrank Schalter
|
2-0-37=Kühlschrank Schalter
|
||||||
2-0-49-4=Kühlschrank Leistung
|
2-0-49-4=Kühlschrank Leistung
|
||||||
2-0-50-0=Kühlschrank Verbrauch [kWh]
|
2-0-50-0=Kühlschrank Verbrauch [kWh]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[hot]
|
[hot]
|
||||||
from=7-0-67-1:Level
|
from=7-0-67-1:Level
|
||||||
to=8-0-67-1:Level;9-0-67-1:Level
|
to=8-0-67-1:Level;9-0-67-1:Level
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[modul]
|
[modul]
|
||||||
config=private
|
config=private
|
||||||
|
|
||||||
[settings]
|
[settings]
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
[zway]
|
[zway]
|
||||||
server=localhost
|
server=localhost
|
||||||
user=admin
|
user=admin
|
||||||
pass=pass
|
pass=pass
|
||||||
|
|
||||||
|
[logging]
|
||||||
|
path=/var/log/zwaybot.log
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
[temp]
|
[temp]
|
||||||
cron=30 * * * *
|
cron=30 * * * *
|
||||||
devices=7-0-49-1,8-0-49-1,9-0-49-1,10-0-49-1,11-0-49-1
|
devices=7-0-49-1,8-0-49-1,9-0-49-1,10-0-49-1,11-0-49-1
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
cd $control_root
|
|
||||||
|
|
||||||
|
|
||||||
for(( ; ; ))
|
|
||||||
do
|
|
||||||
# Test for Running Servers
|
|
||||||
servers=$(./view.sh | grep $screen_name)
|
|
||||||
|
|
||||||
clear
|
|
||||||
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Zway-Bot not Running!"
|
|
||||||
echo ""
|
|
||||||
echo "1) Start Zway-Bot"
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "Zway-Bot is Running :)"
|
|
||||||
echo ""
|
|
||||||
echo "2) Stop Zway-Bot"
|
|
||||||
echo "3) Restart Zway-Bot"
|
|
||||||
echo "4) Attach to Servers Screen-Session"
|
|
||||||
echo "5) Put Command to Zway-Bot"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "q) Quit"
|
|
||||||
echo ""
|
|
||||||
read -p "Choice: " choice
|
|
||||||
|
|
||||||
case "$choice" in
|
|
||||||
q) #Quit
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
1) #Start Server
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Starting Zway-Bot..."
|
|
||||||
./start.sh
|
|
||||||
else
|
|
||||||
echo "Zway-Bot Allready started!"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
2) #Stop Server
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Zway-Bot is not Running!"
|
|
||||||
else
|
|
||||||
echo "Stopping Zway-Bot..."
|
|
||||||
./stop.sh
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
3) #Restart Server
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Zway-Bot is not Running!"
|
|
||||||
else
|
|
||||||
echo "Restarting Zway-Bot..."
|
|
||||||
./restart.sh
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
4) #Attach to Screen
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Zway-Bot is not Running!"
|
|
||||||
else
|
|
||||||
./join.sh
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
5) #Put Command to Server
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Zway-Bot is not Running!"
|
|
||||||
else
|
|
||||||
read -p "Please enter Zway-Bot-Command: " mc_cmd
|
|
||||||
./stuff.sh "$mc_cmd"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
*) #Invalid Selection
|
|
||||||
echo "Wrong Selection!"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
|
|
||||||
echo Press STRG+A then D to detach from Console
|
|
||||||
read -p "Press [Enter] to continue..."
|
|
||||||
|
|
||||||
screen -R $screen_name
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
|
|
||||||
rm $control_root/stop_server.info
|
|
||||||
|
|
||||||
for(( ; ; ))
|
|
||||||
do
|
|
||||||
if [ ! -e $control_root/stop_server.info ];
|
|
||||||
then
|
|
||||||
cd $mc_root
|
|
||||||
$mc_cmd
|
|
||||||
else
|
|
||||||
echo "Stopped Server!"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
rm $control_root/stop_server.info
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
cd $control_root
|
|
||||||
|
|
||||||
# Be Shure theere is no Stop-Info
|
|
||||||
rm $control_root/stop_server.info
|
|
||||||
|
|
||||||
echo "Server will be restarted in 5 Seconds..."
|
|
||||||
./stuff.sh "/say ReStarting Server in 5 seconds!"
|
|
||||||
sleep 1
|
|
||||||
echo "4..."
|
|
||||||
./stuff.sh "/say 4..."
|
|
||||||
sleep 1
|
|
||||||
echo "3..."
|
|
||||||
./stuff.sh "/say 3..."
|
|
||||||
sleep 1
|
|
||||||
echo "2..."
|
|
||||||
./stuff.sh "/say 2..."
|
|
||||||
sleep 1
|
|
||||||
echo "1..."
|
|
||||||
./stuff.sh "/say 1..."
|
|
||||||
sleep 1
|
|
||||||
echo "Restarting Server..."
|
|
||||||
./stuff.sh "/say Restart Now!"
|
|
||||||
./stuff.sh "stop"
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Minecraft Control-Scripts Config-File
|
|
||||||
|
|
||||||
# (please remember that there are no spaces allowed around the =-Sign
|
|
||||||
# in the config-lines)
|
|
||||||
|
|
||||||
# Minecraft-Dir & JAR
|
|
||||||
|
|
||||||
# Directory where minecraft is in
|
|
||||||
mc_root="/home/pi/Zway-Bot"
|
|
||||||
|
|
||||||
# Root of Control-Scripts
|
|
||||||
control_root="$mc_root/control"
|
|
||||||
|
|
||||||
|
|
||||||
# MC-Server-Jar (will be executed in mc_root)
|
|
||||||
mc_jar="$mc_root/Zway-Bot.exe"
|
|
||||||
|
|
||||||
# MC-Server Start-Command
|
|
||||||
mc_cmd="mono $mc_jar"
|
|
||||||
|
|
||||||
# Screen
|
|
||||||
screen_name="Zway-Bot"
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
|
|
||||||
# Start Loop in Screen
|
|
||||||
screen -A -m -d -S $screen_name $control_root/loop.sh
|
|
||||||
|
|
||||||
# Allow other users to control this screen-Session!
|
|
||||||
screen -r $screen_name -X multiuser on
|
|
||||||
screen -r $screen_name -X addacl www-data
|
|
||||||
screen -r $screen_name -X addacl mc
|
|
||||||
screen -r $screen_name -X addacl mw
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
cd $control_root
|
|
||||||
|
|
||||||
# Create Stop-Info!
|
|
||||||
touch $control_root/stop_server.info
|
|
||||||
|
|
||||||
echo "Shuting Down Server..."
|
|
||||||
./stuff.sh "/exit"
|
|
||||||
screen -R $screen_name
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
|
|
||||||
# screen -r $screen_name -X stuff "$1\n"
|
|
||||||
|
|
||||||
screen -p 0 -S $screen_name -X eval "stuff '$1'\015"
|
|
||||||
# as_user "screen -p 0 -S minecraft -X eval 'stuff \"$command\"\015'"
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
screen -ls
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
[modul]
|
[modul]
|
||||||
config=public
|
config=public
|
||||||
|
|
||||||
[cold]
|
[cold]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[modul]
|
[modul]
|
||||||
config=private
|
config=private
|
||||||
|
|
||||||
[settings]
|
[settings]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[names]
|
[names]
|
||||||
2-0-37=Kühlschrank Schalter
|
2-0-37=Kühlschrank Schalter
|
||||||
2-0-49-4=Kühlschrank Leistung
|
2-0-49-4=Kühlschrank Leistung
|
||||||
2-0-50-0=Kühlschrank Verbrauch [kWh]
|
2-0-50-0=Kühlschrank Verbrauch [kWh]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[hot]
|
[hot]
|
||||||
from=7-0-67-1:Level
|
from=7-0-67-1:Level
|
||||||
to=8-0-67-1:Level;9-0-67-1:Level
|
to=8-0-67-1:Level;9-0-67-1:Level
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[modul]
|
[modul]
|
||||||
config=private
|
config=private
|
||||||
|
|
||||||
[settings]
|
[settings]
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
[zway]
|
[zway]
|
||||||
server=localhost
|
server=localhost
|
||||||
user=admin
|
user=admin
|
||||||
pass=pass
|
pass=pass
|
||||||
|
|
||||||
|
[logging]
|
||||||
|
path=/var/log/zwaybot.log
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
[temp]
|
[temp]
|
||||||
cron=30 * * * *
|
cron=30 * * * *
|
||||||
devices=7-0-49-1,8-0-49-1,9-0-49-1,10-0-49-1,11-0-49-1
|
devices=7-0-49-1,8-0-49-1,9-0-49-1,10-0-49-1,11-0-49-1
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
cd $control_root
|
|
||||||
|
|
||||||
|
|
||||||
for(( ; ; ))
|
|
||||||
do
|
|
||||||
# Test for Running Servers
|
|
||||||
servers=$(./view.sh | grep $screen_name)
|
|
||||||
|
|
||||||
clear
|
|
||||||
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Zway-Bot not Running!"
|
|
||||||
echo ""
|
|
||||||
echo "1) Start Zway-Bot"
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "Zway-Bot is Running :)"
|
|
||||||
echo ""
|
|
||||||
echo "2) Stop Zway-Bot"
|
|
||||||
echo "3) Restart Zway-Bot"
|
|
||||||
echo "4) Attach to Servers Screen-Session"
|
|
||||||
echo "5) Put Command to Zway-Bot"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "q) Quit"
|
|
||||||
echo ""
|
|
||||||
read -p "Choice: " choice
|
|
||||||
|
|
||||||
case "$choice" in
|
|
||||||
q) #Quit
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
1) #Start Server
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Starting Zway-Bot..."
|
|
||||||
./start.sh
|
|
||||||
else
|
|
||||||
echo "Zway-Bot Allready started!"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
2) #Stop Server
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Zway-Bot is not Running!"
|
|
||||||
else
|
|
||||||
echo "Stopping Zway-Bot..."
|
|
||||||
./stop.sh
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
3) #Restart Server
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Zway-Bot is not Running!"
|
|
||||||
else
|
|
||||||
echo "Restarting Zway-Bot..."
|
|
||||||
./restart.sh
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
4) #Attach to Screen
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Zway-Bot is not Running!"
|
|
||||||
else
|
|
||||||
./join.sh
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
5) #Put Command to Server
|
|
||||||
if [[ -z $servers ]];
|
|
||||||
then
|
|
||||||
echo "Zway-Bot is not Running!"
|
|
||||||
else
|
|
||||||
read -p "Please enter Zway-Bot-Command: " mc_cmd
|
|
||||||
./stuff.sh "$mc_cmd"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
*) #Invalid Selection
|
|
||||||
echo "Wrong Selection!"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
|
|
||||||
echo Press STRG+A then D to detach from Console
|
|
||||||
read -p "Press [Enter] to continue..."
|
|
||||||
|
|
||||||
screen -R $screen_name
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
|
|
||||||
rm $control_root/stop_server.info
|
|
||||||
|
|
||||||
for(( ; ; ))
|
|
||||||
do
|
|
||||||
if [ ! -e $control_root/stop_server.info ];
|
|
||||||
then
|
|
||||||
cd $mc_root
|
|
||||||
$mc_cmd
|
|
||||||
else
|
|
||||||
echo "Stopped Server!"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
rm $control_root/stop_server.info
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
cd $control_root
|
|
||||||
|
|
||||||
# Be Shure theere is no Stop-Info
|
|
||||||
rm $control_root/stop_server.info
|
|
||||||
|
|
||||||
echo "Server will be restarted in 5 Seconds..."
|
|
||||||
./stuff.sh "/say ReStarting Server in 5 seconds!"
|
|
||||||
sleep 1
|
|
||||||
echo "4..."
|
|
||||||
./stuff.sh "/say 4..."
|
|
||||||
sleep 1
|
|
||||||
echo "3..."
|
|
||||||
./stuff.sh "/say 3..."
|
|
||||||
sleep 1
|
|
||||||
echo "2..."
|
|
||||||
./stuff.sh "/say 2..."
|
|
||||||
sleep 1
|
|
||||||
echo "1..."
|
|
||||||
./stuff.sh "/say 1..."
|
|
||||||
sleep 1
|
|
||||||
echo "Restarting Server..."
|
|
||||||
./stuff.sh "/say Restart Now!"
|
|
||||||
./stuff.sh "stop"
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Minecraft Control-Scripts Config-File
|
|
||||||
|
|
||||||
# (please remember that there are no spaces allowed around the =-Sign
|
|
||||||
# in the config-lines)
|
|
||||||
|
|
||||||
# Minecraft-Dir & JAR
|
|
||||||
|
|
||||||
# Directory where minecraft is in
|
|
||||||
mc_root="/home/pi/Zway-Bot"
|
|
||||||
|
|
||||||
# Root of Control-Scripts
|
|
||||||
control_root="$mc_root/control"
|
|
||||||
|
|
||||||
|
|
||||||
# MC-Server-Jar (will be executed in mc_root)
|
|
||||||
mc_jar="$mc_root/Zway-Bot.exe"
|
|
||||||
|
|
||||||
# MC-Server Start-Command
|
|
||||||
mc_cmd="mono $mc_jar"
|
|
||||||
|
|
||||||
# Screen
|
|
||||||
screen_name="Zway-Bot"
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
|
|
||||||
# Start Loop in Screen
|
|
||||||
screen -A -m -d -S $screen_name $control_root/loop.sh
|
|
||||||
|
|
||||||
# Allow other users to control this screen-Session!
|
|
||||||
screen -r $screen_name -X multiuser on
|
|
||||||
screen -r $screen_name -X addacl www-data
|
|
||||||
screen -r $screen_name -X addacl mc
|
|
||||||
screen -r $screen_name -X addacl mw
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
cd $control_root
|
|
||||||
|
|
||||||
# Create Stop-Info!
|
|
||||||
touch $control_root/stop_server.info
|
|
||||||
|
|
||||||
echo "Shuting Down Server..."
|
|
||||||
./stuff.sh "/exit"
|
|
||||||
screen -R $screen_name
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read Settings
|
|
||||||
DIR=`dirname $0`
|
|
||||||
source $DIR/settings.cfg
|
|
||||||
|
|
||||||
# screen -r $screen_name -X stuff "$1\n"
|
|
||||||
|
|
||||||
screen -p 0 -S $screen_name -X eval "stuff '$1'\015"
|
|
||||||
# as_user "screen -p 0 -S minecraft -X eval 'stuff \"$command\"\015'"
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
screen -ls
|
|
||||||
@@ -2,7 +2,7 @@ Package: zwaybot
|
|||||||
Version: x.x-x
|
Version: x.x-x
|
||||||
Section: base
|
Section: base
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Architecture: i386
|
Architecture: any
|
||||||
Depends: mono-complete (>= 5.4.1.6)
|
Depends: mono-complete (>= 5.4.1.6)
|
||||||
Maintainer: BlubbFish <dev@blubbfish.net>
|
Maintainer: BlubbFish <dev@blubbfish.net>
|
||||||
Description: Zway-Bot
|
Description: Zway-Bot
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
bash.exe -c "./make-deb.sh armhf"
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
set /P maj=Enter Major Version:
|
|
||||||
set /P min=Enter Minor Version:
|
|
||||||
set /P bui=Enter Build Version:
|
|
||||||
|
|
||||||
bash.exe -c "./make-deb.sh %maj% %min% %bui%"
|
|
||||||
pause
|
|
||||||
@@ -1,26 +1,42 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
WORKDIR="/home/blubb"
|
|
||||||
ROOT="$WORKDIR/deb"
|
HOMEDIR="/home/blubb"
|
||||||
|
ROOT="$HOMEDIR/deb"
|
||||||
OUTPUT="../bin/Release"
|
OUTPUT="../bin/Release"
|
||||||
EXEC="$ROOT/usr/local/bin/zwaybot"
|
EXEC="$ROOT/usr/local/bin/zwaybot"
|
||||||
CONFIG="$ROOT/etc/zwaybot"
|
CONFIG="$ROOT/etc/zwaybot"
|
||||||
|
SYSTEMD="$ROOT/etc/systemd/system"
|
||||||
DEBIAN="$ROOT/DEBIAN"
|
DEBIAN="$ROOT/DEBIAN"
|
||||||
VMAJOR=$1
|
VMAJOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 1)
|
||||||
VMINOR=$2
|
VMINOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 2)
|
||||||
VBUILD=$3
|
VBUILD=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 3)
|
||||||
|
ARCHT=$1
|
||||||
|
|
||||||
mkdir -p $EXEC
|
mkdir -p $EXEC
|
||||||
mkdir -p $CONFIG
|
mkdir -p $CONFIG
|
||||||
mkdir -p $DEBIAN
|
mkdir -p $DEBIAN
|
||||||
|
mkdir -p $SYSTEMD
|
||||||
|
|
||||||
cp control $DEBIAN
|
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/Version:\ x\.x-x/"Version: $VMAJOR.$VMINOR-$VBUILD"/ $DEBIAN/control
|
||||||
|
sed -i s/Architecture:\ any/"Architecture: $ARCHT"/ $DEBIAN/control
|
||||||
chmod 755 $DEBIAN -R
|
chmod 755 $DEBIAN -R
|
||||||
|
|
||||||
|
cp zwaybot.service $SYSTEMD
|
||||||
|
chmod 644 $SYSTEMD/zwaybot.service
|
||||||
|
|
||||||
cp $OUTPUT/*.exe $EXEC/
|
cp $OUTPUT/*.exe $EXEC/
|
||||||
cp $OUTPUT/*.dll $EXEC/
|
find $OUTPUT -name \*.dll ! -name Mono.Posix.dll -exec cp {} $EXEC/ \;
|
||||||
|
chmod 644 $EXEC/*
|
||||||
|
chmod 755 $EXEC
|
||||||
|
|
||||||
cp $OUTPUT/config-example/* $CONFIG
|
cp $OUTPUT/config-example/* $CONFIG
|
||||||
cp $OUTPUT/control $EXEC/ -r
|
chmod 644 $CONFIG/*
|
||||||
|
chmod 755 $CONFIG
|
||||||
|
|
||||||
dpkg-deb --build $ROOT
|
dpkg-deb --build $ROOT
|
||||||
mv $WORKDIR/deb.deb ../bin/"zwaybot_$VMAJOR.$VMINOR-$VBUILD.deb"
|
mv $HOMEDIR/deb.deb ../../../Builds/$ARCHT/"zwaybot_$VMAJOR.$VMINOR-$VBUILD.deb"
|
||||||
rm $WORKDIR/deb -r
|
rm $HOMEDIR/deb -r
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Name "Example1"
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
service zwaybot start
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
service zwaybot stop
|
||||||
|
useradd -M zwaybot
|
||||||
|
usermod -L zwaybot
|
||||||
|
groupadd zwaybot
|
||||||
|
usermod -G zwaybot,adm zwaybot
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
service zwaybot stop
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# 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=rm /var/log/zwaybot.log && touch /var/log/zwaybot.log && chown zwaybot:zwaybot /var/log/zwaybot.log && chmod 644 /var/log/zwaybot.log
|
||||||
|
ExecStart=/usr/bin/mono /usr/local/bin/zwaybot/Zway-Bot.exe
|
||||||
|
KillMode=control-group
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
Alias=zwaybot.service
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Mono.Posix" version="5.4.0.201" targetFramework="net471" />
|
||||||
|
</packages>
|
||||||
Reference in New Issue
Block a user