Browse Source

Added device profile rule node to default edge root. Fixed notification event

pull/3811/head
Volodymyr Babak 6 years ago
parent
commit
96dfc0691b
  1. 53
      application/src/main/data/json/tenant/rule_chains/edge_root_rule_chain.json
  2. 2
      application/src/main/java/org/thingsboard/server/controller/DeviceProfileController.java
  3. 4
      application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/DeviceProfileMsgConstructor.java

53
application/src/main/data/json/tenant/rule_chains/edge_root_rule_chain.json

@ -9,8 +9,22 @@
"configuration": null "configuration": null
}, },
"metadata": { "metadata": {
"firstNodeIndex": 2, "firstNodeIndex": 0,
"nodes": [ "nodes": [
{
"additionalInfo": {
"description": "Process incoming messages from devices with the alarm rules defined in the device profile. Dispatch all incoming messages with \"Success\" relation type.",
"layoutX": 203,
"layoutY": 259
},
"type": "org.thingsboard.rule.engine.profile.TbDeviceProfileNode",
"name": "Device Profile Node",
"debugMode": false,
"configuration": {
"persistAlarmRulesState": false,
"fetchAlarmRulesStateOnStart": false
}
},
{ {
"additionalInfo": { "additionalInfo": {
"layoutX": 823, "layoutX": 823,
@ -99,42 +113,47 @@
"connections": [ "connections": [
{ {
"fromIndex": 0, "fromIndex": 0,
"toIndex": 6, "toIndex": 3,
"type": "Success" "type": "Success"
}, },
{ {
"fromIndex": 1, "fromIndex": 1,
"toIndex": 6, "toIndex": 7,
"type": "Success" "type": "Success"
}, },
{ {
"fromIndex": 2, "fromIndex": 2,
"toIndex": 4, "toIndex": 7,
"type": "Success"
},
{
"fromIndex": 3,
"toIndex": 6,
"type": "RPC Request to Device"
},
{
"fromIndex": 3,
"toIndex": 5,
"type": "Other" "type": "Other"
}, },
{ {
"fromIndex": 2, "fromIndex": 3,
"toIndex": 1, "toIndex": 2,
"type": "Post attributes" "type": "Post attributes"
}, },
{ {
"fromIndex": 2, "fromIndex": 3,
"toIndex": 0, "toIndex": 1,
"type": "Post telemetry" "type": "Post telemetry"
}, },
{ {
"fromIndex": 2, "fromIndex": 3,
"toIndex": 3, "toIndex": 4,
"type": "RPC Request from Device" "type": "RPC Request from Device"
}, },
{ {
"fromIndex": 2, "fromIndex": 4,
"toIndex": 5, "toIndex": 7,
"type": "RPC Request to Device"
},
{
"fromIndex": 3,
"toIndex": 6,
"type": "Success" "type": "Success"
} }
], ],

2
application/src/main/java/org/thingsboard/server/controller/DeviceProfileController.java

@ -103,7 +103,7 @@ public class DeviceProfileController extends BaseController {
null, null,
savedDeviceProfile.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); savedDeviceProfile.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
sendNotificationMsgToEdgeService(getTenantId(), deviceProfile.getId(), EntityType.DEVICE_PROFILE, sendNotificationMsgToEdgeService(getTenantId(), savedDeviceProfile.getId(), EntityType.DEVICE_PROFILE,
deviceProfile.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED); deviceProfile.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
return savedDeviceProfile; return savedDeviceProfile;

4
application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/DeviceProfileMsgConstructor.java

@ -38,7 +38,6 @@ public class DeviceProfileMsgConstructor {
.setIdMSB(deviceProfile.getId().getId().getMostSignificantBits()) .setIdMSB(deviceProfile.getId().getId().getMostSignificantBits())
.setIdLSB(deviceProfile.getId().getId().getLeastSignificantBits()) .setIdLSB(deviceProfile.getId().getId().getLeastSignificantBits())
.setName(deviceProfile.getName()) .setName(deviceProfile.getName())
.setDescription(deviceProfile.getDescription())
.setDefault(deviceProfile.isDefault()) .setDefault(deviceProfile.isDefault())
.setType(deviceProfile.getType().name()) .setType(deviceProfile.getType().name())
.setTransportType(deviceProfile.getTransportType().name()) .setTransportType(deviceProfile.getTransportType().name())
@ -52,6 +51,9 @@ public class DeviceProfileMsgConstructor {
// if (deviceProfile.getDefaultQueueName() != null) { // if (deviceProfile.getDefaultQueueName() != null) {
// builder.setDefaultQueueName(deviceProfile.getDefaultQueueName()); // builder.setDefaultQueueName(deviceProfile.getDefaultQueueName());
// } // }
if (deviceProfile.getDescription() != null) {
builder.setDescription(deviceProfile.getDescription());
}
if (deviceProfile.getProvisionDeviceKey() != null) { if (deviceProfile.getProvisionDeviceKey() != null) {
builder.setProvisionDeviceKey(deviceProfile.getProvisionDeviceKey()); builder.setProvisionDeviceKey(deviceProfile.getProvisionDeviceKey());
} }

Loading…
Cancel
Save