[Backlogmanager] [FIWARE-JIRA] (HELP-17766) [fiware-stackoverflow] IoT-Agent checks default attributes that are not in the iot payload

Fernando Lopez (JIRA) jira-help-desk at jira.fiware.org
Thu May 27 09:42:00 CEST 2021


     [ https://jira.fiware.org/browse/HELP-17766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fernando Lopez reassigned HELP-17766:
-------------------------------------

    Assignee: Fermín Galán

> [fiware-stackoverflow] IoT-Agent checks default attributes that are not in the iot payload
> ------------------------------------------------------------------------------------------
>
>                 Key: HELP-17766
>                 URL: https://jira.fiware.org/browse/HELP-17766
>             Project: Help-Desk
>          Issue Type: Monitor
>          Components: FIWARE-TECH-HELP
>            Reporter: Backlog Manager
>            Assignee: Fermín Galán
>              Labels: fiware, iot
>
> Created question in FIWARE Q/A platform on 25-05-2021 at 16:05
> {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/67691885/iot-agent-checks-default-attributes-that-are-not-in-the-iot-payload
> +Question:+
> IoT-Agent checks default attributes that are not in the iot payload
> +Description:+
> I have a test environment where I have configured a service group for the JSON IoT Agent with a legacy expression in it:
> {
>             "_id": "60acc2d549e4721ae5087356",
>             "__v": 0,
>             "iotagent": "http://10.0.0.2:4062",
>             "apikey": "apikeyTest2",
>             "entity_type": "WasteContainer",
>             "service_path": "/subservice",
>             "service": "service",
>             "resource": "/iot/json",
>             "description": "IoTAgent JSON - Node.js",
>             "protocol": "IoTA-JSON",
>             "internal_attributes": [],
>             "attributes": [
>                 {
>                     "name": "temperature",
>                     "object_id": "t",
>                     "type": "Number"
>                 },
>                 {
>                     "name": "fillingLevel",
>                     "expression": "${@level/100}",
>                     "type": "Number"
>                 }
>             ],
>             "lazy": [],
>             "static_attributes": [],
>             "commands": []
>         }
> Apart from that I register manually a device with a "jexl" as expression language:
> curl --location --request POST 'https://host/iot/devices' \
> --header 'Fiware-Service: service' \
> --header 'Fiware-ServicePath: /subservice' \
> --header 'X-Auth-Token: gAAAAABgrQm..._R8r98aeNWQ' \
> --header 'Content-Type: application/json' \
> --data-raw '{
>   "devices": [
>     {
>       "device_id": "deviceJSON1",
>       "entity_name": "device:entity01",
>       "entity_type": "device",
>       "expressionLanguage": "jexl",
>       "attributes": [
>         { 
>           "object_id": "b",
>           "name": "position", 
>           "type": "Number",
>           "expression": "(a+b)"
>         }
>       ],
>       "protocol": "IoTA-JSON",
>       "transport": "HTTP"
>     }
>   ]
> }
> '
> Then I send data from the device using the apikey of the previous service group, but without using any attribute configured there:
> curl --location --request POST 'http://host/iot/json?k=apikeyTest2&i=deviceJSON1&getCmd=0' \
> --header 'Content-Type: application/json' \
> --data-raw '{
>     "a": 4,
>     "b": 5
> }'
> The response is 400 Bad Request:
> {
>     "name": "INVALID_EXPRESSION",
>     "message": "Invalid expression in evaluation [${@level/100}]"
> }
> Is this the expected result or should the agent try to use the "jexl" to transform the payload as there is not level attribute in the iot data?
> To solve this I can create another service group with a different apikey and without default attributes, but just wanted to know if the result was the expected.



--
This message was sent by Atlassian JIRA
(v6.4.1#64016)


More information about the Backlogmanager mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy