1 | initial version |
hi,
As the Raspberry Pi is a device that can speak FIWARE NGSI directly, the easiest way would be to use a Python script to obtain the data coming from the Raspberry Pi Sensors and then use the NGSIv2 API to publish the data offered by the sensors connected to the Raspberry on a Orion Context Broker.
You can deploy your own Orion Context Broker instance, on your laptop, for instance using Docker
docker run fiware/orion
You can pre-create the entity you are going to use to store the sensor data, for instance:
POST /v2/entities
{ "id": "MyObservation-RaspberryPi-890", "type": "Observation" }
Then every time a new sensor measurement is obtained from the Raspberry Pi you can
POST /v2/entities/MyObservation-RaspberryPi-890/attrs
{ "temperature": { "value": 23.5 } }
Of course, your laptop and the Raspberry Pi have to be on the same network.
Other architectures more complicated could make use of IoT Agents but in this case it is not even needed.
I hope this helps
best
2 | No.2 Revision |
hi,
As the Raspberry Pi is a device that can speak FIWARE NGSI directly, the easiest way would be to use a Python script to obtain the data coming from the Raspberry Pi Sensors and then use the NGSIv2 API to publish the data offered by the sensors connected to the Raspberry on a Orion Context Broker.
You can deploy your own Orion Context Broker instance, on your laptop, for instance using Docker
docker run fiware/orion
You can pre-create the entity you are going to use to store the sensor data, for instance:
POST /v2/entities
{ "id": "MyObservation-RaspberryPi-890", "type": "Observation" }
Then every time a new sensor measurement is obtained from the Raspberry Pi you can
POST /v2/entities/MyObservation-RaspberryPi-890/attrs
{ "temperature": { "value": 23.5 } }
You can get the temperature value by getting your entity data as follows:
GET /v2/entities/MyObservation-RaspberryPi-890?options=keyValues and you will get something like
{ "id": "MyObservation-RaspberryPi-890", "type": "Observation", "temperature": 23.5 }
Of course, your laptop and the Raspberry Pi have to be on the same network.
Other architectures more complicated could make use of IoT Agents but in this case it is not even needed.
I hope this helps
best