Skip to Content
0

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

Apr 16 at 08:36 AM

62

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

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

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Andrea,

I am attaching JSON files so that they are more readable. The capability I am considering is that of capability.txt. I am able to do it by sending a file like format1.txt, but what I'd like to do is send it in the format of format2.txt. I have tried with the mappings in schema1.txt and schema2.txt. In the first case, no error is reported but measurements are not received by IoTS. In the second case, I attach gatewaylog.txt, but it basically seems to see them as single capabilities and not as a multimeasure capability.

Best regards,

Federico

capability.txt (891 B)
format1.txt (277 B)
format2.txt (168 B)
schema2.txt (491 B)
schema1.txt (490 B)
gatewaylog.txt (7.0 kB)
0
avatar image
Former Member
May 03 at 02:50 PM
0

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" ]]
}

Share
10 |10000 characters needed characters left characters exceeded