How to share data between 2x Flexy

I have a Flexy that needs, once in a while, to push data to another Flexy. Is there an easy to do this without using the eFive? Do I need a static public IP address?


There are actually several different ways to accomplish this with each varying in complexity or use case.


With the addition of the RequestHTTPX BASIC command in firmware revision 11, we may now use the M2Web API as a way to exchange tag values between two devices. This option is especially flexible as it does not require a public IP or really any IP addressing and uses the already established Talk2M connections.


Use Cases

  • Useful when you do not have public IP addressing or a direct connection.

  • Useful for creating a more versatile application.


In this example we have a tank that needs to report its value to a central location. Here eWON A will be sending its data to eWON B using the API. We will be updating the tag with the name Site-A-Tank-Level. Additionally, this will be written with a script to automate the process. We will export the data on a 5 second interval so as not to execute too many requests.
Tag Setup
Device A:
Note: We are sending the tag TankLevel

Device B:
Note: We are updating the tag Site-A-TankLevel

INIT Section:
TSET 1, 5
ONTIMER 1, "GOTO UpdateRemote"

UpdateRemote Section:
//Account info
account$ = "youraccount"
username$ = "yourusername"
password$ = "yourpassword"
developerid$ = "yourdeveloperid"

//ewon specific info
devicename$ = "yourewonname"
deviceusername$ = "yourdeviceusername"
devicepassword$ = "yourdevicepassword"
method$ = "GET"

tagName$ = "YourTagName"
tagValue$ = STR$ YourTagName@

url$ = ""+devicename$+"/rcgi.bin/UpdateTagForm?TagName1=" + tagName$ + "&TagValue1=" + tagValue$

url$ = url$ + "&t2maccount="+account$+"&t2musername="+username$+"&t2mpassword="+password$
url$ = url$ +"&t2mdeveloperid="+developerid$+"&t2mdeviceusername="+deviceusername$+"&t2mdevicepassword=" + devicepassword$
REQUESTHTTPX url$, method$, "", ""


FTP Instant Value

Within the eWON devices there is a file that can be exported that contains the instant values (current values at the time of execution) for all of your tags. The nice thing about this file however is that it can be used to update tag values on a remote eWON device. By FTP'ing the file to a remote eWON, the remote eWON will essentially "suck" the values out of those tags and assign them to the corresponding tag.


The following example will be done within my internal network. As such I can use the LAN IP of each eWON.
Device Number Device Name Device IP
1 eWON A
2 eWON B
FTP Server Setup on eWON A

Additionally on both devices I have created a tag called: TankLevel
On eWON A I will put the following script in place to exchange the value from device A every 10 seconds.

INIT Section:
TSET 1, 10
ONTIMER 1, "GOTO SendValues"

SendValues Section:
PUTFTP "inst_val.txt", "[$dtIV $ftT]"
LogEvent "Exported values to eWON B:", 100

To add onto this thread, we can exchange not only tag data (as seen above) but also files using the m2web API. Please see the following topic for more information:Exchange Data File between 2 Flexies

2 posts were split to a new topic: Syncing tags via M2Web API

The user details and tag name should be of which device ,the one from which i am sending data or of the receiving device?
And where i can access the usr folder in flexy to activate the customized data,please help,thanks.

The tag and user should be of the device you are sending data to.

Also, what customized data are you referring to? There is nothing customized here.

Thanks for your reply.

Thanks a lot, i have been looking for a data concentration solution like this to visualize data from multiple eWons in M2web. This is great to start with, I will have a try.

1 Like

That looks amazing. But i could not make it work here. Does it have to be the same IP range for the two flexys, and i dont see in your code where you defined the site tag (Tanklevel) and where you defined destination tag (Site-A-tanklevel), which the site tag value is sent to?
Thanks in advance

Hi Jiayuan,

Are both of the flexys on the same local network or are they in separate locations?

Separate locations under the different talk2m accounts, so it won’t work that way?

It can work if you have a public ip address but this will open up your device to the internet and make it less secure.

I’m talking with one of my colleagues who has a more secure version that works by using a script and the m2web api that I’m looking into though

1 Like

Hi Ted,

This is a similar idea but does require the flexys to have a direct connection to one another, either on the LAN or in the example here via an E5 connection.


Hi Jiayuan,

This might take me a day or 2 to get running, but I’m going to go over the code and try and get back to you early next week.


1 Like

A post was split to a new topic: FTP With Flexy

Hello, I am receiving a operation failed (28) : REQUESTHTTPX URL$, method$, “”, “”
Am i missing data for the REQUESTHTTPX? If so, I don’t know what to put in the quotations? I have looked at the manuals and can’t figure out what is required. I am just trying to move a couple of tag values from one EWON to another. I have limited experience with Basic programming and any help or example code would be greatly appreciated.