Skip to content

Commit

Permalink
Demo setup updates and updated to latest font awesome icons
Browse files Browse the repository at this point in the history
  • Loading branch information
richturner committed Feb 11, 2019
1 parent e7d5385 commit e0bb0f3
Show file tree
Hide file tree
Showing 23 changed files with 8,723 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Binary file not shown.
6 changes: 1 addition & 5 deletions client/src/main/webapp/src/or-app/or-icons.html

Large diffs are not rendered by default.

Binary file not shown.
3,300 changes: 3,300 additions & 0 deletions client/src/main/webapp/src/or-app/webfonts/fa-brands-400.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
803 changes: 803 additions & 0 deletions client/src/main/webapp/src/or-app/webfonts/fa-regular-400.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4,520 changes: 4,520 additions & 0 deletions client/src/main/webapp/src/or-app/webfonts/fa-solid-900.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
public String apartment1LivingroomId;
public String apartment1KitchenId;
public String apartment1HallwayId;
public String apartment1Bedroom1Id;
public String apartment1BathroomId;
public String apartment2Id;
public String apartment3Id;
public String apartment2LivingroomId;
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand Down Expand Up @@ -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))
Expand All @@ -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)
};
Expand Down Expand Up @@ -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 ###################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e0bb0f3

Please sign in to comment.