autodesk-platform-services / aps-iot-extensions-demo

APS DataViz Extensions Demo:Visualizing IoT sensor data.
https://aps-iot-extensions-demo.autodesk.io
MIT License
10 stars 5 forks source link

Importing Real-time IoT data #11

Open reachsak opened 12 months ago

reachsak commented 12 months ago

I'd got everything working correctly except for implementing custom IoT data into my custom model. I'd like to know how can I import real-time iot data to the model (say from Azure iot hub, AWS or sensors from Raspberry Pi device). I know it should be done with the mocked.iot.js file. Any guide, tutorial, or resources related to this is appreciated. Thanks,

RustyRaptor commented 8 months ago

We are in the same boat as you. My current understanding is that we would have to define our own functions using the respective API that returns the sensor data in the same way that the "generaterandomvalues" functions work. Have you found a solution like this yet?

yiskang commented 8 months ago

Hi,

This sample is mainly for demonstrating the use of the Data Visualization extension only.

While connecting this sample with real-time data, we can consider the mocked.iot.js file as the database table storing the basic info of sensors & channels and the getSamples function for the sensor value history. Here you can find the corresponding codes:

If the time series db example doesn't meet your needs, you can add some extra logic there to read sensor values directly to provide "Real-time" data.

Hope this helps.

petrbroz commented 7 months ago

I've created an experiment/realtime-data branch that demonstrates how realtime data could be incorporated.

The basic idea is that you can implement the data view interface used by the viewer extensions in any way you want. The interface is responsible for providing the following information:

Typically we pull all this information from the server but in case of realtime data, your DataView class can aggregate the data coming from whatever realtime data source.

petrbroz commented 7 months ago

Alternatively, you can aggregate the incoming realtime data on the server side, and let the client regularly request the aggregated data for the last 5min, for example.