Open hbrito-gtc opened 1 year ago
Yes, it is possible. You can map each attribute to another entity by specifying the ID and Type. For this to work, you must activate the plugin at the start of iotagent, and create the entities before provisioning the device.
An example might look like this: Entities creation
{
"id": "LORA-TEMP-001",
"type": "LoraTempDevice",
"temperature_1": {
"value": 10,
"type": "Number"
}
}
{
"id": "LORA-HUM-001",
"type": "LoraHumDevice",
"relative_humidity_2": {
"value": 10,
"type": "Number"
}
}
Provisioning device
{
"devices": [
{
"device_id": "lora_n_003",
"entity_name": "LORA-N-003",
"entity_type": "LoraDevice",
"timezone": "America/Santiago",
"attributes": [
{
"object_id": "t1",
"name": "temperature_1",
"type": "Number",
"entity_name": "LORA-TEMP-001",
"entity_type": "LoraTempDevice"
},
{
"object_id": "rh2",
"name": "relative_humidity_2",
"type": "Number",
"entity_name": "LORA-HUM-001",
"entity_type": "LoraHumDevice"
},
{
"object_id": "di3",
"name": "digital_in_3",
"type": "Number"
},
{
"object_id": "do4",
"name": "digital_out_4",
"type": "Number"
},
],
"internal_attributes": {
"lorawan": {
"application_server": {
"host": "eu.thethings.network",
"username": "ari_ioe_app_demo1",
"password": "pwd1",
"provider": "TTN"
},
"dev_eui": "1119343755556A14",
"app_eui": "4569343567897875",
"application_id": "ari_ioe_app_demo1",
"application_key": "444B8EF16415B5F6ED777EAFE695C49",
"data_model": "cayennelpp"
}
}
}
]
}
It seems to be imposible to use this _entityname with ":", although I think this is the best way
...
{
"object_id": "rh2",
"name": "relative_humidity_2",
"type": "Number",
"entity_name": "urn:LoraHumDevice:LORA-N-003",
"entity_type": "LoraHumDevice"
}
...
Log:
msg=Couldn't send the updated values to the Context Broker due to an error: | comp=IoTAgent {"name":"INVALID_EXPRESSION","message":"Invalid expression in evaluation [urn:...]","code":400}
Is possible to use the multi-entity feature with this IoT Lorawan agent? If so, could you leave me an example of provisioning a sensor that maps to 2 different entities?