Skip to content

Commit

Permalink
Merge pull request #1 from atennert/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
atennert authored Dec 30, 2016
2 parents 144827e + af3272e commit 689f52d
Show file tree
Hide file tree
Showing 70 changed files with 680 additions and 290 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = 3.1

buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.6.RELEASE")
Expand All @@ -21,7 +21,8 @@ subprojects {
targetCompatibility = 1.8

repositories {
mavenCentral()
jcenter()
maven { url "http://dl.bintray.com/atennert/com" }
flatDir {
dirs 'libs'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* the License.
*******************************************************************************/

package org.atennert.homectrl.controls;
package de.atennert.homectrl.controls;

import org.atennert.homectrl.event.EventBus;
import de.atennert.homectrl.event.EventBus;

public abstract class AbstractController<T>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* the License.
*******************************************************************************/

package org.atennert.homectrl.controls;

import org.atennert.homectrl.controls.util.IInitializable;
import org.atennert.homectrl.event.EControlUpdate;
import org.atennert.homectrl.event.EDeviceValueUpdate;
import org.atennert.homectrl.event.Subscribe;
import org.atennert.homectrl.util.ConfigurationField;
import org.atennert.homectrl.util.DeviceValue;
package de.atennert.homectrl.controls;

import de.atennert.homectrl.controls.util.IInitializable;
import de.atennert.homectrl.event.EControlUpdate;
import de.atennert.homectrl.event.EDeviceValueUpdate;
import de.atennert.homectrl.event.Subscribe;
import de.atennert.homectrl.util.ConfigurationField;
import de.atennert.homectrl.util.DeviceValue;

/**
* Heating controller that uses an inside and an outside temperature sensor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* the License.
*******************************************************************************/

package org.atennert.homectrl.controls;

import org.atennert.homectrl.controls.util.IInitializable;
import org.atennert.homectrl.event.EControlUpdate;
import org.atennert.homectrl.event.EDeviceValueUpdate;
import org.atennert.homectrl.event.Subscribe;
import org.atennert.homectrl.util.ConfigurationField;
import org.atennert.homectrl.util.DeviceValue;
package de.atennert.homectrl.controls;

import de.atennert.homectrl.controls.util.IInitializable;
import de.atennert.homectrl.event.EControlUpdate;
import de.atennert.homectrl.event.EDeviceValueUpdate;
import de.atennert.homectrl.event.Subscribe;
import de.atennert.homectrl.util.ConfigurationField;
import de.atennert.homectrl.util.DeviceValue;

/**
* Simple heating controller that uses an inside and an outside temperature sensor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* the License.
*******************************************************************************/

package org.atennert.homectrl.controls;

import org.atennert.homectrl.controls.util.IInitializable;
import org.atennert.homectrl.event.EControlUpdate;
import org.atennert.homectrl.event.EDeviceValueUpdate;
import org.atennert.homectrl.event.Subscribe;
import org.atennert.homectrl.util.ConfigurationField;
import org.atennert.homectrl.util.DeviceValue;
package de.atennert.homectrl.controls;

import de.atennert.homectrl.controls.util.IInitializable;
import de.atennert.homectrl.event.EControlUpdate;
import de.atennert.homectrl.event.EDeviceValueUpdate;
import de.atennert.homectrl.event.Subscribe;
import de.atennert.homectrl.util.ConfigurationField;
import de.atennert.homectrl.util.DeviceValue;

/**
* Heating controller that uses an inside and an outside temperature sensor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.atennert.homectrl.controls.util;
package de.atennert.homectrl.controls.util;

import java.util.Set;

import org.atennert.homectrl.controls.AbstractController;
import org.atennert.homectrl.event.EventBus;
import de.atennert.homectrl.controls.AbstractController;
import de.atennert.homectrl.event.EventBus;
import org.springframework.beans.factory.annotation.Autowired;

public class ControlManager
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.atennert.homectrl.controls.util;
package de.atennert.homectrl.controls.util;

/**
* Since controllers are generated from a special device configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

package org.atennert.homectrl.dataprocessing;
package de.atennert.homectrl.dataprocessing;

import org.atennert.homectrl.event.EventBus;
import de.atennert.homectrl.event.EventBus;

public abstract class AbstractDataProcessor<T>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* the License.
*******************************************************************************/

package org.atennert.homectrl.dataprocessing;
package de.atennert.homectrl.dataprocessing;

import java.util.HashMap;

import org.atennert.homectrl.event.EDeviceValueUpdate;
import org.atennert.homectrl.event.Subscribe;
import org.atennert.homectrl.util.ConfigurationField;
import de.atennert.homectrl.event.EDeviceValueUpdate;
import de.atennert.homectrl.event.Subscribe;
import de.atennert.homectrl.util.ConfigurationField;

/**
* Virtual sensor which returns the highest integer value from a set of sensors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* the License.
*******************************************************************************/

package org.atennert.homectrl.dataprocessing;
package de.atennert.homectrl.dataprocessing;

import java.util.Map;

import org.atennert.homectrl.event.EDeviceValueUpdate;
import org.atennert.homectrl.event.Subscribe;
import org.atennert.homectrl.util.ConfigurationField;
import de.atennert.homectrl.event.EDeviceValueUpdate;
import de.atennert.homectrl.event.Subscribe;
import de.atennert.homectrl.util.ConfigurationField;

/**
* Virtual sensor which checks if a sensor value is larger than a given limit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* the License.
*******************************************************************************/

package org.atennert.homectrl.dataprocessing;
package de.atennert.homectrl.dataprocessing;

import java.util.Collection;
import java.util.HashMap;

import org.atennert.homectrl.event.EDeviceValueUpdate;
import org.atennert.homectrl.event.Subscribe;
import org.atennert.homectrl.util.ConfigurationField;
import de.atennert.homectrl.event.EDeviceValueUpdate;
import de.atennert.homectrl.event.Subscribe;
import de.atennert.homectrl.util.ConfigurationField;

/**
* Virtual sensor which computes the logical AND from a set of boolean
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*******************************************************************************
* Copyright 2016 Andreas Tennert
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*******************************************************************************/
package de.atennert.homectrl.dataprocessing;

import de.atennert.homectrl.event.EDeviceValueUpdate;
import de.atennert.homectrl.event.Subscribe;
import de.atennert.homectrl.util.ConfigurationField;

import java.util.Map;

/**
* This sensor is used to combine sensor values with an or combinator.
* It forwards <code>true</code> if at least one of the inputs is
* <code>true</code>, <code>false</code> otherwise.
*/
public class LogicalOrProcessor extends AbstractDataProcessor<Boolean> {

private final Map<Integer, Boolean> sensors;

public LogicalOrProcessor(
@ConfigurationField(fieldId = "id") int id,
@ConfigurationField(fieldId = "resources") Map<Integer, Boolean> sensors)
{
super(id, false);

this.sensors = sensors;
}

@Subscribe
public void update(EDeviceValueUpdate event)
{
if (sensors.containsKey(event.deviceId))
{
sensors.put(event.deviceId, (Boolean)event.value);

final boolean oldProcessorValue = processorValue;
processorValue = sensors.values().stream().anyMatch(status -> status);

if (oldProcessorValue != processorValue) {
eventBus.post(processorId, new EDeviceValueUpdate(processorId, processorValue));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* the License.
*******************************************************************************/

package org.atennert.homectrl.dataprocessing;
package de.atennert.homectrl.dataprocessing;

import java.util.HashMap;

import org.atennert.homectrl.event.EDeviceValueUpdate;
import org.atennert.homectrl.event.Subscribe;
import org.atennert.homectrl.util.ConfigurationField;
import de.atennert.homectrl.event.EDeviceValueUpdate;
import de.atennert.homectrl.event.Subscribe;
import de.atennert.homectrl.util.ConfigurationField;

/**
* Virtual sensor for temperature calculation that listens to other temperature sensors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.atennert.homectrl.dataprocessing.util;
package de.atennert.homectrl.dataprocessing.util;

import java.util.Set;

import org.atennert.homectrl.dataprocessing.AbstractDataProcessor;
import org.atennert.homectrl.event.EventBus;
import de.atennert.homectrl.dataprocessing.AbstractDataProcessor;
import de.atennert.homectrl.event.EventBus;
import org.springframework.beans.factory.annotation.Autowired;

public class ProcessorManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
{
"type": "processor",
"name": "estimatedOutsideTemperature",
"class": "org.atennert.homectrl.dataprocessing.LowPrioritizingDoubleProcessor",
"class": "de.atennert.homectrl.dataprocessing.LowPrioritizingDoubleProcessor",
"id": 5,
"value": 20,
"data": "double",
Expand All @@ -152,7 +152,7 @@
{
"type": "processor",
"name": "highestOutsideBrightness",
"class": "org.atennert.homectrl.dataprocessing.HighIntegerProcessor",
"class": "de.atennert.homectrl.dataprocessing.HighIntegerProcessor",
"id": 8,
"value": 600,
"data": "integer",
Expand All @@ -161,7 +161,7 @@
{
"type": "processor",
"name": "isItCloudyOrDark",
"class": "org.atennert.homectrl.dataprocessing.IntegerIsUnderLimitProcessor",
"class": "de.atennert.homectrl.dataprocessing.IntegerIsUnderLimitProcessor",
"id": 9,
"value": false,
"data": "boolean",
Expand All @@ -171,7 +171,7 @@
{
"type": "processor",
"name": "heatingActive",
"class": "org.atennert.homectrl.dataprocessing.LogicalAndProcessor",
"class": "de.atennert.homectrl.dataprocessing.LogicalAndProcessor",
"id": 10,
"value": false,
"data": "boolean",
Expand All @@ -180,7 +180,7 @@
{
"type": "control",
"name": "workRoomHeatingController",
"class": "org.atennert.homectrl.controls.ActivatableHeatingController",
"class": "de.atennert.homectrl.controls.ActivatableHeatingController",
"actorId": 10001,
"value": false,
"outsideSensorId": 5,
Expand All @@ -192,7 +192,7 @@
{
"type": "control",
"name": "livingRoomHeatingController",
"class": "org.atennert.homectrl.controls.ActivatableHeatingController",
"class": "de.atennert.homectrl.controls.ActivatableHeatingController",
"actorId": 10002,
"value": false,
"outsideSensorId": 5,
Expand Down
10 changes: 10 additions & 0 deletions example-server.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# communication address properties
homectrl.server.address.http=192.168.0.2:80
homectrl.server.address.enocean=/dev/ttyUSB0

# database information
homectrl.server.logDb.driverClassName = org.sqlite.JDBC
homectrl.server.logDb.url = jdbc:sqlite:homectrlLog.sqlite
homectrl.server.logDb.username = "user"
homectrl.server.logDb.password = "pwd"
1 change: 1 addition & 0 deletions homectrl-com-if/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ version = "0.0.2"

dependencies {
compile project(':homectrl')
compile 'de.atennert:com:2+'
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* the License.
*******************************************************************************/

package org.atennert.homectrl.communication;
package de.atennert.homectrl.communication;

import org.atennert.com.communication.AbstractReceiver;
import de.atennert.com.communication.AbstractReceiver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Required;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//Please contact the author if you need another license.
//This module is provided "as is", without warranties of any kind.

package org.atennert.homectrl.communication;
package de.atennert.homectrl.communication;

/**
* A Base64 encoder/decoder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Boston, MA 02110-1301, USA.
*******************************************************************************/

package org.atennert.homectrl.communication;
package de.atennert.homectrl.communication;

/**
* This class contains hepler methods for encoding and decoding EnOcean data
Expand Down
Loading

0 comments on commit 689f52d

Please sign in to comment.