Ewon TechForum
Providing technical solutions to technical requests


Connect eWon Flexy to Mindsphere
paulo.odwazny Offline
Junior Member
#1
Hello,
Here is the code (Basic) to send data to Siemens Mindsphere via MQTT protocol.

The variables "Speed@" and "Current@" are configured in Flexy "Tags > Values" area.
This code send a message to mindsphere every 10 seconds.

Code:
<eWON_cyclic_section:>
Ontimer 1,"goto MqttPublish"
End

MqttPublish:
  $auxStr$ = "200,Speed,Machine," + STR$ Speed@ + ",rpm" + CHR$ 13
  $auxStr$ = $auxStr$ + "200,Current,Machine," + STR$ Current@ + ",A"
 
  Mqtt "Publish","s/us",$auxStr$,0,0
End


<eWON_init_section:>
Mqtt "Open","ewon_000001","mciotextension.{yourMCIoTExtensionRegion}.mindsphere.io"
Mqtt "SetParam","Port","1883"
Mqtt "SetParam","username","{tenantName}/{mciotExtensionUsername}"
Mqtt "SetParam","password","{password}"
Mqtt "SetParam","keepalive","30"
Mqtt "SetParam","CleanSession","1"
Mqtt "Connect"

Mqtt "Publish","s/us","100,ewon,MCIoT_MQTTdevice",0,0
Mqtt "Publish","s/us","110,0001,ewon,1.0",0,0
Mqtt "Publish","s/us","117,1",0,0 
Tset 1,10

In addicional here is the mindsphere MQTT step-by-step: https://developer.mindsphere.io/howto/ho...mciot.html
Attached is the Cumulocity MQTT datasheet (mindsphere base).

Bye, Paulo.


Attached Files
.pdf   cheatsheet.pdf (Size: 55,82 KB / Downloads: 24)
Reply

simon Offline
eWON Support
#2
Hi Paulo,

Thanks for sharing this with us !! :-) . Just a remark, you do not need to put the line Ontimer 1,"goto MqttPublish" in the cyclic. In the init section, it is fine (You just need to call the function once).

I have also to mention that we will have a Mindsphere connector available in the next Ewon firmware (v14.0). In this case, no script needed, just some menus...

Simon
Reply



Possibly Related Threads…
23-03-2020, 04:24 PM
Last Post: simon
  Creating Totaliser Within eWON Started by Josh
3 Replies - 1.009 Views
14-02-2020, 06:06 PM
Last Post: simon
24-01-2020, 09:45 PM
Last Post: tedsch
  eWON and ThingWorx Started by simon
13 Replies - 6.246 Views
17-01-2020, 05:55 PM
Last Post: ltitel
07-01-2020, 03:34 PM
Last Post: simon
  Flexy and Microsoft Power BI Started by simon
19 Replies - 8.463 Views
10-12-2019, 11:25 AM
Last Post: simon
27-11-2019, 10:30 PM
Last Post: simon
22-10-2019, 10:42 AM
Last Post: simon
  Flexy SMS Alert Started by domash
11 Replies - 1.865 Views
22-08-2019, 12:10 PM
Last Post: simon
  MQTT eWon Flexy 205 Started by RFreist
3 Replies - 1.411 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