Permalink
Browse files

Demo setup updates and updated to latest font awesome icons

  • Loading branch information...
richturner committed Feb 11, 2019
1 parent e7d5385 commit e0bb0f35e9c4384861ecde2f77be275e75e3a416
Showing with 8,723 additions and 17 deletions.
  1. +3 −0 client/src/main/java/org/openremote/app/client/apps/ConsoleAppsActivity.java
  2. BIN client/src/main/webapp/src/or-app/fontawesome-webfont.woff2
  3. +1 −5 client/src/main/webapp/src/or-app/or-icons.html
  4. BIN client/src/main/webapp/src/or-app/webfonts/fa-brands-400.eot
  5. +3,300 −0 client/src/main/webapp/src/or-app/webfonts/fa-brands-400.svg
  6. BIN client/src/main/webapp/src/or-app/webfonts/fa-brands-400.ttf
  7. BIN client/src/main/webapp/src/or-app/webfonts/fa-brands-400.woff
  8. BIN client/src/main/webapp/src/or-app/webfonts/fa-brands-400.woff2
  9. BIN client/src/main/webapp/src/or-app/webfonts/fa-regular-400.eot
  10. +803 −0 client/src/main/webapp/src/or-app/webfonts/fa-regular-400.svg
  11. BIN client/src/main/webapp/src/or-app/webfonts/fa-regular-400.ttf
  12. BIN client/src/main/webapp/src/or-app/webfonts/fa-regular-400.woff
  13. BIN client/src/main/webapp/src/or-app/webfonts/fa-regular-400.woff2
  14. BIN client/src/main/webapp/src/or-app/webfonts/fa-solid-900.eot
  15. +4,520 −0 client/src/main/webapp/src/or-app/webfonts/fa-solid-900.svg
  16. BIN client/src/main/webapp/src/or-app/webfonts/fa-solid-900.ttf
  17. BIN client/src/main/webapp/src/or-app/webfonts/fa-solid-900.woff
  18. BIN client/src/main/webapp/src/or-app/webfonts/fa-solid-900.woff2
  19. +91 −7 manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java
  20. +1 −1 manager/src/main/resources/demo/rules/DemoResidenceVacationMode.groovy
  21. +1 −1 test/src/test/groovy/org/openremote/test/protocol/MacroProtocolTest.groovy
  22. +1 −1 test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy
  23. +2 −2 test/src/test/groovy/org/openremote/test/rules/residence/ResidenceVacationModeTest.groovy
@@ -28,6 +28,7 @@
import org.openremote.model.event.bus.EventRegistration;

import javax.inject.Inject;
import java.util.Arrays;
import java.util.Collection;

