Skip to content

armgit / core

Public Imported from GitHub
0

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

Demo setup update to include rules

Rich Turnerbefc94a234d0
diff --git a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
index 516c428e3..ad58fe457 100644
--- a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
+++ b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
@@ -48,12 +48,11 @@ import java.util.function.Supplier;
import static org.openremote.agent.protocol.macro.MacroProtocol.META_MACRO_ACTION_INDEX;
import static org.openremote.agent.protocol.timer.TimerConfiguration.initTimerConfiguration;
import static org.openremote.agent.protocol.timer.TimerProtocol.META_TIMER_VALUE_LINK;
-import static org.openremote.model.Constants.UNITS_DENSITY_MICROGRAMS_CUBIC_M;
import static org.openremote.model.Constants.UNITS_TEMPERATURE_CELSIUS;
-import static org.openremote.model.attribute.MetaItemType.*;
import static org.openremote.model.asset.AssetType.*;
import static org.openremote.model.asset.agent.ProtocolConfiguration.initProtocolConfiguration;
import static org.openremote.model.attribute.AttributeValueType.*;
+import static org.openremote.model.attribute.MetaItemType.*;
public abstract class AbstractManagerSetup implements Setup {
@@ -661,34 +660,20 @@ public abstract class AbstractManagerSetup implements Setup {
Asset environmentAsset = new Asset(name, ENVIRONMENT_SENSOR, area).addAttributes(
new AssetAttribute(AttributeType.LOCATION, location.toValue()).addMeta(SHOW_ON_DASHBOARD)
);
- environmentAsset.getAttribute("temperature").ifPresent(assetAttribute -> assetAttribute.addMeta(
- new MetaItem(RULE_STATE),
- new MetaItem(STORE_DATA_POINTS)
- ).addMeta(agentLinker.get()));
- environmentAsset.getAttribute("nO2").ifPresent(assetAttribute -> assetAttribute.addMeta(
- new MetaItem(RULE_STATE),
- new MetaItem(STORE_DATA_POINTS)
- ).addMeta(agentLinker.get()));
- environmentAsset.getAttribute("relHumidity").ifPresent(assetAttribute -> assetAttribute.addMeta(
- new MetaItem(RULE_STATE),
- new MetaItem(STORE_DATA_POINTS)
- ).addMeta(agentLinker.get()));
- environmentAsset.getAttribute("ozone").ifPresent(assetAttribute -> assetAttribute.addMeta(
- new MetaItem(RULE_STATE),
- new MetaItem(STORE_DATA_POINTS)
- ).addMeta(agentLinker.get()));
- environmentAsset.getAttribute("particlesPM1").ifPresent(assetAttribute -> assetAttribute.addMeta(
- new MetaItem(RULE_STATE),
- new MetaItem(STORE_DATA_POINTS)
- ).addMeta(agentLinker.get()));
- environmentAsset.getAttribute("particlesPM2_5").ifPresent(assetAttribute -> assetAttribute.addMeta(
- new MetaItem(RULE_STATE),
- new MetaItem(STORE_DATA_POINTS)
- ).addMeta(agentLinker.get()));
- environmentAsset.getAttribute("particlesPM10").ifPresent(assetAttribute -> assetAttribute.addMeta(
- new MetaItem(RULE_STATE),
- new MetaItem(STORE_DATA_POINTS)
- ).addMeta(agentLinker.get()));
+ environmentAsset.getAttribute("temperature").ifPresent(assetAttribute -> assetAttribute
+ .addMeta(agentLinker.get()));
+ environmentAsset.getAttribute("nO2").ifPresent(assetAttribute -> assetAttribute
+ .addMeta(agentLinker.get()));
+ environmentAsset.getAttribute("relHumidity").ifPresent(assetAttribute -> assetAttribute
+ .addMeta(agentLinker.get()));
+ environmentAsset.getAttribute("ozone").ifPresent(assetAttribute -> assetAttribute
+ .addMeta(agentLinker.get()));
+ environmentAsset.getAttribute("particlesPM1").ifPresent(assetAttribute -> assetAttribute
+ .addMeta(agentLinker.get()));
+ environmentAsset.getAttribute("particlesPM2_5").ifPresent(assetAttribute -> assetAttribute
+ .addMeta(agentLinker.get()));
+ environmentAsset.getAttribute("particlesPM10").ifPresent(assetAttribute -> assetAttribute
+ .addMeta(agentLinker.get()));
return environmentAsset;
}
diff --git a/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java b/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java
index 241b5786d..4d2b2b36d 100644
--- a/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java
+++ b/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java
@@ -63,7 +63,7 @@ public class RulesDemoSetup extends AbstractManagerSetup {
try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/DemoGeofence.json")) {
String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
Ruleset ruleset = new TenantRuleset(
- keycloakDemoSetup.tenantCity.getRealm(), "De Kuip", Ruleset.Lang.JSON, rules
+ keycloakDemoSetup.tenantCity.getRealm(), "Demo Geofences", Ruleset.Lang.JSON, rules
).setAccessPublicRead(true).addMeta("showOnMap", Values.create(true)).addMeta("showOnList", Values.create(true));
tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
}
@@ -83,5 +83,101 @@ public class RulesDemoSetup extends AbstractManagerSetup {
).setAccessPublicRead(true).addMeta("showOnMap", Values.create(true)).addMeta("showOnList", Values.create(true));
tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
}
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/DeKuip.json")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "De Kuip", Ruleset.Lang.JSON, rules
+ ).setAccessPublicRead(true).addMeta("showOnMap", Values.create(true)).addMeta("showOnList", Values.create(true));
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/Euromast.json")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "Euromast", Ruleset.Lang.JSON, rules
+ ).setAccessPublicRead(true).addMeta("showOnMap", Values.create(true)).addMeta("showOnList", Values.create(true));
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/Markthal.json")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "Markthal", Ruleset.Lang.JSON, rules
+ ).setAccessPublicRead(true).addMeta("showOnMap", Values.create(true)).addMeta("showOnList", Values.create(true));
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/MarkthalChargersInUse.json")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "Markthal: All chargers in use", Ruleset.Lang.JSON, rules
+ ).setAccessPublicRead(true).addMeta("showOnMap", Values.create(true)).addMeta("showOnList", Values.create(true));
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/OnsParkBrightStrongWinds.json")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "Ons Park: Brighter light with strong winds", Ruleset.Lang.JSON, rules
+ );
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/OnsParkDimLightWinds.json")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "Ons Park: Dim lights with low wind speed", Ruleset.Lang.JSON, rules
+ );
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/StationCrowded.json")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "Station: Crowded square", Ruleset.Lang.JSON, rules
+ );
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/EnvironmentAlerts.json")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "Environment monitoring: Alerts", Ruleset.Lang.JSON, rules
+ );
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/TotalPowerConsumption.flow")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "Total power consumption of buildings", Ruleset.Lang.FLOW, rules
+ );
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/TotalSolarProduction.flow")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "Total power production of solar panels", Ruleset.Lang.FLOW, rules
+ );
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/RotterdamPowerBalance.flow")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "De Rotterdam: Power balance", Ruleset.Lang.FLOW, rules
+ );
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
+
+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/smartcity/ParkingOccupiedPercentage.flow")) {
+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+ Ruleset ruleset = new TenantRuleset(
+ keycloakDemoSetup.tenantCity.getRealm(), "Parking: Percentage of occupied spaces", Ruleset.Lang.FLOW, rules
+ );
+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();
+ }
}
}
diff --git a/manager/src/main/resources/demo/rules/smartcity/DeKuip.json b/manager/src/main/resources/demo/rules/smartcity/DeKuip.json
new file mode 100644
index 000000000..52004c75f
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/DeKuip.json
@@ -0,0 +1,83 @@
+{
+ "rules": [
+ {
+ "name": "De Kuip",
+ "when": {
+ "operator": "OR",
+ "groups": [
+ {
+ "operator": "AND",
+ "items": [
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:console"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "location"
+ },
+ "value": {
+ "predicateType": "radial",
+ "negated": false,
+ "radius": 100,
+ "lat": 51.8938569,
+ "lng": 4.5219983
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "then": [
+ {
+ "action": "notification",
+ "target": {
+ "useAssetsFromWhen": true
+ },
+ "notification": {
+ "name": "De Kuip",
+ "message": {
+ "type": "push",
+ "title": "De Kuip",
+ "body": "De thuis van Feyenoord",
+ "action": {
+ "url": "https://www.feyenoord.nl"
+ },
+ "buttons": [
+ {
+ "title": "Open in app",
+ "action": {
+ "url": "https://www.feyenoord.nl"
+ }
+ },
+ {
+ "title": "Open in browser",
+ "action": {
+ "url": "https://www.feyenoord.nl",
+ "openInBrowser": true
+ }
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "reset": {
+ "timer": "1m"
+ }
+ }
+ ]
+}
diff --git a/manager/src/main/resources/demo/rules/smartcity/EnvironmentAlerts.json b/manager/src/main/resources/demo/rules/smartcity/EnvironmentAlerts.json
new file mode 100644
index 000000000..63a29d7a7
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/EnvironmentAlerts.json
@@ -0,0 +1,97 @@
+{
+ "rules": [
+ {
+ "recurrence": {
+ "mins": 0
+ },
+ "when": {
+ "operator": "OR",
+ "groups": [
+ {
+ "operator": "AND",
+ "items": [
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:groundwater"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "waterLevel"
+ },
+ "value": {
+ "predicateType": "number",
+ "operator": "GREATER_THAN",
+ "value": 4
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ },
+ {
+ "operator": "AND",
+ "items": [
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:enviroment"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "ozone"
+ },
+ "value": {
+ "predicateType": "number",
+ "operator": "GREATER_THAN",
+ "value": 120
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "then": [
+ {
+ "action": "notification",
+ "notification": {
+ "message": {
+ "type": "email",
+ "subject": "%RULESET_NAME%",
+ "html": "%TRIGGER_ASSETS%",
+ "to": [
+ {
+ "address": "[email protected]",
+ "name": "[email protected]"
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "name": "Environment monitoring: Alerts"
+ }
+ ]
+}
diff --git a/manager/src/main/resources/demo/rules/smartcity/Euromast.json b/manager/src/main/resources/demo/rules/smartcity/Euromast.json
new file mode 100644
index 000000000..2a9e7aa29
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/Euromast.json
@@ -0,0 +1,98 @@
+{
+ "rules": [
+ {
+ "name": "Euromast",
+ "when": {
+ "operator": "OR",
+ "groups": [
+ {
+ "operator": "AND",
+ "items": [
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:console"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "location"
+ }
+ }
+ ]
+ },
+ "ids": [
+ "2XY9PRltl9XELEXJzipxs6"
+ ]
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "then": [
+ {
+ "action": "notification",
+ "target": {
+ "useAssetsFromWhen": true
+ },
+ "notification": {
+ "name": "Euromast",
+ "message": {
+ "type": "push",
+ "title": "Euromast",
+ "body": "Euromast, sinds 1960",
+ "action": {
+ "url": "https://euromast.nl"
+ },
+ "buttons": [
+ {
+ "title": "Open in app",
+ "action": {
+ "url": "https://euromast.nl",
+ "openInBrowser": true
+ }
+ },
+ {
+ "title": "Open in browser",
+ "action": {
+ "url": "https://euromast.nl",
+ "openInBrowser": true
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "50hkax4s7pQloGAv3d4NAw"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 37,
+ "attributeName": "lightDimLevel"
+ }
+ ],
+ "reset": {
+ "timer": "1m"
+ }
+ }
+ ]
+}
diff --git a/manager/src/main/resources/demo/rules/smartcity/Markthal.json b/manager/src/main/resources/demo/rules/smartcity/Markthal.json
new file mode 100644
index 000000000..474a0a48f
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/Markthal.json
@@ -0,0 +1,76 @@
+{
+ "rules": [
+ {
+ "name": "Markthal",
+ "when": {
+ "operator": "OR",
+ "groups": [
+ {
+ "operator": "AND",
+ "items": [
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:console"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "then": [
+ {
+ "action": "notification",
+ "target": {
+ "useAssetsFromWhen": true
+ },
+ "notification": {
+ "name": "Markthal",
+ "message": {
+ "type": "push",
+ "title": "Markthal",
+ "body": "Happy Food Shopping",
+ "action": {
+ "url": "https://www.markthal.nl"
+ },
+ "buttons": [
+ {
+ "title": "Open in app",
+ "action": {
+ "url": "https://www.markthal.nl",
+ "openInBrowser": true
+ }
+ },
+ {
+ "title": "Open in browser",
+ "action": {
+ "url": "https://www.markthal.nl",
+ "openInBrowser": true
+ }
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "reset": {
+ "timer": "1m"
+ }
+ }
+ ]
+}
diff --git a/manager/src/main/resources/demo/rules/smartcity/MarkthalChargersInUse.json b/manager/src/main/resources/demo/rules/smartcity/MarkthalChargersInUse.json
new file mode 100644
index 000000000..1b0171fe3
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/MarkthalChargersInUse.json
@@ -0,0 +1,158 @@
+{
+ "rules": [
+ {
+ "recurrence": {
+ "mins": 0
+ },
+ "when": {
+ "operator": "OR",
+ "groups": [
+ {
+ "operator": "AND",
+ "items": [
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:electricityCharger"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "power"
+ },
+ "value": {
+ "predicateType": "number",
+ "operator": "GREATER_EQUALS",
+ "value": 0.01
+ }
+ }
+ ]
+ },
+ "ids": [
+ "2PDhv85TE8UR81EaBdU4Sn"
+ ]
+ }
+ },
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:electricityCharger"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "power"
+ },
+ "value": {
+ "predicateType": "number",
+ "operator": "GREATER_EQUALS",
+ "value": 0.01
+ }
+ }
+ ]
+ },
+ "ids": [
+ "5sPOlQ4hwoDBAHpWSxXFlZ"
+ ]
+ }
+ },
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:electricityCharger"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "power"
+ },
+ "value": {
+ "predicateType": "number",
+ "operator": "GREATER_EQUALS",
+ "value": 0.01
+ }
+ }
+ ]
+ },
+ "ids": [
+ "79arRAQF4HzIdCG2ezj3gV"
+ ]
+ }
+ },
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:electricityCharger"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "power"
+ },
+ "value": {
+ "predicateType": "number",
+ "operator": "GREATER_EQUALS",
+ "value": 0.01
+ }
+ }
+ ]
+ },
+ "ids": [
+ "2FMdjRfgAEvD8tQMjZQKi5"
+ ]
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "then": [
+ {
+ "action": "notification",
+ "notification": {
+ "message": {
+ "type": "email",
+ "subject": "%RULESET_NAME%",
+ "html": "%TRIGGER_ASSETS%",
+ "to": [
+ {
+ "address": "[email protected]",
+ "name": "[email protected]"
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "name": "Markthal: All chargers are in use"
+ }
+ ]
+}
diff --git a/manager/src/main/resources/demo/rules/smartcity/OnsParkBrightStrongWinds.json b/manager/src/main/resources/demo/rules/smartcity/OnsParkBrightStrongWinds.json
new file mode 100644
index 000000000..f4a223671
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/OnsParkBrightStrongWinds.json
@@ -0,0 +1,160 @@
+{
+ "rules": [
+ {
+ "recurrence": {
+ "mins": 0
+ },
+ "when": {
+ "operator": "OR",
+ "groups": [
+ {
+ "operator": "AND",
+ "items": [
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:weather"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "windSpeed"
+ },
+ "value": {
+ "predicateType": "number",
+ "operator": "GREATER_THAN",
+ "value": 2
+ }
+ }
+ ]
+ },
+ "ids": [
+ "2bMjSx0iy1usC9KKhT24h9"
+ ]
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "then": [
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "50hkax4s7pQloGAv3d4NAw"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 90,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "5B5Die9qlpXk6I0AnUKsGz"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 90,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "5fBdNTUStqaRl2lck2taz3"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 90,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "3ejfNQCTpu7c7QKrhuWX2U"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 90,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "1xg374XfhgHBIan8hsEV8e"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 90,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "7JJAn5YHWD2m2AMwtIYjHz"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 90,
+ "attributeName": "lightDimLevel"
+ }
+ ],
+ "name": "Ons Park: Brighter light with strong winds"
+ }
+ ]
+}
diff --git a/manager/src/main/resources/demo/rules/smartcity/OnsParkDimLightWinds.json b/manager/src/main/resources/demo/rules/smartcity/OnsParkDimLightWinds.json
new file mode 100644
index 000000000..b92d89825
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/OnsParkDimLightWinds.json
@@ -0,0 +1,160 @@
+{
+ "rules": [
+ {
+ "recurrence": {
+ "mins": 0
+ },
+ "when": {
+ "operator": "OR",
+ "groups": [
+ {
+ "operator": "AND",
+ "items": [
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:weather"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "windSpeed"
+ },
+ "value": {
+ "predicateType": "number",
+ "operator": "LESS_EQUALS",
+ "value": 2
+ }
+ }
+ ]
+ },
+ "ids": [
+ "2bMjSx0iy1usC9KKhT24h9"
+ ]
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "then": [
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "50hkax4s7pQloGAv3d4NAw"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 60,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "5B5Die9qlpXk6I0AnUKsGz"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 60,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "5fBdNTUStqaRl2lck2taz3"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 60,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "3ejfNQCTpu7c7QKrhuWX2U"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 60,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "1xg374XfhgHBIan8hsEV8e"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 60,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "7JJAn5YHWD2m2AMwtIYjHz"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 60,
+ "attributeName": "lightDimLevel"
+ }
+ ],
+ "name": "Ons Park: Dim lights with low wind speed"
+ }
+ ]
+}
diff --git a/manager/src/main/resources/demo/rules/smartcity/ParkingOccupiedPercentage.flow b/manager/src/main/resources/demo/rules/smartcity/ParkingOccupiedPercentage.flow
new file mode 100644
index 000000000..6a09707ec
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/ParkingOccupiedPercentage.flow
@@ -0,0 +1,551 @@
+{
+ "name": "Parking: Percentage of occupied spaces",
+ "description": null,
+ "connections": [
+ {
+ "from": "5D-B3ktG0G",
+ "to": "vw097tfr81"
+ },
+ {
+ "from": "hsSgzfNE-E",
+ "to": "bQs4E9qCN2"
+ },
+ {
+ "from": "vCKMzAmLNx",
+ "to": "hz9f6Q4ESn"
+ },
+ {
+ "from": "lasR8uUoUR",
+ "to": "KqxwaOcGIP"
+ },
+ {
+ "from": "cOmTxKOpO0",
+ "to": "mJMXOPeGZd"
+ },
+ {
+ "from": "SOy3l0IR80",
+ "to": "vVdwGz2y8k"
+ },
+ {
+ "from": "-GPWnMsaGi",
+ "to": "OwI5iFzFMS"
+ },
+ {
+ "from": "z3-Iw-kaOH",
+ "to": "IEc8KwEhvK"
+ },
+ {
+ "from": "AKbiPAtB8t",
+ "to": "UVDHhIKihX"
+ },
+ {
+ "from": "C1DIYbdOhv",
+ "to": "6S19cFPyNd"
+ },
+ {
+ "from": "LI2D3VNWB6",
+ "to": "TPkxQ4HKOE"
+ },
+ {
+ "from": "Rw4MA6Afzc",
+ "to": "iTcEE2Mgzd"
+ },
+ {
+ "from": "yxflB92whn",
+ "to": "mfesEa2D7N"
+ }
+ ],
+ "nodes": [
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "3Snb9xk4Qr35XbxZD98n8W",
+ "attributeName": "occupiedSpaces"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "EXZ-b6ute",
+ "id": "5D-B3ktG0G"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -749.5,
+ "y": -501.5
+ },
+ "size": {
+ "x": 136.234,
+ "y": 65
+ },
+ "id": "EXZ-b6ute"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "5neUJEqucLhYdRTYHqtm1P",
+ "attributeName": "occupiedSpaces"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "4K3EqIsY6",
+ "id": "hsSgzfNE-E"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -748.5,
+ "y": -348.5
+ },
+ "size": {
+ "x": 121,
+ "y": 65
+ },
+ "id": "4K3EqIsY6"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "6iJyO3fOGmT5GRWmC5Warv",
+ "attributeName": "occupiedSpaces"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "fsaLpxzdx",
+ "id": "lasR8uUoUR"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -744.5,
+ "y": -197.5
+ },
+ "size": {
+ "x": 121,
+ "y": 65
+ },
+ "id": "fsaLpxzdx"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "5neUJEqucLhYdRTYHqtm1P",
+ "attributeName": "totalSpaces"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "cUasODe-H",
+ "id": "SOy3l0IR80"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -745.5,
+ "y": 133.5
+ },
+ "size": {
+ "x": 121,
+ "y": 65
+ },
+ "id": "cUasODe-H"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "3Snb9xk4Qr35XbxZD98n8W",
+ "attributeName": "totalSpaces"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "SNDES5qeX",
+ "id": "cOmTxKOpO0"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -744.5,
+ "y": -12.5
+ },
+ "size": {
+ "x": 136.234,
+ "y": 65
+ },
+ "id": "SNDES5qeX"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "6iJyO3fOGmT5GRWmC5Warv",
+ "attributeName": "totalSpaces"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "qZnj0EbDZ",
+ "id": "-GPWnMsaGi"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -749.5,
+ "y": 278.5
+ },
+ "size": {
+ "x": 121,
+ "y": 65
+ },
+ "id": "qZnj0EbDZ"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "EN5SNd71j",
+ "id": "vw097tfr81"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "EN5SNd71j",
+ "id": "bQs4E9qCN2"
+ }
+ ],
+ "internals": [],
+ "name": "ADD_OPERATOR",
+ "displayCharacter": "+",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "EN5SNd71j",
+ "id": "vCKMzAmLNx"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -446.5,
+ "y": -387.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "EN5SNd71j"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "4PR4GPJ-N",
+ "id": "hz9f6Q4ESn"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "4PR4GPJ-N",
+ "id": "KqxwaOcGIP"
+ }
+ ],
+ "internals": [],
+ "name": "ADD_OPERATOR",
+ "displayCharacter": "+",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "4PR4GPJ-N",
+ "id": "AKbiPAtB8t"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -328.5,
+ "y": -251.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "4PR4GPJ-N"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "XoUjUmfs9",
+ "id": "mJMXOPeGZd"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "XoUjUmfs9",
+ "id": "vVdwGz2y8k"
+ }
+ ],
+ "internals": [],
+ "name": "ADD_OPERATOR",
+ "displayCharacter": "+",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "XoUjUmfs9",
+ "id": "z3-Iw-kaOH"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -434.5,
+ "y": 104.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "XoUjUmfs9"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "dlsfNuzaj",
+ "id": "IEc8KwEhvK"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "dlsfNuzaj",
+ "id": "OwI5iFzFMS"
+ }
+ ],
+ "internals": [],
+ "name": "ADD_OPERATOR",
+ "displayCharacter": "+",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "dlsfNuzaj",
+ "id": "C1DIYbdOhv"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -301.5,
+ "y": 194.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "dlsfNuzaj"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "INNVamTqd",
+ "id": "UVDHhIKihX"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "INNVamTqd",
+ "id": "6S19cFPyNd"
+ }
+ ],
+ "internals": [],
+ "name": "DIVIDE_OPERATOR",
+ "displayCharacter": "÷",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "INNVamTqd",
+ "id": "LI2D3VNWB6"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -141.5,
+ "y": -113.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "INNVamTqd"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "WsFkoOv-R",
+ "id": "TPkxQ4HKOE"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "WsFkoOv-R",
+ "id": "iTcEE2Mgzd"
+ }
+ ],
+ "internals": [],
+ "name": "MULTIPLY_OPERATOR",
+ "displayCharacter": "×",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "WsFkoOv-R",
+ "id": "yxflB92whn"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": 136.5,
+ "y": -51.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "WsFkoOv-R"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "value",
+ "picker": {
+ "type": "NUMBER"
+ },
+ "value": 100
+ }
+ ],
+ "name": "NUMBER_INPUT",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "_H7TZoQqw",
+ "id": "Rw4MA6Afzc"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -149.734375,
+ "y": 50.5
+ },
+ "size": {
+ "x": 148,
+ "y": 17
+ },
+ "id": "_H7TZoQqw"
+ },
+ {
+ "inputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "jeli6TQY1",
+ "id": "mfesEa2D7N"
+ }
+ ],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "4BcMGBFNLNqji2j0dJKyUj",
+ "attributeName": "totalOccupancy"
+ }
+ }
+ ],
+ "name": "WRITE_ATTRIBUTE",
+ "outputs": [],
+ "type": "OUTPUT",
+ "position": {
+ "x": 281.9921875,
+ "y": -98.5
+ },
+ "size": {
+ "x": 263,
+ "y": 65
+ },
+ "id": "jeli6TQY1"
+ }
+ ]
+}
diff --git a/manager/src/main/resources/demo/rules/smartcity/RotterdamPowerBalance.flow b/manager/src/main/resources/demo/rules/smartcity/RotterdamPowerBalance.flow
new file mode 100644
index 000000000..5f40f61bc
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/RotterdamPowerBalance.flow
@@ -0,0 +1,159 @@
+{
+ "name": "De Rotterdam: Power balance",
+ "description": null,
+ "connections": [
+ {
+ "from": "LvwzHkg9-A",
+ "to": "UPfbBoj2TB"
+ },
+ {
+ "from": "mtdBqMHEXV",
+ "to": "h2vtCkVJvU"
+ },
+ {
+ "from": "Xwu7VfgQwS",
+ "to": "Ni1QTWS6Cr"
+ }
+ ],
+ "nodes": [
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "4qSMq7lzXJATWgITK4pZQF",
+ "attributeName": "totalPower"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "sroPWsTkE",
+ "id": "LvwzHkg9-A"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -689.5,
+ "y": -341.5
+ },
+ "size": {
+ "x": 194.563,
+ "y": 65
+ },
+ "id": "sroPWsTkE"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "4wdiljqcz2JYv3hEcB32oz",
+ "attributeName": "totalPower"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "f4jr9m-j7",
+ "id": "mtdBqMHEXV"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -687.5,
+ "y": -165.5
+ },
+ "size": {
+ "x": 257.781,
+ "y": 65
+ },
+ "id": "f4jr9m-j7"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "9b8ReH1cB",
+ "id": "UPfbBoj2TB"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "9b8ReH1cB",
+ "id": "h2vtCkVJvU"
+ }
+ ],
+ "internals": [],
+ "name": "SUBTRACT_OPERATOR",
+ "displayCharacter": "-",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "9b8ReH1cB",
+ "id": "Xwu7VfgQwS"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -187.5,
+ "y": -233.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "9b8ReH1cB"
+ },
+ {
+ "inputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "pR1MxgR1S",
+ "id": "Ni1QTWS6Cr"
+ }
+ ],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "6jG40HViCOrHbrGE9XbSjh",
+ "attributeName": "powerBalance"
+ }
+ }
+ ],
+ "name": "WRITE_ATTRIBUTE",
+ "outputs": [],
+ "type": "OUTPUT",
+ "position": {
+ "x": 25.9921875,
+ "y": -245.5
+ },
+ "size": {
+ "x": 242,
+ "y": 65
+ },
+ "id": "pR1MxgR1S"
+ }
+ ]
+}
diff --git a/manager/src/main/resources/demo/rules/smartcity/StationCrowded.json b/manager/src/main/resources/demo/rules/smartcity/StationCrowded.json
new file mode 100644
index 000000000..66588093a
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/StationCrowded.json
@@ -0,0 +1,171 @@
+{
+ "rules": [
+ {
+ "recurrence": {
+ "mins": 0
+ },
+ "when": {
+ "operator": "OR",
+ "groups": [
+ {
+ "operator": "AND",
+ "items": [
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:microphone"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "microphoneLevel"
+ },
+ "value": {
+ "predicateType": "number",
+ "operator": "GREATER_THAN",
+ "value": 60
+ }
+ }
+ ]
+ },
+ "ids": [
+ "49R3piJ2Pu3s4GSvJxBgEv"
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "operator": "AND",
+ "items": [
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:microphone"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "microphoneLevel"
+ },
+ "value": {
+ "predicateType": "number",
+ "operator": "GREATER_THAN",
+ "value": 60
+ }
+ }
+ ]
+ },
+ "ids": [
+ "7RCNs2Mb3XZOS8npXsvC9k"
+ ]
+ }
+ },
+ {
+ "assets": {
+ "types": [
+ {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "urn:openremote:asset:peopleCounter"
+ }
+ ],
+ "attributes": {
+ "items": [
+ {
+ "name": {
+ "predicateType": "string",
+ "match": "EXACT",
+ "value": "peopleCountGrowth"
+ },
+ "value": {
+ "predicateType": "number",
+ "operator": "GREATER_THAN",
+ "value": 2
+ }
+ }
+ ]
+ },
+ "ids": [
+ "5S1IkRe9oZ3QUCv6AFCuY3"
+ ]
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "then": [
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "5Pc19lYBXGp1oGjb1mnLAj"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 60,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "3V6eqJqfSBjfQT3AhlEvx3"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 75,
+ "attributeName": "lightDimLevel"
+ },
+ {
+ "action": "write-attribute",
+ "target": {
+ "assets": {
+ "ids": [
+ "3GIADRIXFMxjUIEL3io0at"
+ ],
+ "types": [
+ {
+ "predicateType": "string",
+ "value": "urn:openremote:asset:light"
+ }
+ ]
+ }
+ },
+ "value": 70,
+ "attributeName": "lightDimLevel"
+ }
+ ],
+ "name": "Station: Crowded square"
+ }
+ ]
+}
diff --git a/manager/src/main/resources/demo/rules/smartcity/TotalPowerConsumption.flow b/manager/src/main/resources/demo/rules/smartcity/TotalPowerConsumption.flow
new file mode 100644
index 000000000..329b8ad51
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/TotalPowerConsumption.flow
@@ -0,0 +1,317 @@
+{
+ "name": "Total power consumption of buildings",
+ "description": null,
+ "connections": [
+ {
+ "from": "k7xzWpPmOU",
+ "to": "mOv6cwMsN6"
+ },
+ {
+ "from": "0GKNcY239I",
+ "to": "TlmXpsOXUQ"
+ },
+ {
+ "from": "h9ZwYflt4Z",
+ "to": "rDjJ1NRPSV"
+ },
+ {
+ "from": "lzZfpdD4S0",
+ "to": "N2_UIZs3xI"
+ },
+ {
+ "from": "quH3sV5fSp",
+ "to": "Rsco32_whA"
+ },
+ {
+ "from": "cTWyTa7iqz",
+ "to": "DZdxsbYtlW"
+ },
+ {
+ "from": "74xUsnTGZY",
+ "to": "kW3nIIzmKM"
+ }
+ ],
+ "nodes": [
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "4wdiljqcz2JYv3hEcB32oz",
+ "attributeName": "totalPower"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "b_5QIrcpn",
+ "id": "k7xzWpPmOU"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -855.0078125,
+ "y": -453.5
+ },
+ "size": {
+ "x": 257.781,
+ "y": 65
+ },
+ "id": "b_5QIrcpn"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "62Bqe0GL7ZsGwHCAl7cYQT",
+ "attributeName": "totalPower"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "5zCZbiVkM",
+ "id": "0GKNcY239I"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -858.0078125,
+ "y": -301.5
+ },
+ "size": {
+ "x": 243.969,
+ "y": 65
+ },
+ "id": "5zCZbiVkM"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "3guR57kNLarlKBYBrlOI47",
+ "attributeName": "totalPower"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "TQ9PC2hLm",
+ "id": "h9ZwYflt4Z"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -861.0078125,
+ "y": -151.5
+ },
+ "size": {
+ "x": 217.031,
+ "y": 65
+ },
+ "id": "TQ9PC2hLm"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "4kvjjhyOk11asFPQ36DCDl",
+ "attributeName": "totalPower"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "EA8rltWHy",
+ "id": "lzZfpdD4S0"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -865.0078125,
+ "y": 2.5
+ },
+ "size": {
+ "x": 216.141,
+ "y": 65
+ },
+ "id": "EA8rltWHy"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "VTzqeMTRY",
+ "id": "mOv6cwMsN6"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "VTzqeMTRY",
+ "id": "TlmXpsOXUQ"
+ }
+ ],
+ "internals": [],
+ "name": "ADD_OPERATOR",
+ "displayCharacter": "+",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "VTzqeMTRY",
+ "id": "quH3sV5fSp"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -336.5,
+ "y": -327.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "VTzqeMTRY"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "zy-tW7hST",
+ "id": "rDjJ1NRPSV"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "zy-tW7hST",
+ "id": "N2_UIZs3xI"
+ }
+ ],
+ "internals": [],
+ "name": "ADD_OPERATOR",
+ "displayCharacter": "+",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "zy-tW7hST",
+ "id": "cTWyTa7iqz"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -362.5,
+ "y": -31.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "zy-tW7hST"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "4_h4BFrUr",
+ "id": "Rsco32_whA"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "4_h4BFrUr",
+ "id": "DZdxsbYtlW"
+ }
+ ],
+ "internals": [],
+ "name": "ADD_OPERATOR",
+ "displayCharacter": "+",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "4_h4BFrUr",
+ "id": "74xUsnTGZY"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -167.5,
+ "y": -186.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "4_h4BFrUr"
+ },
+ {
+ "inputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "3CV-fcqbr",
+ "id": "kW3nIIzmKM"
+ }
+ ],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "2OF3l0ek5JltAmwEAUcSli",
+ "attributeName": "totalPowerConsumers"
+ }
+ }
+ ],
+ "name": "WRITE_ATTRIBUTE",
+ "outputs": [],
+ "type": "OUTPUT",
+ "position": {
+ "x": 25.9921875,
+ "y": -232.5
+ },
+ "size": {
+ "x": 247,
+ "y": 65
+ },
+ "id": "3CV-fcqbr"
+ }
+ ]
+}
diff --git a/manager/src/main/resources/demo/rules/smartcity/TotalSolarProduction.flow b/manager/src/main/resources/demo/rules/smartcity/TotalSolarProduction.flow
new file mode 100644
index 000000000..ade90575a
--- /dev/null
+++ b/manager/src/main/resources/demo/rules/smartcity/TotalSolarProduction.flow
@@ -0,0 +1,317 @@
+{
+ "name": "Total power production of solar panels",
+ "description": null,
+ "connections": [
+ {
+ "from": "C-QaWZEeBs",
+ "to": "dxvU9Xz2IM"
+ },
+ {
+ "from": "mNS9-GZPMK",
+ "to": "VIEnlWRV_a"
+ },
+ {
+ "from": "nYeDEdHMK3",
+ "to": "r0o8xVQT3N"
+ },
+ {
+ "from": "oCML5aGaOI",
+ "to": "bONtkmO85l"
+ },
+ {
+ "from": "IV-unZRsFH",
+ "to": "PJIlVVDNQw"
+ },
+ {
+ "from": "UCNOY-HrzI",
+ "to": "zW2K73tjyv"
+ },
+ {
+ "from": "lEI0uY0L1o",
+ "to": "2zo6HaMm88"
+ }
+ ],
+ "nodes": [
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "4qSMq7lzXJATWgITK4pZQF",
+ "attributeName": "totalPower"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "CynzKmqQe",
+ "id": "C-QaWZEeBs"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -753.0078125,
+ "y": -514.5
+ },
+ "size": {
+ "x": 194.563,
+ "y": 65
+ },
+ "id": "CynzKmqQe"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "7P0Nk5pdY0UzrfR6wv1raD",
+ "attributeName": "totalPower"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "NEAaAZEMD",
+ "id": "mNS9-GZPMK"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -751.0078125,
+ "y": -353.5
+ },
+ "size": {
+ "x": 161.578,
+ "y": 65
+ },
+ "id": "NEAaAZEMD"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "3wus03XiU0n6ukvUfJdSct",
+ "attributeName": "totalPower"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "DlwsVTeKD",
+ "id": "nYeDEdHMK3"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -754.5,
+ "y": -188.5
+ },
+ "size": {
+ "x": 153.828,
+ "y": 65
+ },
+ "id": "DlwsVTeKD"
+ },
+ {
+ "inputs": [],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "7bX04Q5sAVXBaIhG47pi7T",
+ "attributeName": "totalPower"
+ }
+ }
+ ],
+ "name": "READ_ATTRIBUTE",
+ "outputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "0_2NG2WHi",
+ "id": "oCML5aGaOI"
+ }
+ ],
+ "type": "INPUT",
+ "position": {
+ "x": -749.5,
+ "y": -32.5
+ },
+ "size": {
+ "x": 152.922,
+ "y": 65
+ },
+ "id": "0_2NG2WHi"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "-Citw31Em",
+ "id": "dxvU9Xz2IM"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "-Citw31Em",
+ "id": "VIEnlWRV_a"
+ }
+ ],
+ "internals": [],
+ "name": "ADD_OPERATOR",
+ "displayCharacter": "+",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "-Citw31Em",
+ "id": "UCNOY-HrzI"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -339.5,
+ "y": -348.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "-Citw31Em"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "2O2rRgaWI",
+ "id": "r0o8xVQT3N"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "2O2rRgaWI",
+ "id": "bONtkmO85l"
+ }
+ ],
+ "internals": [],
+ "name": "ADD_OPERATOR",
+ "displayCharacter": "+",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "2O2rRgaWI",
+ "id": "IV-unZRsFH"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -344.5,
+ "y": -94.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "2O2rRgaWI"
+ },
+ {
+ "inputs": [
+ {
+ "name": "a",
+ "type": "NUMBER",
+ "nodeId": "Gvoh2qclw",
+ "id": "zW2K73tjyv"
+ },
+ {
+ "name": "b",
+ "type": "NUMBER",
+ "nodeId": "Gvoh2qclw",
+ "id": "PJIlVVDNQw"
+ }
+ ],
+ "internals": [],
+ "name": "ADD_OPERATOR",
+ "displayCharacter": "+",
+ "outputs": [
+ {
+ "name": "c",
+ "type": "NUMBER",
+ "nodeId": "Gvoh2qclw",
+ "id": "lEI0uY0L1o"
+ }
+ ],
+ "type": "PROCESSOR",
+ "position": {
+ "x": -179.5,
+ "y": -215.5
+ },
+ "size": {
+ "x": 0,
+ "y": 0
+ },
+ "id": "Gvoh2qclw"
+ },
+ {
+ "inputs": [
+ {
+ "name": "value",
+ "type": "NUMBER",
+ "nodeId": "XVFP1kzlH",
+ "id": "2zo6HaMm88"
+ }
+ ],
+ "internals": [
+ {
+ "name": "Attribute",
+ "picker": {
+ "type": "ASSET_ATTRIBUTE"
+ },
+ "value": {
+ "assetId": "2OF3l0ek5JltAmwEAUcSli",
+ "attributeName": "totalPowerProducers"
+ }
+ }
+ ],
+ "name": "WRITE_ATTRIBUTE",
+ "outputs": [],
+ "type": "OUTPUT",
+ "position": {
+ "x": -14.5,
+ "y": -262.5
+ },
+ "size": {
+ "x": 247,
+ "y": 65
+ },
+ "id": "XVFP1kzlH"
+ }
+ ]
+}
diff --git a/model/src/main/java/org/openremote/model/attribute/MetaItemType.java b/model/src/main/java/org/openremote/model/attribute/MetaItemType.java
index 8e6ce799a..6caf8692a 100644
--- a/model/src/main/java/org/openremote/model/attribute/MetaItemType.java
+++ b/model/src/main/java/org/openremote/model/attribute/MetaItemType.java
@@ -429,7 +429,7 @@ public enum MetaItemType implements MetaItemDescriptor {
),
/**
- * Could possible have predicted datapoints
+ * Could possibly have predicted datapoints
*/
HAS_PREDICTED_DATA_POINTS(
ASSET_META_NAMESPACE + ":hasPredictedDatapoints",
@@ -445,7 +445,7 @@ public enum MetaItemType implements MetaItemDescriptor {
* input with optional show)
*/
SECRET(
- ASSET_META_NAMESPACE + ":readOnly",
+ ASSET_META_NAMESPACE + ":secret",
new Access(true, false, true),
ValueType.BOOLEAN,
null,