Make the eWON compatible with ThingWorx

ThingWorx is an IoT platform that gathers all kind of data.

We managed to succeed in transfering data between the eWON and the IoT Platform.

Here's what we code (of course, fields between <> must be replaced by the user values):

Rem --- eWON start section: Init Section
Rem --- eWON user (start)
ONCHANGE "Qty_Color_B", "@UpdateThingWorxProperty('0e13ccdc-f6a9-4678-925e-83f060d5872e','Qty_Color_B')" 
ONCHANGE "Qty_Color_C", "@UpdateThingWorxProperty('0e13ccdc-f6a9-4678-925e-83f060d5872e','Qty_Color_C')" 
ONCHANGE "Qty_Color_D", "@UpdateThingWorxProperty('0e13ccdc-f6a9-4678-925e-83f060d5872e','Qty_Color_D')" 
ONCHANGE "Temperature", "@UpdateThingWorxProperty('0e13ccdc-f6a9-4678-925e-83f060d5872e','Temperature')"

Rem --- eWON user (end)
Rem --- eWON end section: Init Section
Rem --- eWON start section: ThingWorx
Rem --- eWON user (start)

Function UpdateThingWorxProperty($appKey$,$Tagname$)
$url$ = "http://<ThingWorxServerIPorURL>/Thingworx/Things/<MyThing>/Properties/*" 
$method$ = "PUT" 
$Tagvalue = GETIO $Tagname$
$Tagvalue_String$ = STR$ $Tagvalue
$DataToSend$ = '{"' + $Tagname$ + '":' + $Tagvalue_String$ + '}'
$header$ = "Content-Type=application/json&Accept=application/json&appKey=" + $appKey$
REQUESTHTTPX $url$, $method$, $header$, $DataToSend$
PRINT "Value of " + $Tagname$ + " is sent to ThingWorx"


Rem --- eWON user (end)
Rem --- eWON end section: ThingWorx