Skip to Content

"actions" array seems to be ignored in gateway REST schema file

Hi everyone,

Came up with this issue recently, where mapping a property like this:

"device_data": { "type": "object", "mapTo": "value", "actions": [{ "type": "ADD", "mapTo": "capability_alternate_id", "value": "HR003" }, { "type": "ADD", "mapTo": "sensor_type_alternate_id", "value": 123123123 }, { "type": "ADD", "mapTo": "sensor_alternate_id", "value": "hrsens01" }], "properties": { "*": { "mapKeyTo": "property_name", "mapTo": "value" } } }

Makes "actions" array seems to be ignored, which does not happen with a single-measurament capability like this:

"user_uuid": { "type": "integer", "mapTo": "value", "actions": [{ "type": "ADD", "mapTo": "capability_alternate_id", "value": "HR001" }, { "type": "ADD", "mapTo": "sensor_type_alternate_id", "value": 123123123 }, { "type": "ADD", "mapTo": "sensor_alternate_id", "value": "hrsens01" }] }

Could you please indicate if I am doing something wrong?

Thanks,

Federico

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Apr 18 at 03:50 PM

    Hi Federico,

    we would need some further details to help you.

    What is your goal? Can you provide an example of the message and how you want to map the fields of the message into IoTServices Capability/Sensor/SensorType?

    Kind regards,

    Andrea

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 03 at 02:50 PM

    Hi Federico,

    to send a bean without specifying the capabilityAlternateId, the sensorAlternateId and the sensorTypeAlternateId, you have to use a schema like this:

    {
    	"type": "object",
    	"parserData": {
    		"format": "JSON",
    		"resource": "MQTT_message",
    		"messageType": "default",
    		"messageTypeFinder": {
    			"format": "JSON_POINTER",
    			"jsonPointer": "/messageType"
    		}
    	},
    	"actions": [{
    			"type": "ADD",
    			"mapTo": "sensor_type_alternate_id",
    			"value": 123123123
    		}, {
    			"type": "ADD",
    			"mapTo": "capability_alternate_id",
    			"value": "HR003"
    		}, {
    			"type": "ADD",
    			"mapTo": "sensor_alternate_id",
    			"value": "hrsens01"
    		}
    	],
    	"properties": {
    		"device_data": {
    			"type": "object",
    			"mapTo": "value"
    		}
    	}
    }
    
    

    and send a payload in the array of array format, e.g.:

    {
    "device_data": [[ 20, "serial", 96, "fw_version", "hw_version", "Rome" ]]
    }

    Add comment
    10|10000 characters needed characters exceeded