Ewon TechForum
Providing technical solutions to technical requests



Flexy and Microsoft Power BI
simon Offline
eWON Support
#1
Solved: 14-07-2020, 11:05 AM
Power BI (https://powerbi.microsoft.com/en-us/) is a business analytics service provided by Microsoft.


Here is the procedure to follow for pushing Live Tag data to Power BI :

- Create and configure the  datastream :
.png   step1.png (Size: 62,12 KB / Downloads: 462)
.png   step2.png (Size: 15,39 KB / Downloads: 376)
.png   createdatastream.png (Size: 18,59 KB / Downloads: 410)
- When the datastream is created, copy the URL
.png   datastreamurl.png (Size: 9,56 KB / Downloads: 378)
- Adapt the following BASIC script with your URL and your Tags (in the Json) :

Code:
PushInterval% = 5
ONTIMER 1, "GOTO PusDataToPowerBI"

PusDataToPowerBI:
TSET 1,0
Url$ = "https://api.powerbi.com/beta/5c7c1590-4488-4e42-bc9c-1f18f8ac994/datasets/4d71a553-1e92-4ba3-acdb-88ae5bf7d40b/rows?redirectedFromSignup=1"
Url$ = Url$ + "&noSignUpCheck=1&response=AlreadyAssignedLicense&redirectedWaitSimple=1&key=V2%2BGZCVK%2FQe%2F%2F64n6yKnEIoeipv31uBrQt8vtEvroWrV2Ha3qGEqeos4gmQen7PuplqojB%2F4J5S4gG0lzSceqQ%3D%3D"
method$ = "POST"
header$ = "Content-Type=application/json"
Json$ = '[{'
Json$ = Json$ + '"Temperature" :' + STR$ Temperature@ +","
Json$ = Json$ + '"Humidity" :' + STR$ Humidity@ +","
Json$ = Json$ + '"Timestamp" :"' + @GetTime$(2) +'"'
Json$ = Json$ +'}]'
PRINT Json$
@HttpRequest$(url$, method$, header$, Json$)
Print "Data Pushed"
TSET 1,PushInterval%
END

Function GetTime$($UTCDiff%)
$a$ = Time$
$GetTime$ = $a$(7 To 10) + "-" + $a$(4 To 5) + "-" + $a$(1 To 2) + "T" + STR$(VAL($a$(12 To 13)) - $UTCDiff%)+":"+$a$(15 To 16)+":"+$a$(18 To 19)+ ".000Z"
EndFn

FUNCTION HttpRequest$($URL_$, $Method_$, $Header_$, $data_$)
REQUESTHTTPX $URL_$, $Method_$, $Header_$, $data_$
$a% = GETSYS Prg,"ACTIONID"
$CHECKSCHEDULEACTION:
SETSYS Prg, "ACTIONID", $a%
$c% = GETSYS Prg,"ACTIONSTAT"
IF $c% = -1 THEN GOTO $CHECKSCHEDULEACTION
IF $c% = 0 THEN
  PRINT TIME$ + " REQUEST OK on ActionID " + STR$ $a%
  $StatusCode% = VAL RESPONSEHTTPX "STATUSCODE"
  PRINT $StatusCode%
  IF $StatusCode% = 200 THEN $HttpRequest$ = "OK" ELSE $HttpRequest$ = "NOK"  
  $Response$ =  RESPONSEHTTPX "RESPONSE-BODY"
ELSE
  PRINT TIME$ + " REQUEST FAILED on ActionID " + STR$ a%
  $HttpRequest$ = "NOK"  
ENDIF

ENDFN

This script pushes the values of the Tags "Temperature" and "Humidity" every 5 seconds (See TSET command) :
.png   tags.png (Size: 5,85 KB / Downloads: 340) .
- Run the script
- Create a dashboard or a report

.png   dashboard.png (Size: 20,36 KB / Downloads: 339)
.png   PowerBIreport.png (Size: 34,22 KB / Downloads: 320)

Simon
Reply

kalyanbl Offline
Junior Member
#2
Nice and good information. It is very useful for beginners to learn and understand easily.
Learn more about Power BI here: https://goo.gl/fYDNDF
Reply

Gerard van Gelderen Offline
Junior Member
#3
Hello Simon,

Thanks for the script.
Yesterday it worked fine but today al i get is "Operation failed (28) 70 : REQUESTHTTPX url$, method$, header$, Json$"

It's a buffer problem i think because the frist 20 seconds it's pushing data but in PowerBI nothing is showing. (see Attachment)
Do you experinence the same problem or is it something in the Basic scrpit at my end.

Best regards
Gerard


Attached Files
.jpg   Knipsel.JPG (Size: 122,51 KB / Downloads: 90)
Reply

simon Offline
eWON Support
#4
This is strange indeed...
Do you see something in the scheduled actions ? and in the event logs ?
Reply

Gerard van Gelderen Offline
Junior Member
#5
See attachment.

Greets Gerard


Attached Files
.jpg   1.JPG (Size: 128,38 KB / Downloads: 143)
.jpg   2.JPG (Size: 121,43 KB / Downloads: 77)
Reply

simon Offline
eWON Support
#6
Hi,

From what I see in your Scheduled Actions log, you are pushing the data too often (every two seconds) and the Power BI server needs more time to process the data it seems... (You get these Pla- Queue Full errors because there are too many pending HTTP Push actions (max 20) so no other actions can be taken in account)

Simon
Reply

Gerard van Gelderen Offline
Junior Member
#7
Thanks Simon.

It seems to work perfect now.
after setting the intervaltime from 2 to 5 seconds the problem was gone.

Greetz,
Gerard
Reply

simon Offline
eWON Support
#8
ah great! Thanks for the feedback and enjoy ;-) !
Reply

