Compare commits

..

No commits in common. "master" and "BUILD-210" have entirely different histories.

791 changed files with 352833 additions and 65094 deletions

15
.classpath Executable file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="src" path="plugins/tellstick/src"/>
<classpathentry kind="src" path="plugins/tellstick/test"/>
<classpathentry kind="src" path="plugins/zwave/src"/>
<classpathentry kind="lib" path="lib/*"/>
<classpathentry kind="src" path="plugins/zwave/lib/*"/>
<classpathentry combineaccessrules="false" kind="src" path="/zutil-java"/>
<classpathentry kind="output" path="build"/>
</classpath>

4
.gitattributes vendored Normal file → Executable file
View file

@ -1,5 +1,5 @@
# Github language stats file
external/* linguist-vendored
lib/* linguist-vendored
*.css linguist-vendored
*.js linguist-vendored
resource/web/css/* linguist-vendored
resource/web/js/* linguist-vendored

16
.gitignore vendored Normal file → Executable file
View file

@ -1,14 +1,8 @@
# Configuration and dependencies
/screenlog.0*
/hal.conf
/hal.db*
/lib/zutil-*
/recordings/
# Runtime files
/screenlog.0*
/OZW_Log.txt
# Build and Ide files
build
.gradle
.idea
/lib/zutil-*
/OZW_Log.txt
/zwscene.xml
/zwcfg*.xml

17
.project Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>hal</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

80
Hal.iml Executable file
View file

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/resource" type="java-resource" relativeOutputPath="resource" />
<sourceFolder url="file://$MODULE_DIR$/plugins/hal-zwave/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/plugins/hal-tellstick/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/plugins/hal-tellstick/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/plugins/hal-raspberry/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/plugins/hal-zigbee/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/plugins/hal-zwave/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/plugins/hal-mqtt/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/plugins/hal-nutups/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/plugins/hal-netscan/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/plugins/hal-powerchallenge/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/plugins/hal-powerchallenge/resource" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/plugins/hal-mqtt/build" />
<excludeFolder url="file://$MODULE_DIR$/plugins/hal-netscan/build" />
<excludeFolder url="file://$MODULE_DIR$/plugins/hal-nutups/build" />
<excludeFolder url="file://$MODULE_DIR$/plugins/hal-powerchallenge/build" />
<excludeFolder url="file://$MODULE_DIR$/plugins/hal-raspberry/build" />
<excludeFolder url="file://$MODULE_DIR$/plugins/hal-tellstick/build" />
<excludeFolder url="file://$MODULE_DIR$/plugins/hal-zigbee/build" />
<excludeFolder url="file://$MODULE_DIR$/plugins/hal-zwave/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Zutil" />
<orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/plugins/hal-raspberry/lib" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$MODULE_DIR$/plugins/hal-raspberry/lib" recursive="false" />
</library>
</orderEntry>
<orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/plugins/hal-zwave/lib" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$MODULE_DIR$/plugins/hal-zwave/lib" recursive="false" />
</library>
</orderEntry>
<orderEntry type="module-library" scope="TEST">
<library name="JUnit4">
<CLASSES>
<root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.12.jar!/" />
<root url="jar://$APPLICATION_HOME_DIR$/lib/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library" exported="">
<library name="lib">
<CLASSES>
<root url="file://$MODULE_DIR$/lib" />
</CLASSES>
<JAVADOC />
<NATIVE>
<root url="file://$MODULE_DIR$/lib" />
</NATIVE>
<SOURCES>
<root url="jar://$USER_HOME$/.ideaLibSources/wzwave-0.0.3-sources.jar!/" />
<root url="jar://$USER_HOME$/.ideaLibSources/netty-all-4.0.46.Final-sources.jar!/" />
</SOURCES>
<jarDirectory url="file://$MODULE_DIR$/lib" recursive="false" />
</library>
</orderEntry>
</component>
</module>

17
Jenkinsfile vendored Normal file → Executable file
View file

@ -1,29 +1,30 @@
// Jenkinsfile (Pipeline Script)
node {
// Configure environment
env.JAVA_HOME = tool name: 'jdk-11'
env.JAVA_HOME = tool name: 'jdk8'
env.REPO_URL = "repo.koc.se/hal.git" //scm.getUserRemoteConfigs()[0].getUrl()
env.BUILD_NAME = "BUILD-${env.BUILD_ID}"
env.BUILD_NAME = "BUILD-" + env.BUILD_ID
checkout scm
stage('Build') {
sh './gradlew clean'
sh './gradlew build'
sh 'ant clean'
sh 'ant build-all'
}
stage('Test') {
try {
sh './gradlew test'
sh 'ant test-all'
} finally {
junit testResults: '**/build/test-results/test/*.xml'
step([$class: 'JUnitResultArchiver', testResults: 'build/reports/*.xml'])
}
}
stage('Package') {
sh './gradlew distZip'
archiveArtifacts artifacts: 'build/distributions/Hal.zip', fingerprint: true
sh 'ant package-all'
archiveArtifacts artifacts: 'build/release/**', fingerprint: true
// Tag artifact
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'f8e5f6c6-4adb-4ab2-bb5d-1c8535dff491',

2
LICENSE.txt Normal file → Executable file
View file

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2016-2025 Daniel Collin, Ziver Koc
Copyright (c) 2016 Daniel Collin, Ziver Koc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

67
README.md Normal file → Executable file
View file

@ -1,56 +1,44 @@
# Hal
Hal is a home automation hub with sensor statistics with the functionality to
share that data between friends. It has been developed to be very extensible so future
share that data between friends. It is developed to be very extensible so future
Sensors and other input devices can be supported.
Features:
- **Map**, Set up a house map with sensors and events mapped on a floorplan
- **Map**, Set up a house map with sensor and events mapped on a floorplan
- **Triggers and Actions**, IFTTT type functionality
- **Power;Challenge**, Sync power or sensor usage between friends to challenge each other to lower the power usage
- **[Google Assistant Integration](plugins/hal-assistant-google/READNME.md)**
- **Power;Challenge**, Sync power or sensor usage between friends to lower e.g Power usage
Currently supported devices:
- **Network Scanner**, IP scanner to detect devices on local network
- **NUT**, Linux UPS daemon
- **Tellstick**, Supported devices:
- NexaSelfLearning
- Oregon0x1A2D
- NexaSelfLearning
- Oregon0x1A2D
- **Raspberry Pi**, GPIO connected sensors
- **[Zigbee](plugins/hal-zigbee/README.md)**
- Temperature Sensors
- Humidity Sensors
- Pressure Sensors
- OnnOff Devices
- **Google Assistant**
- **MQTT Devices**
Under development (Not ready to be used yet)
- **Z-Wave**
The project is currently in alpha state, and as such things will change and break continuously.
The project is currently in alpha state, and as such things will change and break.
### Screenshots
![Week Graph](screenshot_01.jpg)
![](screenshot_01.jpg)
![Home Map](screenshot_02.jpg)
![](screenshot_02.jpg)
![Sensor Overview](screenshot_03.jpg)
![](screenshot_03.jpg)
![Event Overview](screenshot_04.jpg)
![](screenshot_04.jpg)
## Installing
To run the Hal server you first need to clone the git repository and then run the
gradle command to build and run the server:
ant command to build and run:
```
./gradlew run
ant run
```
Check `hal.conf.example` for available configuration options.
By default, HAL server will be listening to http://localhost:8080.
Check `hal.conf.example` for available configuration options.
## Running the tests
@ -58,34 +46,7 @@ The current test coverage is greatly lacking, but to run the available JUnit
test-cases run:
```
./gradlew test
```
## Architecture
```
HalAbstractControlerManager
|
| HalAbstractController
| |
| | HalAbstractDevice
| | |
.-----------. .------------. .--------.
| | | | | |
| | | | ----> | Device |
| | | | | |
| | ----> | Controller | '--------'
| | | | .--------.
| | | | | |
| Manager | | | ----> | Device |
| | | | | |
| | '------------' '--------'
| | .------------. .--------.
| | | | | |
| | ----> | Controller | ----> | Device |
| | | | | |
'-----------' '------------' '--------'
ant test
```
## Authors

View file

@ -59,28 +59,28 @@ bool parseArctechSelfLearning(uint8_t* bufStartP, uint8_t* bufEndP) { //start
uint64_t data = 0;
bool dimValuePresent;
uint8_t b1,b2,b3,b4;
//parse preamp
b1 = *bufStartP;
stepBufferPointer(&bufStartP);
b2 = *bufStartP;
stepBufferPointer(&bufStartP);
if (!IS_PREAMP(b1, b2)){
if(!IS_PREAMP(b1, b2)){
return false;
}
//parse data
uint16_t dataBitsInBuffer = (calculateBufferPointerDistance(bufStartP, bufEndP)-2) / 4; //each bit is representd by 4 high/low
if (dataBitsInBuffer == 32) {
dimValuePresent = false;
} else if (dataBitsInBuffer == 36){
}else if(dataBitsInBuffer == 36){
dimValuePresent = true;
} else {
return false;
}
for (uint8_t i = 0; i < dataBitsInBuffer; ++i) {
b1 = *bufStartP; //no of high
stepBufferPointer(&bufStartP);
@ -103,7 +103,7 @@ bool parseArctechSelfLearning(uint8_t* bufStartP, uint8_t* bufEndP) { //start
}
//data parsed - send event over serial
Serial.print(F("+Wclass:command;protocol:arctech;model:selflearning;data:0x"));
uint8_t hexToSend = (dimValuePresent ? 9 : 8);
for (int8_t i = hexToSend - 1; i >= 0; --i) {

View file

@ -17,29 +17,29 @@ void parseRadioRXBuffer() {
bool parse = false;
while (bufferReadP != bufferWriteP) { //stop if the read pointer is pointing to where the writing is currently performed
uint8_t sampleCount = *bufferReadP;
if ( (((uintptr_t)bufferReadP) & 0x1) == 1 ) { //buffer pointer is odd (stores highs)
//Serial.print("high:"); Serial.println(sampleCount);
if (prevValue >= SILENCE_LENGTH) {
startDataP = bufferReadP; //some new data must start here since this is the first "high" after a silent period
}
//stream data to stream parsers
parseOregonStream(HIGH, sampleCount);
} else { //buffer pointer is even (stores lows)
//Serial.print("low:"); Serial.println(sampleCount);
if (sampleCount >= SILENCE_LENGTH) { //evaluate if it is time to parse the curernt data
endDataP = bufferReadP; //this is a silient period and must be the end of a data
if (startDataP != 0){
if(startDataP != 0){
parse = true;
break;
}
}
//stream data to stream parsers
parseOregonStream(LOW, sampleCount);
}
//step the read pointer one step
@ -74,11 +74,11 @@ void parseRadioRXBuffer() {
//Let all available parsers parse the data set now.
parseArctechSelfLearning(startDataP, endDataP);
//TODO: add more parsers here
//reset the data pointers since the data have been parsed at this point
startDataP = 0;
endDataP = 0;
}; //end radioTask
void sendTCodedData(uint8_t* data, uint8_t T_long, uint8_t* timings, uint8_t repeat, uint8_t pause) {
@ -88,7 +88,7 @@ void sendTCodedData(uint8_t* data, uint8_t T_long, uint8_t* timings, uint8_t rep
for (int i = 0; i < T_long; ++i) {
uint8_t timeIndex = (data[i / 4] >> (6 - (2 * (i % 4)))) & 0x03;
if (timings[timeIndex] > 0 || i == T_long - 1) {
if (nextPinState){
if(nextPinState){
TX_PIN_HIGH();
}else{
TX_PIN_LOW();
@ -111,7 +111,7 @@ void sendSCodedData(uint8_t* data, uint8_t pulseCount, uint8_t repeat, uint8_t p
bool nextPinState = HIGH;
for (int i = 0; i < pulseCount; ++i) {
if (data[i] > 0 || i == pulseCount - 1) {
if (nextPinState){
if(nextPinState){
TX_PIN_HIGH();
}else{
TX_PIN_LOW();

0
arduino/HalMultiSensor/HalConfiguration.h Normal file → Executable file
View file

0
arduino/HalMultiSensor/HalInclude.h Normal file → Executable file
View file

0
arduino/HalMultiSensor/HalInterfaces.h Normal file → Executable file
View file

6
arduino/HalMultiSensor/HalMultiSensor.ino Normal file → Executable file
View file

@ -92,7 +92,7 @@ void loop()
// Send power consumption
#ifdef POWERCON_ENABLED
if (timerMultiplier % POWER_TIMER_MULTIPLIER == 0)
if(timerMultiplier % POWER_TIMER_MULTIPLIER == 0)
{
static PowerData powerData;
powerSensor->read(powerData); // not needed, only here for future use
@ -103,7 +103,7 @@ void loop()
// Handle temperature sensor
#ifdef TEMPERATURE_ENABLED
if (timerMultiplier % TEMPERATURE_TIMER_MULTIPLIER == 0)
if(timerMultiplier % TEMPERATURE_TIMER_MULTIPLIER == 0)
{
static TemperatureData tempData;
tempSensor->read(tempData);
@ -114,7 +114,7 @@ void loop()
// Handle light sensor
#ifdef LIGHT_ENABLED
if (timerMultiplier % LIGHT_TIMER_MULTIPLIER == 0)
if(timerMultiplier % LIGHT_TIMER_MULTIPLIER == 0)
{
static LightData lightData;
lightSensor->read(lightData);

0
arduino/HalMultiSensor/HalMultiSensorEnclosure.FCStd Normal file → Executable file
View file

View file

0
arduino/HalMultiSensor/HalMultiSensorEnclosure_top.stl Normal file → Executable file
View file

0
arduino/HalMultiSensor/Interrupt.cpp Normal file → Executable file
View file

0
arduino/HalMultiSensor/Interrupt.h Normal file → Executable file
View file

0
arduino/HalMultiSensor/ProtocolNexa.cpp Normal file → Executable file
View file

0
arduino/HalMultiSensor/ProtocolNexa.h Normal file → Executable file
View file

4
arduino/HalMultiSensor/ProtocolOregon.cpp Normal file → Executable file
View file

@ -83,14 +83,14 @@ inline void ProtocolOregon::setId(byte data[], byte id)
*/
inline void ProtocolOregon::setBatteryLevel(byte data[], bool level)
{
if (!level) data[4] = 0x0C;
if(!level) data[4] = 0x0C;
else data[4] = 0x00;
}
inline void ProtocolOregon::setTemperature(byte data[], float temp)
{
// Set temperature sign
if (temp < 0)
if(temp < 0)
{
data[6] = 0x08;
temp *= -1;

0
arduino/HalMultiSensor/ProtocolOregon.h Normal file → Executable file
View file

0
arduino/HalMultiSensor/SensorBH1750.cpp Normal file → Executable file
View file

0
arduino/HalMultiSensor/SensorBH1750.h Normal file → Executable file
View file

0
arduino/HalMultiSensor/SensorDHT.cpp Normal file → Executable file
View file

0
arduino/HalMultiSensor/SensorDHT.h Normal file → Executable file
View file

0
arduino/HalMultiSensor/SensorPhotocell.cpp Normal file → Executable file
View file

0
arduino/HalMultiSensor/SensorPhotocell.h Normal file → Executable file
View file

View file

@ -1,126 +0,0 @@
plugins {
id 'java'
id 'application'
}
/*
* The MIT License (MIT)
*
* Copyright (c) 2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// ------------------------------------
// Hal common configuration
// ------------------------------------
allprojects {
repositories {
mavenLocal()
mavenCentral()
}
}
subprojects {
apply plugin: 'java-library'
dependencies {
//implementation 'se.koc:zutil:1.0.314'
implementation 'se.koc:zutil:1.0.0-SNAPSHOT'
testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:hamcrest-core:2.2'
}
sourceSets {
main {
java {
srcDirs 'src'
}
// We do not want the resource folder to be included in the jar file
//resources {
// srcDir 'resource'
//}
}
test {
java {
srcDirs 'test'
}
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
//options.compilerArgs << "-Xlint:unchecked"
}
}
// ------------------------------------
// Hal general configuration
// ------------------------------------
dependencies {
project.subprojects.each { subProject ->
runtimeOnly subProject
}
}
distributions {
main {
contents {
// from root project
from 'hal.conf.example'
from 'logging.properties'
from 'run.sh'
// from subprojects
project.subprojects.each { subProject ->
into('bin') {
from "${subProject.projectDir}/resources/bin"
}
into('web') {
from "${subProject.projectDir}/resources/web"
}
into('resources') {
from ("${subProject.projectDir}/resources") {
exclude 'bin'
exclude 'web'
}
}
}
}
}
}
distTar.enabled = false
distZip.enabled = false
assemble.dependsOn(installDist)
project.gradle.startParameter.taskNames.each { taskName ->
if (taskName == 'distZip') {
distZip.enabled = true
}
}
application {
mainClass = 'se.hal.HalServer'
}
startScripts.enabled = false

200
build.xml Executable file
View file

@ -0,0 +1,200 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Hal" >
<!-- ________________________ PROPERTIES AND SETTINGS ________________________ -->
<!--common properties-->
<property name="root" value="." />
<property name="srcDir" value="${root}/src" />
<property name="testDir" value="${root}/test" />
<property name="libDir" value="${root}/lib" />
<property name="resourceDir" value="${root}/resource" />
<property name="buildRoot" value="${root}/build" />
<property name="compileDir" value="${buildRoot}/production" />
<property name="compileTestDir" value="${buildRoot}/test" />
<property name="releaseDir" value="${buildRoot}/release" />
<property name="reportsDir" value="${buildRoot}/reports" />
<property name="releaseJar" value="hal.jar" />
<property name="zutilVersion" value="1.0.251" />
<!-- ________________________ CLASSPATH ________________________ -->
<!--define standard arguments for javac-->
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<!--classpath included when building-->
<path id="classpath.build">
<fileset dir="${libDir}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${compileDir}" />
</path>
<path id="classpath.test">
<pathelement location="${compileTestDir}" />
<!--include libraries used for building-->
<path refid="classpath.build"/>
</path>
<!-- ________________________ EXECUTION TARGETS ________________________ -->
<target name="run" depends="package-all">
<java fork="true" failonerror="true" classname="se.hal.HalServer">
<classpath>
<pathelement path="${releaseDir}/${releaseJar}"/>
<pathelement path="${releaseDir}/plugins/*"/>
<pathelement path="${releaseDir}/lib/*"/>
</classpath>
</java>
</target>
<target name="debug-remote" depends="package">
<java fork="true" failonerror="true" classname="se.hal.HalServer">
<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" />
<classpath>
<pathelement path="${releaseDir}/${releaseJar}"/>
<pathelement path="${libDir}/*"/> <!--wildcard may not be platform independent, ok?-->
</classpath>
</java>
</target>
<!-- Test targets -->
<target name="test-all" depends="test,test-plugins" />
<target name="test" depends="build-test">
<mkdir dir="${reportsDir}" />
<junit printsummary="yes" haltonfailure="false" fork="true">
<classpath refid="classpath.test" />
<formatter type="plain" usefile="false" /> <!-- to screen -->
<formatter type="xml" /> <!-- to file -->
<batchtest todir="${reportsDir}" skipNonTests="true">
<fileset dir="${compileTestDir}" includes="**/*Test*.class" />
</batchtest>
</junit>
</target>
<target name="test-plugins" depends="build-test">
<subant target="test" verbose="true">
<fileset dir="plugins/" includes="*/build.xml"/>
</subant>
</target>
<!-- ________________________ BUILD TARGETS ________________________ -->
<!-- clean all build paths -->
<target name="clean">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${buildRoot}" includes="**/*"/>
</delete>
<!-- clean plugins -->
<subant target="clean" verbose="true">
<fileset dir="plugins/" includes="*/build.xml"/>
</subant>
</target>
<!-- build product code -->
<target name="build-all" depends="build,build-plugins" />
<target name="build" depends="build-dependencies">
<mkdir dir="${compileDir}" />
<javac srcdir="${srcDir}" destdir="${compileDir}" debug="yes" debugLevel="lines,vars,source" fork="yes">
<classpath refid="classpath.build" />
<include name="**/*.java" />
<exclude name="se/hal/tts/GoogleTTSClient.java" />
</javac>
<copy todir="${compileDir}">
<fileset dir="${srcDir}"
excludes="**/*.java" />
</copy>
</target>
<target name="build-dependencies">
<mkdir dir="${compileDir}" />
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${libDir}" includes="zutil-*"/>
</delete>
<get src="https://repo1.maven.org/maven2/se/koc/zutil/${zutilVersion}/zutil-${zutilVersion}.jar"
dest="${libDir}/" verbose="true" usetimestamp="true"/>
</target>
<target name="build-plugins" depends="build">
<subant target="build" verbose="true">
<fileset dir="plugins/" includes="*/build.xml"/>
</subant>
</target>
<target name="build-test" depends="build">
<mkdir dir="${compileTestDir}" />
<javac srcdir="${testDir}" destdir="${compileTestDir}" debug="yes" debugLevel="lines,vars,source" fork="yes">
<classpath refid="classpath.test" />
<include name="**/*.java" />
</javac>
<copy todir="${compileTestDir}">
<fileset dir="${testDir}"
excludes="**/*.java" />
</copy>
</target>
<!-- generate release packages -->
<target name="package-all" depends="package,package-plugins" />
<target name="package" depends="build">
<copy todir="${releaseDir}" >
<fileset file="${root}/hal.conf.example" />
<fileset file="${root}/hal-default.db" />
<fileset file="${root}/logging.properties" />
<fileset file="${root}/run.sh" />
</copy>
<copy todir="${releaseDir}/lib">
<fileset dir="${libDir}" excludes="junit-*.jar,hamcrest-*.jar" />
</copy>
<copy todir="${releaseDir}/resource">
<fileset dir="${resourceDir}" />
</copy>
<jar destfile="${releaseDir}/${releaseJar}" basedir="${compileDir}" />
</target>
<target name="package-plugins" depends="package">
<subant target="package" verbose="true">
<fileset dir="plugins/" includes="*/build.xml"/>
</subant>
<!-- Copy plugin jars -->
<copy todir="${releaseDir}/plugins" flatten="true" includeEmptyDirs="false">
<fileset dir="plugins/">
<include name="*/build/release/**"/>
</fileset>
</copy>
<!-- Copy plugin libs -->
<copy todir="${releaseDir}/lib" flatten="true" includeEmptyDirs="false">
<fileset dir="plugins/">
<include name="*/lib/**"/>
</fileset>
</copy>
<!-- Copy plugin resources -->
<copy todir="${releaseDir}/resources" includeEmptyDirs="false">
<fileset dir="plugins/">
<include name="*/resources/**"/>
</fileset>
</copy>
</target>
<!-- ________________________ UTILITY TARGETS ________________________ -->
<target name="clear-aggr-data-from-db" depends="">
<exec executable="sqlite3">
<arg line="hal.db 'DELETE FROM sensor_data_aggr'" />
</exec>
<!-- update all internal sensors aggregation version to indicate for peers that they need to re-sync all data -->
<exec executable="sqlite3">
<arg line="hal.db 'UPDATE sensor SET aggr_version = (aggr_version+1) WHERE id = (SELECT sensor.id FROM user, sensor WHERE user.external == 0 AND sensor.user_id = user.id)'" />
</exec>
</target>
</project>

103
build_plugin.xml Executable file
View file

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="abstract plugin build file" >
<!-- ________________________ PROPERTIES AND SETTINGS ________________________ -->
<!-- ____________ (THESE SHOULD BE SET BY IMPORTING BUILD SCRIPT) ____________ -->
<!--common properties-->
<!--
<property name="root" value="." />
<property name="srcDir" value="${root}/src" />
<property name="testDir" value="${root}/test" />
<property name="libDir" value="${root}/lib" />
<property name="buildRoot" value="${root}/build" />
<property name="compileDir" value="${buildRoot}/production" />
<property name="compileTestDir" value="${buildRoot}/test" />
<property name="releaseDir" value="${buildRoot}/release" />
<property name="releaseJar" value="tellstick.jar" />
<property name="reportsDir" value="../../${buildRoot}/reports" />
-->
<!-- ________________________ CLASSPATH ________________________ -->
<!--define standard arguments for javac-->
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<!--classpath included when building-->
<path id="classpath.build">
<fileset dir="${libDir}" erroronmissingdir="false">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${compileDir}" />
<!-- Hal core -->
<pathelement location="../../build/production" />
<fileset dir="../../lib">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="classpath.test">
<pathelement location="${compileTestDir}" />
<pathelement location="../../${compileTestDir}" />
<!--include libraries used for building-->
<path refid="classpath.build"/>
</path>
<!-- ________________________ EXECUTION TARGETS ________________________ -->
<target name="test" depends="build-test">
<mkdir dir="${reportsDir}" />
<junit printsummary="yes" haltonfailure="false" fork="true">
<classpath refid="classpath.test" />
<formatter type="plain" usefile="false" /> <!-- to screen -->
<formatter type="xml" /> <!-- to file -->
<batchtest todir="${reportsDir}" skipNonTests="true">
<fileset dir="${compileTestDir}" includes="**/*Test*.class" erroronmissingdir="false"/>
</batchtest>
</junit>
</target>
<!-- ________________________ BUILD TARGETS ________________________ -->
<!--clean all build paths-->
<target name="clean">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${buildRoot}" includes="**/*"/>
</delete>
</target>
<!--build product code-->
<target name="build">
<mkdir dir="${compileDir}" />
<javac srcdir="${srcDir}" destdir="${compileDir}" debug="yes" debugLevel="lines,vars,source" fork="yes">
<classpath refid="classpath.build" />
<include name="**/*.java" />
</javac>
<copy todir="${compileDir}">
<fileset dir="${srcDir}"
excludes="**/*.java" />
</copy>
</target>
<available file="${testDir}" property="testDirAvailable" value=""/>
<target name="build-test" depends="build" if="testDirAvailable">
<mkdir dir="${compileTestDir}" />
<javac srcdir="${testDir}" destdir="${compileTestDir}" debug="yes" debugLevel="lines,vars,source" fork="yes">
<classpath refid="classpath.test" />
<include name="**/*.java" />
</javac>
</target>
<target name="package" depends="build">
<copy todir="${releaseDir}/resource" failonerror="false">
<fileset dir="${resourceDir}" />
</copy>
<jar destfile="${releaseDir}/${releaseJar}" basedir="${compileDir}" />
</target>
</project>

0
external/tellstick-core/AUTHORS.txt vendored Normal file → Executable file
View file

0
external/tellstick-core/LICENSE.txt vendored Normal file → Executable file
View file

18
external/tellstick-core/Protocol.cpp vendored Normal file → Executable file
View file

@ -97,7 +97,7 @@ bool Protocol::checkBit(int data, int bitno) {
Protocol *Protocol::getProtocolInstance(const std::wstring &protocolname) {
if (TelldusCore::comparei(protocolname, L"arctech")) {
if(TelldusCore::comparei(protocolname, L"arctech")) {
return new ProtocolNexa();
} else if (TelldusCore::comparei(protocolname, L"brateck")) {
@ -151,7 +151,7 @@ Protocol *Protocol::getProtocolInstance(const std::wstring &protocolname) {
std::list<std::string> Protocol::getParametersForProtocol(const std::wstring &protocolName) {
std::list<std::string> parameters;
if (TelldusCore::comparei(protocolName, L"arctech")) {
if(TelldusCore::comparei(protocolName, L"arctech")) {
parameters.push_back("house");
parameters.push_back("unit");
@ -218,7 +218,7 @@ std::list<std::string> Protocol::decodeData(const std::string &fullData) {
std::string decoded = "";
ControllerMessage dataMsg(fullData);
if ( TelldusCore::comparei(dataMsg.protocol(), L"arctech") ) {
if( TelldusCore::comparei(dataMsg.protocol(), L"arctech") ) {
decoded = ProtocolNexa::decodeData(dataMsg);
if (decoded != "") {
retval.push_back(decoded);
@ -231,32 +231,32 @@ std::list<std::string> Protocol::decodeData(const std::string &fullData) {
if (decoded != "") {
retval.push_back(decoded);
}
} else if (TelldusCore::comparei(dataMsg.protocol(), L"everflourish") ) {
} else if(TelldusCore::comparei(dataMsg.protocol(), L"everflourish") ) {
decoded = ProtocolEverflourish::decodeData(dataMsg);
if (decoded != "") {
retval.push_back(decoded);
}
} else if (TelldusCore::comparei(dataMsg.protocol(), L"fineoffset") ) {
} else if(TelldusCore::comparei(dataMsg.protocol(), L"fineoffset") ) {
decoded = ProtocolFineoffset::decodeData(dataMsg);
if (decoded != "") {
retval.push_back(decoded);
}
} else if (TelldusCore::comparei(dataMsg.protocol(), L"mandolyn") ) {
} else if(TelldusCore::comparei(dataMsg.protocol(), L"mandolyn") ) {
decoded = ProtocolMandolyn::decodeData(dataMsg);
if (decoded != "") {
retval.push_back(decoded);
}
} else if (TelldusCore::comparei(dataMsg.protocol(), L"oregon") ) {
} else if(TelldusCore::comparei(dataMsg.protocol(), L"oregon") ) {
decoded = ProtocolOregon::decodeData(dataMsg);
if (decoded != "") {
retval.push_back(decoded);
}
} else if (TelldusCore::comparei(dataMsg.protocol(), L"x10") ) {
} else if(TelldusCore::comparei(dataMsg.protocol(), L"x10") ) {
decoded = ProtocolX10::decodeData(dataMsg);
if (decoded != "") {
retval.push_back(decoded);
}
} else if (TelldusCore::comparei(dataMsg.protocol(), L"hasta") ) {
} else if(TelldusCore::comparei(dataMsg.protocol(), L"hasta") ) {
decoded = ProtocolHasta::decodeData(dataMsg);
if (decoded != "") {
retval.push_back(decoded);

0
external/tellstick-core/Protocol.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolBrateck.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolBrateck.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolComen.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolComen.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolEverflourish.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolEverflourish.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolFineoffset.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolFineoffset.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolFuhaote.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolFuhaote.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolGroup.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolGroup.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolHasta.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolHasta.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolIkea.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolIkea.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolMandolyn.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolMandolyn.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolNexa.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolNexa.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolOregon.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolOregon.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolRisingSun.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolRisingSun.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolSartano.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolSartano.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolScene.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolScene.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolSilvanChip.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolSilvanChip.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolUpm.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolUpm.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolWaveman.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolWaveman.h vendored Normal file → Executable file
View file

2
external/tellstick-core/ProtocolX10.cpp vendored Normal file → Executable file
View file

@ -175,7 +175,7 @@ std::string ProtocolX10::decodeData(const ControllerMessage& dataMsg) {
retString << "house:" << static_cast<char>('A' + intHouse);
retString << ";unit:" << unit+1;
retString << ";method:";
if (method == 0) {
if(method == 0) {
retString << "turnon;";
} else {
retString << "turnoff;";

0
external/tellstick-core/ProtocolX10.h vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolYidong.cpp vendored Normal file → Executable file
View file

0
external/tellstick-core/ProtocolYidong.h vendored Normal file → Executable file
View file

0
external/tellstick-core/README.txt vendored Normal file → Executable file
View file

View file

View file

0
external/tellstick-driver/SerialDriver_Windows/amd64/ftbusui.dll vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/amd64/ftcserco.dll vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/amd64/ftd2xx.lib vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/amd64/ftd2xx64.dll vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/amd64/ftdibus.sys vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/amd64/ftlang.dll vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/amd64/ftser2k.sys vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/amd64/ftserui2.dll vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/dpinst-amd64.exe vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/dpinst-x86.exe vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/ftd2xx.h vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/ftdibus.cat vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/ftdibus.inf vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/ftdiport.cat vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/ftdiport.inf vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/i386/ftbusui.dll vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/i386/ftcserco.dll vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/i386/ftd2xx.dll vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/i386/ftd2xx.lib vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/i386/ftdibus.sys vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/i386/ftlang.dll vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/i386/ftser2k.sys vendored Normal file → Executable file
View file

0
external/tellstick-driver/SerialDriver_Windows/i386/ftserui2.dll vendored Normal file → Executable file
View file

Some files were not shown because too many files have changed in this diff Show more