Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
Is it possible to stream data using a ESP8266 Module directly to the API Link?
Im using the following code.
#include <ArduinoJson.h> #include <ESP8266HTTPClient.h> #include <ESP8266WiFi.h> void setup() { Serial.begin(115200); //Serial connection WiFi.begin("DiAlOg-1", "dialog456@"); //WiFi connection while (WiFi.status() != WL_CONNECTED) { //Wait for the WiFI connection completion delay(500); Serial.println("Waiting for connection"); } } void loop() { if(WiFi.status()== WL_CONNECTED){ //Check WiFi connection status HTTPClient http; //Declare object of class HTTPClient const size_t bufferSize = JSON_ARRAY_SIZE(1) + JSON_OBJECT_SIZE(2); DynamicJsonBuffer jsonBuffer(bufferSize); JsonArray& root = jsonBuffer.createArray(); JsonObject& root_0 = root.createNestedObject(); root_0["Value1"] = 100; root_0["Value2"] = 200; char JSONmessageBuffer[300]; root.prettyPrintTo(JSONmessageBuffer, sizeof(JSONmessageBuffer)); Serial.println(JSONmessageBuffer); http.begin("https://api.powerbi.com/beta/852c5799-8134-4f15-9d38-eba4296cc76f/datasets/6014dfc1-93f3-42bb-8ae8-7ec52b051bc8/rows?key=kcW8AI0bvDrT%2BukEOZSFfRxh39HqH0z8hNNPqMqB2PlzlAXvwtw8S9CLCnga3g4tiz2vSonttPDHKfbmNkEUYA%3D%3D"); http.addHeader("Content-Type", "application/json"); int httpCode = http.POST(JSONmessageBuffer); http.end(); //Close connection }else{ Serial.println("Error in WiFi connection"); } delay(1000); //Send a request every 30 seconds }
And this is the serial Output:
[ { "Value1": 100, "Value2": 200 } ] [ { "Value1": 100, "Value2": 200 } ]
It doesn't show any value in the dashboard.. Should this work? What am i doing wrong?
I followed the following tutorial, but instead of the Raspberry Pi, Im using a ESP8266.
https://www.youtube.com/watch?v=0YIBHfgasok
(see 30:50)
Your help is much appreciated. thank you.
@kalindud did you manage to do it?
Been trying to do it myself but can't make the response to reach power Bi....
Hi @kalindud,
I think it is possible to use device to send data if you can achieve below prerequisite:
1. Power bi account and stream api url.
2. Device can access to website, support programming and send data to network.
How did you setting steaming tile, please share more detail information. (Notice: current streaming dataset not works for normal tiles and visuals)
BTW, you need to check your data formula if it not similar as sample data shows.
Regards,
Xiaoxin Sheng
Hello,
BTW, you need to check your data formula if it not similar as sample data shows.
What do u mean by this?
And yes I created a Streaming Data tile like you shown in the screenshot. It didnt get any values.
Any help? Should my code work?
Thank you!
Hi @kalindud,
I'd like to suggest you copy your formula and debug on PC side, if power bi can analytics your data, it means you send-up correct format data.(issue may related to device, for e.g. lite version of dlls or others)
Otherwise I think you need to correct data format first.
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.