Ewon TechForum
Providing technical solutions to technical requests


eWON and OpenSensors.io
simon Offline
eWON Support
#1
Hey!

Opensensors.oi is an simple free-of-charge IOT cloud platform that mainly allows to concentrate the data on a server and then share them with a predefined screen generated from a given template. You can then decide to share them publicly or not. Opensensors.io does not support dashboards or other data analysis tools (trends,...).

Here is an example of BASIC script to push your Tag values to Opensensors.io


Code:
Function OPENSENSORS_weather_push()
 
 ONSTATUS "GOTO OPENSENSORS_Callback"  
 @OPENSENSORS_push("temperature",outTemp@)
 
EndFn

Function Log($message$, $error%)

  IF $error% = 0 THEN
    LogEvent $message$,102
  ELSE
    LogEvent $message$,99
  ENDIF
    
  Print $message$
EndFn


Function OPENSENSORS_init()

 OPENSENSORS_apikey$ = "35639f73-2446-423d-8687-35229a59f7ed"
 OPENSENSORS_clientId$ = "4478"
 OPENSENSORS_devicePwd$ = "Jffdsn"
EndFn

Function OPENSENSORS_push($dataName$, $value)
 @OPENSENSORS_init()
 
 $url$ = "https://realtime.opensensors.io/v1/topics//users/prk4iot/"+$dataName$
 $url$ = $url$+"?client-id="+OPENSENSORS_clientId$+"&password="+OPENSENSORS_devicePwd$
 
 $header$ =            "Accept=application/json"
 $header$ = $header$ + "&Content-Type=application/json"
 $header$ = $header$ + "&Authorization=api-key "+OPENSENSORS_apikey$

 $myData$ = '{"data": "'+STR$($value)+'"}'

 //Print $header$
 REQUESTHTTPX $url$,"POST",$header$,$myData$

 actionID% = GETSYS PRG,"ACTIONID"

EndFn

OPENSENSORS_Callback:
 EventId%=Getsys PRG,"EVTINFO"

 IF EventId%=ActionID% THEN
   SETSYS PRG,"ACTIONID",EventId%
   CurrentStatus%=GETSYS PRG,"ACTIONSTAT"
   Body$ = RESPONSEHTTPX "RESPONSE-BODY"
   IF CurrentStatus% = 0 THEN
    IF Body$ = '{"message":"Message sent"}' THEN
      @Log("OPENSENSORS Updated successfully", 0)
    ELSE
      @Log("Error when sending data to OPENSENSORS :" + Body$, 1)
    ENDIF
   ELSE
      @Log("Error when sending data to OPENSENSORS", 1)
   ENDIF
 ENDIF
END
Reply



Possibly Related Threads…
18-05-2020, 05:25 PM
Last Post: simon
16-04-2020, 09:10 PM
Last Post: simon
14-04-2020, 08:53 PM
Last Post: simon
08-04-2020, 05:23 PM
Last Post: simon
  Creating Totaliser Within eWON Started by Josh
3 Replies - 1.270 Views
14-02-2020, 06:06 PM
Last Post: simon
  eWON and ThingWorx Started by simon
13 Replies - 6.910 Views
17-01-2020, 05:55 PM
Last Post: ltitel
07-01-2020, 03:34 PM
Last Post: simon
22-10-2019, 10:42 AM
Last Post: simon
03-09-2019, 02:08 PM
Last Post: simon
  MQTT eWon Flexy 205 Started by RFreist
3 Replies - 1.745 Views
18-07-2019, 12:30 PM
Last Post: simon



Users browsing this thread:
1 Guest(s)



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