-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef9a094
commit 1948c09
Showing
69 changed files
with
6,867 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
# alpdesk-automationservice | ||
# Alpdesk-Automationservice | ||
Java-Service for Automation (like Homeautomation) | ||
|
||
To start on RaspberryPi with Shell-Script: | ||
|
||
#!/bin/sh | ||
cd /home/pi/xhomeautomation | ||
mount /dev/sda1 /media/xhomeautomationusb/ | ||
sudo mount | grep sda1 | ||
java -Xdebug -Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=n -jar XHomeautomation-Service-Deploy.jar /home/pi/xhomeautomation/homeautomation.properties --spring.profiles.active=prod --spring.datasource.url=jdbc:h2:file:/media/xhomeautomationusb/xhomeautomationdb_prod | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project-shared-configuration> | ||
<!-- | ||
This file contains additional configuration written by modules in the NetBeans IDE. | ||
The configuration is intended to be shared among all the users of project and | ||
therefore it is assumed to be part of version control checkout. | ||
Without this configuration present, some functionality in the IDE may be limited or fail altogether. | ||
--> | ||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> | ||
<!-- | ||
Properties that influence various parts of the IDE, especially code formatting and the like. | ||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. | ||
That way multiple projects can share the same settings (useful for formatting rules for example). | ||
Any value defined here will override the pom.xml file value but is only applicable to the current project. | ||
--> | ||
<org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled> | ||
</properties> | ||
</project-shared-configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<actions> | ||
<action> | ||
<actionName>run</actionName> | ||
<packagings> | ||
<packaging>jar</packaging> | ||
</packagings> | ||
<goals> | ||
<goal>process-classes</goal> | ||
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal> | ||
</goals> | ||
<properties> | ||
<exec.args>-Dspring.profiles.active=dev -classpath %classpath x.main.XHomeautomationMain homeautomationtest.properties</exec.args> | ||
<exec.executable>java</exec.executable> | ||
<exec.workingdir>./src/main/resources/data</exec.workingdir> | ||
</properties> | ||
</action> | ||
<action> | ||
<actionName>debug</actionName> | ||
<packagings> | ||
<packaging>jar</packaging> | ||
</packagings> | ||
<goals> | ||
<goal>process-classes</goal> | ||
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal> | ||
</goals> | ||
<properties> | ||
<exec.args>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} -Dspring.profiles.active=dev -classpath %classpath x.main.XHomeautomationMain homeautomationtest.properties</exec.args> | ||
<exec.executable>java</exec.executable> | ||
<jpda.listen>true</jpda.listen> | ||
<exec.workingdir>./src/main/resources/data</exec.workingdir> | ||
</properties> | ||
</action> | ||
<action> | ||
<actionName>profile</actionName> | ||
<packagings> | ||
<packaging>jar</packaging> | ||
</packagings> | ||
<goals> | ||
<goal>process-classes</goal> | ||
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal> | ||
</goals> | ||
<properties> | ||
<exec.args>-Dspring.profiles.active=dev -classpath %classpath x.main.XHomeautomationMain homeautomationtest.properties</exec.args> | ||
<exec.executable>java</exec.executable> | ||
<exec.workingdir>./src/main/resources/data</exec.workingdir> | ||
</properties> | ||
</action> | ||
</actions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<actions> | ||
<action> | ||
<actionName>run</actionName> | ||
<packagings> | ||
<packaging>jar</packaging> | ||
</packagings> | ||
<goals> | ||
<goal>process-classes</goal> | ||
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal> | ||
</goals> | ||
<properties> | ||
<exec.args>-Dspring.profiles.active=dev -classpath %classpath x.main.XHomeautomationMain homeautomationtest.properties</exec.args> | ||
<exec.executable>java</exec.executable> | ||
<exec.workingdir>./src/main/resources/data</exec.workingdir> | ||
</properties> | ||
</action> | ||
<action> | ||
<actionName>debug</actionName> | ||
<packagings> | ||
<packaging>jar</packaging> | ||
</packagings> | ||
<goals> | ||
<goal>process-classes</goal> | ||
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal> | ||
</goals> | ||
<properties> | ||
<exec.args>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} -Dspring.profiles.active=dev -classpath %classpath x.main.XHomeautomationMain homeautomationtest.properties</exec.args> | ||
<exec.executable>java</exec.executable> | ||
<jpda.listen>true</jpda.listen> | ||
<exec.workingdir>./src/main/resources/data</exec.workingdir> | ||
</properties> | ||
</action> | ||
<action> | ||
<actionName>profile</actionName> | ||
<packagings> | ||
<packaging>jar</packaging> | ||
</packagings> | ||
<goals> | ||
<goal>process-classes</goal> | ||
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal> | ||
</goals> | ||
<properties> | ||
<exec.args>-Dspring.profiles.active=dev -classpath %classpath x.main.XHomeautomationMain homeautomationtest.properties</exec.args> | ||
<exec.executable>java</exec.executable> | ||
<exec.workingdir>./src/main/resources/data</exec.workingdir> | ||
</properties> | ||
</action> | ||
</actions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>x</groupId> | ||
<artifactId>Alpdesk-Automationservice</artifactId> | ||
<version>2.2.0</version> | ||
|
||
<packaging>jar</packaging> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.3.1.RELEASE</version> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>net.wimpi</groupId> | ||
<artifactId>jamod</artifactId> | ||
<version>1.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
<version>1.14</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.typesafe.akka</groupId> | ||
<artifactId>akka-actor_2.13</artifactId> | ||
<version>2.6.6</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-websocket</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-jpa</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<scope>runtime</scope> | ||
<version>1.4.200</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<profiles> | ||
<profile> | ||
<id>build_jdk8</id> | ||
<properties> | ||
<maven.test.skip>true</maven.test.skip> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<start-class>x.main.XHomeautomationMain</start-class> | ||
</properties> | ||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<includes> | ||
<include>**/*</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<configuration> | ||
<finalName>${project.artifactId}-Deploy</finalName> | ||
<addResources>true</addResources> | ||
<fork>true</fork> | ||
<mainClass>x.main.XHomeautomationMain</mainClass> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
<profile> | ||
<id>build_jdk11</id> | ||
<properties> | ||
<maven.test.skip>true</maven.test.skip> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<start-class>x.main.XHomeautomationMain</start-class> | ||
</properties> | ||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<includes> | ||
<include>**/*</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<configuration> | ||
<finalName>${project.artifactId}-Deploy</finalName> | ||
<addResources>true</addResources> | ||
<fork>true</fork> | ||
<mainClass>x.main.XHomeautomationMain</mainClass> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/java</directory> | ||
<includes> | ||
<include>**/*.properties</include> | ||
<include>**/*.txt</include> | ||
<include>**/*.png</include> | ||
<include>**/*.gif</include> | ||
<include>**/*.GIF</include> | ||
<include>**/*.dll</include> | ||
<include>**/*.theme</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
</build> | ||
<name>Alpdesk-Automationservice</name> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package x.DeviceEffects; | ||
|
||
public class BaseEffect { | ||
|
||
long startTime = 0; | ||
int delay = 0; | ||
public boolean idle = true; | ||
public String[] outputs = null; | ||
|
||
public BaseEffect(int delay, String outputs) { | ||
this.delay = delay; | ||
this.outputs = outputs.split(";"); | ||
} | ||
|
||
synchronized public void initEffect(long startTime) { | ||
this.idle = false; | ||
this.startTime = startTime; | ||
} | ||
|
||
synchronized public void resetEffect() { | ||
this.idle = true; | ||
this.startTime = 0; | ||
} | ||
|
||
synchronized public void trigger(boolean value) { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package x.DeviceEffects; | ||
|
||
import x.DeviceUtils.DeviceListUtils; | ||
import x.Devices.OutputDevice; | ||
|
||
public class BridgeEffect extends BaseEffect { | ||
|
||
boolean bridgeValid = false; | ||
|
||
public BridgeEffect(int delay, String outputs) { | ||
super(delay, outputs); | ||
} | ||
|
||
@Override | ||
synchronized public void initEffect(long startTime) { | ||
super.initEffect(startTime); | ||
bridgeValid = false; | ||
} | ||
|
||
@Override | ||
synchronized public void trigger(boolean value) { | ||
if (idle == false) { | ||
if (value == true && (System.currentTimeMillis() - startTime) >= delay) { | ||
for (String output : outputs) { | ||
OutputDevice o = DeviceListUtils.getInstance().getOutputById(output); | ||
if (o.isValue() != value) { | ||
o.sendMessage(value); | ||
} | ||
} | ||
bridgeValid = true; | ||
} else if (bridgeValid && value == false) { | ||
for (String output : outputs) { | ||
OutputDevice o = DeviceListUtils.getInstance().getOutputById(output); | ||
if (o.isValue() != value) { | ||
o.sendMessage(value); | ||
} | ||
} | ||
bridgeValid = false; | ||
idle = true; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.