public class ConsoleAppsActivity
@@ -65,6 +66,8 @@ public void start(AcceptsView container, EventBus eventBus, Collection<EventRegi
consoleAppResource::getInstalledApps,
200,
appNames -> {
// Remove manager (this app)
appNames = Arrays.stream(appNames).filter(name -> !name.equalsIgnoreCase("manager")).toArray(String[]::new);
view.setApps(appNames);
if (getPlace().getRealm() != null) {
for (String appName : appNames) {
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -76,6 +76,8 @@
public String apartment1LivingroomId;
public String apartment1KitchenId;
public String apartment1HallwayId;
public String apartment1Bedroom1Id;
public String apartment1BathroomId;
public String apartment2Id;
public String apartment3Id;
public String apartment2LivingroomId;
@@ -425,7 +427,23 @@ public void onStart() throws Exception {
/* ############################ ROOMS ############################## */

Asset apartment1Livingroom = createDemoApartmentRoom(apartment1, "Living Room")
.addAttributes(new AssetAttribute(AttributeType.LOCATION, locationValueA));
.addAttributes(
new AssetAttribute(AttributeType.LOCATION, locationValueA),
new AssetAttribute("lightsCeiling", NUMBER, Values.create(0))
.setMeta(
new MetaItem(RANGE_MIN, Values.create(0)),
new MetaItem(RANGE_MAX, Values.create(100)),
new MetaItem(LABEL, Values.create("Living room ceiling")),
new MetaItem(ACCESS_RESTRICTED_READ, Values.create(true)),
new MetaItem(ACCESS_RESTRICTED_WRITE, Values.create(true))
),
new AssetAttribute("lightsStand", AttributeValueType.BOOLEAN, Values.create(true))
.setMeta(
new MetaItem(LABEL, Values.create("Living room stand")),
new MetaItem(ACCESS_RESTRICTED_READ, Values.create(true)),
new MetaItem(ACCESS_RESTRICTED_WRITE, Values.create(true))
)
);
addDemoApartmentRoomMotionSensor(apartment1Livingroom, true, () -> new MetaItem[]{
new MetaItem(AGENT_LINK, new AttributeRef(apartment1ServiceAgentId, "apartmentSimulator").toArrayValue()),
new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
@@ -451,7 +469,12 @@ public void onStart() throws Exception {
apartment1LivingroomId = apartment1Livingroom.getId();

Asset apartment1Kitchen = createDemoApartmentRoom(apartment1, "Kitchen")
.addAttributes(new AssetAttribute(AttributeType.LOCATION, locationValueA));
.addAttributes(
new AssetAttribute(AttributeType.LOCATION, locationValueA),
new AssetAttribute("lights", AttributeValueType.BOOLEAN, Values.create(true))
.addMeta(new MetaItem(ACCESS_RESTRICTED_READ, Values.create(true)))
.addMeta(new MetaItem(ACCESS_RESTRICTED_WRITE, Values.create(true)))
);
addDemoApartmentRoomMotionSensor(apartment1Kitchen, true, () -> new MetaItem[]{
new MetaItem(AGENT_LINK, new AttributeRef(apartment1ServiceAgentId, "apartmentSimulator").toArrayValue()),
new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
@@ -493,7 +516,12 @@ public void onStart() throws Exception {
apartment1KitchenId = apartment1Kitchen.getId();

Asset apartment1Hallway = createDemoApartmentRoom(apartment1, "Hallway")
.addAttributes(new AssetAttribute(AttributeType.LOCATION, locationValueA));
.addAttributes(
new AssetAttribute(AttributeType.LOCATION, locationValueA),
new AssetAttribute("lights", AttributeValueType.BOOLEAN, Values.create(true))
.addMeta(new MetaItem(ACCESS_RESTRICTED_READ, Values.create(true)))
.addMeta(new MetaItem(ACCESS_RESTRICTED_WRITE, Values.create(true)))
);
addDemoApartmentRoomMotionSensor(apartment1Hallway, true, () -> new MetaItem[]{
new MetaItem(AGENT_LINK, new AttributeRef(apartment1ServiceAgentId, "apartmentSimulator").toArrayValue()),
new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
@@ -502,17 +530,67 @@ public void onStart() throws Exception {
apartment1Hallway = assetStorageService.merge(apartment1Hallway);
apartment1HallwayId = apartment1Hallway.getId();

Asset apartment1Bedroom1 = createDemoApartmentRoom(apartment1, "Bedroom")
.addAttributes(
new AssetAttribute(AttributeType.LOCATION, locationValueA),
new AssetAttribute("lights", AttributeValueType.BOOLEAN, Values.create(true))
.addMeta(new MetaItem(ACCESS_RESTRICTED_READ, Values.create(true)))
.addMeta(new MetaItem(ACCESS_RESTRICTED_WRITE, Values.create(true)))
);
addDemoApartmentRoomCO2Sensor(apartment1Bedroom1, true, () -> new MetaItem[]{
new MetaItem(AGENT_LINK, new AttributeRef(apartment1ServiceAgentId, "apartmentSimulator").toArrayValue()),
new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
});
addDemoApartmentRoomHumiditySensor(apartment1Bedroom1, true, () -> new MetaItem[]{
new MetaItem(AGENT_LINK, new AttributeRef(apartment1ServiceAgentId, "apartmentSimulator").toArrayValue()),
new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
});
addDemoApartmentRoomThermometer(apartment1Bedroom1, true, () -> new MetaItem[]{
new MetaItem(AGENT_LINK, new AttributeRef(apartment1ServiceAgentId, "apartmentSimulator").toArrayValue()),
new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
});
addDemoApartmentTemperatureControl(apartment1Bedroom1, true, () -> new MetaItem[]{
new MetaItem(AGENT_LINK, new AttributeRef(apartment1ServiceAgentId, "apartmentSimulator").toArrayValue()),
new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
});

apartment1Bedroom1 = assetStorageService.merge(apartment1Bedroom1);
apartment1Bedroom1Id = apartment1Bedroom1.getId();

Asset apartment1Bathroom = new Asset("Bathroom", ROOM, apartment1);
apartment1Bathroom.addAttributes(
new AssetAttribute(AttributeType.LOCATION, locationValueA),
new AssetAttribute("lights", AttributeValueType.BOOLEAN, Values.create(true))
.setMeta(
new MetaItem(RULE_STATE, Values.create(true)),
new MetaItem(ACCESS_RESTRICTED_READ, Values.create(true)),
new MetaItem(ACCESS_RESTRICTED_WRITE, Values.create(true))
)
);
addDemoApartmentRoomThermometer(apartment1Bathroom, true, () -> new MetaItem[]{
new MetaItem(AGENT_LINK, new AttributeRef(apartment1ServiceAgentId, "apartmentSimulator").toArrayValue()),
new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
});
addDemoApartmentTemperatureControl(apartment1Bathroom, true, () -> new MetaItem[]{
new MetaItem(AGENT_LINK, new AttributeRef(apartment1ServiceAgentId, "apartmentSimulator").toArrayValue()),
new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
});
apartment1Bathroom = assetStorageService.merge(apartment1Bathroom);
apartment1BathroomId = apartment1Bathroom.getId();


addDemoApartmentVentilation(apartment1, true, () -> new MetaItem[]{
new MetaItem(AGENT_LINK, new AttributeRef(apartment1ServiceAgentId, "apartmentSimulator").toArrayValue()),
new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
});

apartment1 = assetStorageService.merge(apartment1);
apartment1Id = apartment1.getId();

if (importDemoScenes) {
Scene[] scenes = new Scene[]{
new Scene("homeScene", "Home scene", "HOME", "0 0 7 ? *", false, 21d),
new Scene("awayScene", "Away scene", "AWAY", "0 30 8 ? *", true, 15d),
new Scene("morningScene", "Morning scene", "MORNING", "0 0 7 ? *", false, 21d),
new Scene("dayScene", "Day scene", "DAY", "0 30 8 ? *", true, 15d),
new Scene("eveningScene", "Evening scene", "EVENING", "0 30 17 ? *", false, 22d),
new Scene("nightScene", "Night scene", "NIGHT", "0 0 22 ? *", true, 19d)
};
@@ -651,10 +729,16 @@ public void onStart() throws Exception {
apartment1KitchenId));
assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.tenantA.getId(),
keycloakDemoSetup.testuser3Id,
apartment1HallwayId));
apartment1Bedroom1Id));
assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.tenantA.getId(),
keycloakDemoSetup.testuser3Id,
apartment2Id));
apartment1BathroomId));
assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.tenantA.getId(),
keycloakDemoSetup.testuser3Id,
apartment1HallwayId));
// assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.tenantA.getId(),
// keycloakDemoSetup.testuser2Id,
// apartment2Id));

// ################################ Make users restricted ###################################

@@ -24,7 +24,7 @@ class VacationMode {
}

rules.add()
.name("When residence has vacation until in future, add vacation mode, execute AWAY scene and disable scene timers")
.name("When residence has vacation until in future, add vacation mode, execute DAY scene and disable scene timers")
.when(
{ facts ->
facts.matchAssetState(
@@ -65,7 +65,7 @@ class MacroProtocolTest extends Specification implements ManagerContainerTrait {
def apartment1 = assetStorageService.find(managerDemoSetup.apartment1Id, true)
def livingRoom = assetStorageService.find(managerDemoSetup.apartment1LivingroomId, true)
assert apartment1.getAttribute("alarmEnabled").get().getValueAsBoolean().orElse(false)
assert apartment1.getAttribute("lastExecutedScene").get().getValueAsString().orElse("") == "AWAY"
assert apartment1.getAttribute("lastExecutedScene").get().getValueAsString().orElse("") == "DAY"
assert livingRoom.getAttribute("targetTemperature").get().getValueAsNumber().orElse(0d) == 15d
}

@@ -175,7 +175,7 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
conditions.eventually {
apartment1 = assetStorageService.find(apartment1.id, true)
apartment1.getAttribute("awayScene").get().getValueAsString().get() == "COMPLETED"
apartment1.getAttribute("lastExecutedScene").get().getValueAsString().get() == "AWAY"
apartment1.getAttribute("lastExecutedScene").get().getValueAsString().get() == "DAY"
}

when: "a trigger is deleted"
@@ -68,11 +68,11 @@ class ResidenceVacationModeTest extends Specification implements ManagerContaine
managerDemoSetup.apartment1Id, "vacationUntil", Values.create(fiveDaysInFuture)
))

then: "the AWAY scene should be executed and scene timers disabled"
then: "the DAY scene should be executed and scene timers disabled"
conditions.eventually {
def asset = assetStorageService.find(managerDemoSetup.apartment1Id, true)
def executionStatus = AttributeExecuteStatus.fromString(
asset.getAttribute("awayScene").get().getValueAsString().get()
asset.getAttribute("dayScene").get().getValueAsString().get()
).get()
assert executionStatus == AttributeExecuteStatus.COMPLETED
assert !asset.getAttribute("sceneTimerEnabled").get().getValueAsBoolean().get()

0 comments on commit e0bb0f3

Please sign in to comment.