IHC Offline
Junior Member
#9
Thank you for sharing this info!

Iam getting this error: label/function not found (27): Goto ewon_init_section

You guys have any idea?
Reply

simon Offline
eWON Support
#10
You probably did erase your init section.
The best is that you erase the BASIC script of your eWON (Reset Level 1 or System > Setup > Storage > Erase & Format > Erase Program) and you copy/paste this script into your Init section.
Do not forget to adapt the script with your own settings.
Reply

IHC Offline
Junior Member
#11
Thank you. It works now :-)
Reply

attila94 Offline
Junior Member
#12
Hi Simon ,

Can we do the same thing with Ewon CD4xxx instead of flexy 205 ?
Reply

attila94 Offline
Junior Member
#13
(03-06-2018, 03:59 PM)attila94 Wrote: Hi Simon ,

Can we do the same thing with Ewon CD4xxx  instead of flexy 205 ?

any answer ?
Reply

simon Offline
eWON Support
#14
Unfortunately no, the function "REQUESTHTTPX" is not supported by the CD but only by Flexy (All models).

Simon
Reply

ms9901 Offline
Junior Member
#15
Simon,

Have you played with pushing historical tag data to Power BI? It seems like it could be done with EBD but you would need to parse the result of EBD into appropriately formatted JSON using a script?

Mike
Reply




Possibly Related Threads…
12-09-2025, 05:36 PM
Last Post: LuisEnrique
18-06-2025, 04:57 PM
Last Post: mickaa
17-03-2025, 07:14 PM
Last Post: Houns
  Ewon Flexy and Telegram Started by spessi
12 Replies - 8.088 Views
30-01-2025, 10:49 AM
Last Post: Ellantra
17-04-2024, 04:43 AM
Last Post: Vince_IH
  OpenVPN Flexy 205 Started by insyncs
5 Replies - 7.508 Views
26-03-2024, 12:43 PM
Last Post: insyncs
15-03-2024, 02:50 PM
Last Post: simon
20-02-2024, 06:53 AM
Last Post: Mithun
07-11-2023, 06:03 PM
Last Post: simon
13-10-2023, 04:54 PM
Last Post: LuisEnrique



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy