Lesson 4  Integrate Power BI


In Lesson 3 , we used sample code connect to NAS .In this lesson, you will learn how yo use Power BI visualize sensor data that NAS recive in real-time.

There are four parts:

A: Get your first Power BI account

B: Setup your streaming dataset API

C: Configure Node-RED’s nodes in IoT application

D: Add tile to display real-time data

Part A: Get your first Power BI account



power_bi_index





  • After registering, you will see the following page, you could click "skip for now " to start create dataset.


    start


Part B: Setup your streaming dataset API




  • Create “Datasets”



    • Click “Create” in scrren upper right corner

    • And then click “Streming dataset”




create_datastream


  • Select “API”, and click “Next”.




API


  • Define your values from stream, and you will get a JSON result in the textbox. We will use this JSON code to push data to the IoT application. Click "Create" to finish.




edit_streaming_dataset


  • Once you create your data stream, you get a REST API URL which IoT applications can call using POST requests to push your live data to the streaming data dataset you created.




push_url

Part C: Configure Node-RED’s nodes in IoT application




  • Create an IoT application in QIoT Suite. The following is your first Node-RED flow, and then you can start creating your own IoT flow. You can learn more about Node-RED at https://nodered.org/




Node-Red


  • Before you start pushing live data to Power BI. We need a "function" node to convert IoT data to a streaming data dataset. Here you can replace msg.payload to your JSON dataset.




msg.payload

  • Function code as following:
    msg.payload=[{
    "temp":msg.payload.value,
    "max":100,
    "min":0
    }]
    return msg;



  •  We need an "http request" node to help us to push live data to Power BI. Just drag and drop the "http request" node and connect to the tail of the "function" node.




http request


  •  Copy and paste the REST API URL that you got from the Power BI console, and set http method to POST. Click "Deploy" to save changes




Deploy


  • Your Node-RED flow will look like below





Finally node-red

Part D: Add tile to display real-time data




  • Create “Dashboard”



    • Click “Create” in scrren upper right corner

    • And then click “Dashboard”

    • Enter dashboard’s name,and click “Create” to complete create dashboard.




create_dashboard

dashboard_name

  • Click “Add tile” in screen upper right corner


add_tile


  • Select “CUSTOM STREAMING DATA” and click “Next”.




CUSTOM STREAMING DATA


  • Select datasets and click “Next” .




datasets

  • Select visualization type (e.g.,gauge),and set value,min,and max value.
    value


  • You will have a streaming dataset to work with, and you can get a real time gauge that looks as following.




streaming dataset

Please visit QNAP github for QIoT Suite Lite sample code


"QNAP-Github"

arrow
arrow
    全站熱搜

    tttt 發表在 痞客邦 留言(0) 人氣()