Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Work on smart home demo

Christian Bauer390a43b26455
diff --git a/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoSetup.java b/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoSetup.java
index ba6d5b3af..17e948032 100644
--- a/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoSetup.java
+++ b/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoSetup.java
@@ -54,7 +54,7 @@ import static org.openremote.model.asset.agent.ProtocolConfiguration.initProtoco
public class ManagerDemoSetup extends AbstractManagerSetup {
// Update these numbers whenever you change a RULE_STATE flag in test data
- public static final int DEMO_RULE_STATES_APARTMENT_1 = 37;
+ public static final int DEMO_RULE_STATES_APARTMENT_1 = 38;
public static final int DEMO_RULE_STATES_APARTMENT_2 = 3;
public static final int DEMO_RULE_STATES_APARTMENT_3 = 0;
public static final int DEMO_RULE_STATES_SMART_HOME = DEMO_RULE_STATES_APARTMENT_1 + DEMO_RULE_STATES_APARTMENT_2 + DEMO_RULE_STATES_APARTMENT_3;
@@ -351,6 +351,16 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
apartment1.setLocation(geometryFactory.createPoint(new Coordinate(5.470945, 51.438000)));
apartment1.setType(RESIDENCE);
List<AssetAttribute> apartment1Attributes = Arrays.asList(
+ new AssetAttribute("alarmEnabled", AttributeType.BOOLEAN, Json.create(false))
+ .setMeta(
+ new Meta().add(
+ new MetaItem(AssetMeta.LABEL, Json.create("Alarm Enabled"))
+ ).add(
+ new MetaItem(AssetMeta.DESCRIPTION, Json.create("Send notifications when presence is detected"))
+ ).add(
+ new MetaItem(AssetMeta.RULE_STATE, Json.create(true))
+ )
+ ),
new AssetAttribute("vacationDays", AttributeType.INTEGER, Json.createNull())
.setMeta(
new Meta().add(
@@ -361,12 +371,12 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
new MetaItem(AssetMeta.RULE_STATE, Json.create(true))
)
),
- new AssetAttribute("automaticSceneSchedule", AttributeType.BOOLEAN, Json.create(false))
+ new AssetAttribute("autoSceneSchedule", AttributeType.BOOLEAN, Json.create(false))
.setMeta(
new Meta().add(
new MetaItem(AssetMeta.LABEL, Json.create("Automatic scene schedule"))
).add(
- new MetaItem(AssetMeta.DESCRIPTION, Json.create("Predict presence and automatically adjust scene execution"))
+ new MetaItem(AssetMeta.DESCRIPTION, Json.create("Predict presence and automatically adjust scene schedule"))
).add(
new MetaItem(AssetMeta.RULE_STATE, Json.create(true))
)
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesImport.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesImport.groovy
index 1f98b3298..506dc8366 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesImport.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesImport.groovy
@@ -119,18 +119,20 @@ class BasicRulesImport {
assert customerAEngine.allRulesets[0].enabled
assert customerAEngine.allRulesets[0].name == "Some customerA tenant demo rules"
assert customerAEngine.allRulesets[0].deploymentStatus == DeploymentStatus.DEPLOYED
+ def customerBEngine = rulesService.tenantDeployments.get(keycloakDemoSetup.customerBTenant.id)
+ assert customerBEngine == null
assert rulesService.assetDeployments.size() == 2
apartment1Engine = rulesService.assetDeployments.get(managerDemoSetup.apartment1Id)
- apartment2Engine = rulesService.assetDeployments.get(managerDemoSetup.apartment2Id)
- apartment3Engine = rulesService.assetDeployments.get(managerDemoSetup.apartment3Id)
assert apartment1Engine == null
+ apartment2Engine = rulesService.assetDeployments.get(managerDemoSetup.apartment2Id)
assert apartment2Engine != null
assert apartment2Engine.isRunning()
assert apartment2Engine.allRulesets.length == 1
assert apartment2Engine.allRulesets[0].enabled
assert apartment2Engine.allRulesets[0].name == "Some apartment 2 demo rules"
assert apartment2Engine.allRulesets[0].deploymentStatus == DeploymentStatus.DEPLOYED
+ apartment3Engine = rulesService.assetDeployments.get(managerDemoSetup.apartment3Id)
assert apartment3Engine != null
assert apartment3Engine.isRunning()
assert apartment3Engine.allRulesets.length == 1
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy
index f1488f5f9..7dfc9131d 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy
@@ -18,6 +18,7 @@ import org.openremote.model.AttributeType
import org.openremote.model.Meta
import org.openremote.model.MetaItem
import org.openremote.model.asset.AssetAttribute
+import org.openremote.model.asset.AssetEvent
import org.openremote.model.asset.AssetMeta
import org.openremote.model.asset.AssetType
import org.openremote.test.ManagerContainerTrait
@@ -38,6 +39,7 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
def resetRuleExecutionLoggers() {
globalEngineFiredRules.clear()
+ masterEngineFiredRules.clear()
customerAEngineFiredRules.clear()
smartHomeEngineFiredRules.clear()
apartment2EngineFiredRules.clear()
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentPresenceDetectionTest.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentPresenceDetectionTest.groovy
index bfbee19c0..bc0c45966 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentPresenceDetectionTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentPresenceDetectionTest.groovy
@@ -60,7 +60,7 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
managerDemoSetup.apartment1LivingroomId, "motionCounter", Json.create(i), getClockTimeOf(apartment1Engine)
)
assetProcessingService.sendAttributeEvent(motionCounterIncrement)
- new PollingConditions(timeout: 3, initialDelay: 0.2, delay: 0.2).eventually {
+ new PollingConditions(timeout: 5, initialDelay: 0.2, delay: 0.2).eventually {
assert insertedAssetEvents.any() { it.matches(motionCounterIncrement) }
}
advancePseudoClocks(3, MINUTES, container, apartment1Engine)
@@ -91,7 +91,7 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
)
expectedLastPresenceTimestamp = motionCounterIncrement.timestamp
assetProcessingService.sendAttributeEvent(motionCounterIncrement)
- new PollingConditions(timeout: 3, initialDelay: 0.2, delay: 0.2).eventually {
+ new PollingConditions(timeout: 5, initialDelay: 0.2, delay: 0.2).eventually {
assert insertedAssetEvents.any() { it.matches(motionCounterIncrement) }
}
advancePseudoClocks(1, MINUTES, container, apartment1Engine)
@@ -113,7 +113,7 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
)
expectedLastPresenceTimestamp = motionCounterIncrement.timestamp
assetProcessingService.sendAttributeEvent(motionCounterIncrement)
- new PollingConditions(timeout: 3, initialDelay: 0.2, delay: 0.2).eventually {
+ new PollingConditions(timeout: 5, initialDelay: 0.2, delay: 0.2).eventually {
assert insertedAssetEvents.any() { it.matches(motionCounterIncrement) }
}
advancePseudoClocks(90, SECONDS, container, apartment1Engine)
@@ -188,7 +188,7 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
managerDemoSetup.apartment2LivingroomId, "motionSensor", Json.create(true), getClockTimeOf(apartment2Engine)
)
assetProcessingService.sendAttributeEvent(motionSensorTrigger)
- new PollingConditions(timeout: 3, initialDelay: 0.2, delay: 0.2).eventually {
+ new PollingConditions(timeout: 5, initialDelay: 0.2, delay: 0.2).eventually {
assert insertedAssetEvents.any() { it.matches(motionSensorTrigger) }
}
advancePseudoClocks(3, MINUTES, container, apartment2Engine)
@@ -219,7 +219,7 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
)
expectedLastPresenceTimestamp = motionSensorTrigger.timestamp
assetProcessingService.sendAttributeEvent(motionSensorTrigger)
- new PollingConditions(timeout: 3, initialDelay: 0.2, delay: 0.2).eventually {
+ new PollingConditions(timeout: 5, initialDelay: 0.2, delay: 0.2).eventually {
assert insertedAssetEvents.any() { it.matches(motionSensorTrigger) }
}
advancePseudoClocks(1, MINUTES, container, apartment2Engine)
@@ -241,7 +241,7 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
)
expectedLastPresenceTimestamp = motionSensorTrigger.timestamp
assetProcessingService.sendAttributeEvent(motionSensorTrigger)
- new PollingConditions(timeout: 3, initialDelay: 0.2, delay: 0.2).eventually {
+ new PollingConditions(timeout: 5, initialDelay: 0.2, delay: 0.2).eventually {
assert insertedAssetEvents.any() { it.matches(motionSensorTrigger) }
}
advancePseudoClocks(90, SECONDS, container, apartment2Engine)