checking command from orion to iot agent in Fiware - fiware

I've used the FIWARE Orion Context Broker and IoTAgent-UL in my project. I've registered a virual device by sending a Json message carrying the device attributes, the command attributes, device endpoint address and the used protocol (UL2.0).
If I update the command attribute of the device entity in Orion Context Broker, how can i check that the command is sent to the IoTAgent successfully before it is forwarded to the device virtual device itself?
Moreover, can I make the IP address of a Raspberrypi the endpoint itself and assign a port to a device connected to the Raspberrypi? And how could this be done?
Finally, in case I have no physical device could I consider the IoTAgent's address an endpoint to check whether any update on the command attribute in the context broker will be forwarded to that endpoint?
Thanks

There are three ways of checking the update context/command has been sent to the agent, and from the agent or the device:
Check Orion or agent logs.
Check the MQTT broker logs, if you are using MQTT transport.
Check the device itself. If the command was received, you'll be able to see the effects of the command.
Regarding the place a Raspberry Pi may play in an architecture using IoT agents, typically it is used to replace the agent :) I mean, if having a device such as a Raspberry Pi, the usual scenario is to connect to the R-Pi all your sensors and actuators, as if it was a gateway, and then let the R-Pi connect directly to Orion Context Broker by implementing a NGSI client running in the R-Pi. Schematically:
Orion <---> R-Pi + NGSI client <---> sensor/actuator
Nevertheless, I guess you can use the R-Pi as if it was a final device (sensor or actuator) in order to test IoT agents. Regarding how to emulate the final device itself, I guess you'll have to run certain logic in the R-Pi in order to accept the UL messages from the IoT agent/MQTT broker. A simple netcat could help you; more complex emulation services could be run, of course. Schematically:
Orion <----> UL agent <---> R-Pi + netcat
Anyway, please observe always a final device (sensor or actuator) is required, either real, either simulated (running netcat or similar in a R-Pi/server), since the UL agent must have an endpoint where to send the UL payloads.
Orion <---> UL agent <---> R-Pi + netcat OR server + netcat OR real sensor/actuator

Related

Unable to connect to Orion Context Broker using Wirecloud

I am new to FIWARE. I managed to install Orion Context Broker on my local system following the steps mentioned in the FIWARE website. I am able to use CURL commands to create entities and also retrieve values.
I have also installed Wirecloud on my local system and able to access Wirecloud UI from my browser.
But I am unable to display the entities on the Wirecloud widgets. I have tried all widgets including "NGSI Type Browser", NGSI Browser and NGSI Source operator.
All returning the same error: "ConnectionError: Unexpected response from WireCloud's proxy"
Please help me on how to proceed. My NGSI-proxy is also running and listening on port 3000. Screenshots attached.
enter image description here
Can you try to replace localhost with IP address of your machine running Orion and Ngsiproxy?

How to test that my Ultralight 2.0 IOT agent receives payload

I am using the Ultralight 2.0 IOT Agent.
Although I can see that the payload, that my gateway sends, is subscribed at a specific topic into the mosquitto MQTT broker, how could I test that the IOTAgent is listening at port 4061 and that it is receiving something from the broker?
I am refering to the IOTAgent-UL which is running on a CentOS 7 VM as a service. I have access to it with REST calls and I also see that the payloads, that my gateway sends, are subscribed into the MQTT broker. How could I pass my payloads from the mosquitto to the IOTAgent and after to the Context Broker?
thanks a lot!
What you are asking for seems to be related with the basic operational workflow of the IOTAgents in general. Thus, I'd recommend you to have a look to the following Step by step guide. It is based in another agent (the one for JSON payloads instead of UL) but most of the procedure is the same, so I think it could be useful.
EDIT: JSON format is documented here. UL format is documented here. Payload format is indepedent of the transport, i.e. is the same no matter if you use HTTP or MQTT.

Android phone & Orion Broker

Could someone suggest me the easiest way to send data from my android phone to my local Orion Broker Instance via MQTT? I have installed locally Orion Broker and IoT Agent for the Ultralight 2.0 protocol.
Assuming that IoTAgent is correctly configured to interact with Orion and with MQTT broker, the steps would be as follow:
Provision your phone device at IoTAgent, using the IoTAgent provisioning API
Start sending data using MQTT transport, from your device to the MQTT broker. IoTAgent will get that data and publish at Orion Context Broker.
Get your data from Orion Context Broker, either using synchronous queries or subscriptions/notifications.
The step by step guide at IOTAgent documentation explains bullets 1 and 2 with more detail. However, note this document is based in JSON payloads, so you have to adapt them to UltraLight 2.0. For example, the UltraLigth 2.0 equivalent for
mosquitto_pub -t /1234/sensor01/attrs -m '{"l":4,"t": "31.5"}'
would be
mosquitto_pub -t /1234/sensor01/attrs -m 'l|4|t|31.5'

Send commands (e.g: shutdown, restart) to device - iotagent-ul

Is it possible to send commands to a device using iotagent-ul?
I want to have the ability to manage my device remotely and perform tasks such as shutdown and restart.
Yes, it is possible. You can find here the syntax of the commands sent by the IoT agent for a UL device.
Those commands are sent to the device from the agent each time an "update context" operation is received at the northbound API of the agent, usually from an Orion Context Broker instance that has registered the agent as the context provider for a context entity related to the device. I.e. at Orion you perform an "update context" operation in order to modify some attribute modeling a command (for instance, a "shutdown" attribute), and such "update context" is forwarded to the agent since it is the registered context provider for the entity/device. Then, the agent translates the "update context" operation into the specific UL protocol I've linked to you.

FIWARE IoT Agent: can the IoT agent send data to multiple context broker

I am using the MQTT IoT agent to send data to my fiware context broker, I am wondering if I can send data from my IoT agent to multiple context brokers. Is that possible? if yes how to?
Thanks in advance for your help!
The MQTT IoT-Agent is connected to a specific Context Broker instance depending on the Service provision. If the Service Context Broker instance is not configured, then the "ngsi_urls" parameter is used.
Therefore, yes, you can deliver information to multiple ContextBroker instances but only one per defined FIWARE service.
If you want to send the information of one single service to multiple instances of Context Brokers I think you may send it to one and then federate the other instances. To learn about Context Broker instances federations you should check the ContextBroker related documents.
Thanks for using IDAS and sorry for a so delayed response (we have been slower regading support due to an internal migration process).