Ewon TechForum
Providing technical solutions to technical requests


Share Data between two Flexy connected to Talk2M
FromTicket Offline
Junior Member
#1
Good morning,
 

-          Is it possible to push data from one Flexy to another over Talk2M directly (for example in a Basicscript with M2Web) ?
-          Are there other possibilities to do that?
Reply

simon Offline
eWON Support
#2
Yes,  it is indeed possible through the M2WebAPI.

See an example below (developed with the new BASIC function - REQUESTHTTPX -> Firmware 11.1)  :


Code:
M2WebAPI:

//Fill the connection settings here
T2MAccount$ = ""
T2MUsername$ = ""
T2MPassword$ = ""
T2MDeveloperId$ = ""
Target_eWON_Name$ = ""
Target_eWON_Username$ = "adm"
Target_eWON_Password$ = "adm"


method$ = "GET"

url$ = "https://m2web.talk2m.com/t2mapi/get/"+Target_eWON_Name$+"/rcgi.bin/UpdateTagForm"

//--------------
url$ = url$ + "?TagName1=MyTag1RemoteFlexy&TagValue1=" + STR$ MyTag1@  //MyTag1RemoteFlexy is the name of the Tag in the Target eWON.
url$ = url$ + "&TagName2=MyTag2RemoteFlexy&TagValue2=" + STR$ MyTag2@
//---- Add more tags here -----------

url$ = url$ + "&t2maccount="+T2MAccount$+"&t2musername="+T2MUsername$+"&t2mpassword="+T2MPassword$
url$ = url$ +"&t2mdeveloperid="+T2MDeveloperId$+"&t2mdeviceusername="+Target_eWON_Username$+"&t2mdevicepassword=" + Target_eWON_Password$

REQUESTHTTPX url$, method$, "", ""

END

This example of script can be used in a Flexy to write its Tag values to another Flexy.  This script section can be called every 30 sec/every minute (not too often as the number of M2Web API calls is limited to 30.000 per day/account)

Another idea is that you could have the target eWON connected on T2M and this one could be seen as a concentrator for multiple eWONs as well.
In this eWON, you will have to predefine a range of Tags for each satellite eWON in order to receive their data.

The satellite eWONs (where this script runs) are not obliged to be connected to T2M but could be in case you need to do some remote access to them.

See pdf attached the two topology I see.

Also, if you don't have a Developer ID, you can request one here : https://developer.ewon.biz/registration


Attached Files
.pdf   ShareTagsOverTalk2M.pdf (Size: 378,05 KB / Downloads: 173)
Reply

simonojstersek Offline
Junior Member
#3
Hi!

I tested this script but it did not work. Is there any bug?

Best regards,

Simon
Reply

Ludo Offline
eWON Support
#4
Hey Simon,

Can you let us know what didn't work? Did you receive a specific error?
Reply

simonojstersek Offline
Junior Member
#5
Hi!

Hm, maybe i have problem here...

url$ = url$ + "?TagName1=MyTag1&TagValue1=" + STR$ MyTag1@  //MyTag1 is the name of the Tag in the Target eWON.
url$ = url$ + "?TagName2=MyTag2&TagValue2=" + STR$ MyTag2@
 

Which tag is on remote ewon and wich tag is on local ewon?

Thanks in advance!

BR,

Simon
Reply

simon Offline
eWON Support
#6
Hi,

I admit the code was not pretty much clear... I have updated it.

By the way, I have developed a Java IOServer addon that allows you to poll the Tag values from remote eWONs (belonging to the same Talk2M account) through Talk2M.

To use it, just push the 3 files contained in your /usr directory through FTP and reboot your eWON.
You'll then have a new Ioserver named "T2M_Tags" in your Ioserver list (
.png   IoserverSettings.png (Size: 4,68 KB / Downloads: 101) ,
.png   TagSettings.png (Size: 6,33 KB / Downloads: 77) )

Here is the list of parameters :

Account : Name of your Talk2M account
Username : Username of your Talk2M account
Password : Password of your Talk2M Password
Loglevel : Log level of the addon (in Real Time logs). Can be 0,1 or 2 (= Debug)
Forcereadingafterwriting : Read values directly after writing a value
Pollrate : Polling rate of the addon (all defined Flexy are polled one after each other without delay, then the addon waits for this delay and start again).  Minimum pollrate is 15 seconds.

Example :

Code:
account:myaccount
username:admin
password:mypassword
loglevel:2
forcereadingafterwriting:true
pollrate:120

If you could test it and let me know, it would be great! ;-)

Regards

Simon


Attached Files
.zip   ShareTagsOverTalk2M.zip (Size: 13,94 KB / Downloads: 54)
Reply

simonojstersek Offline
Junior Member
#7
(24-04-2017, 12:04 PM)Simon Wrote: Hi Simon!

So, the condition is the same Talk2M account for 2 ewons (example).

I"ll try.

Thank you very much!

BR,

Simon





Hi,

I admit the code was not pretty much clear... I have updated it.

By the way, I have developed a Java IOServer addon that allows you to poll the Tag values from remote eWONs (belonging to the same Talk2M account) through Talk2M.

To use it, just push the 3 files contained in your /usr directory through FTP and reboot your eWON.
You'll then have a new Ioserver named "T2M_Tags" in your Ioserver list (, )

Here is the list of parameters :

Account : Name of your Talk2M account
Username : Username of your Talk2M account
Password : Password of your Talk2M Password
Loglevel : Log level of the addon (in Real Time logs). Can be 0,1 or 2 (= Debug)
Forcereadingafterwriting : Read values directly after writing a value
Pollrate : Polling rate of the addon (all defined Flexy are polled one after each other without delay, then the addon waits for this delay and start again).  Minimum pollrate is 15 seconds.

Example :

Code:
account:myaccount
username:admin
password:mypassword
loglevel:2
forcereadingafterwriting:true
pollrate:120

If you could test it and let me know, it would be great! ;-)

Regards

Simon
Reply

simonojstersek Offline
Junior Member
#8
Hi!

I tried, but it is doesn"t work.
I have made folow steps:
- One account and two "online" ewons
- 3 files on "usr" directory on first ewon
- IO server "talk2M" on first ewon
- Tag on first ewon -> second ewon

BR,

Simon


Attached Files
.png   Tags_on.png (Size: 137,45 KB / Downloads: 39)
.png   Tags.png (Size: 150,46 KB / Downloads: 31)
Reply

simon Offline
eWON Support
#9
Hi,

Thanks for testing :-)

What did you put in the T2M_Tags IOserver settings (do not post your password ;-) )?
What do you get in the Real time logs ?
Reply

simonojstersek Offline
Junior Member
#10
Hi!

I am sending other print screens.

Best regards,

Simon

Hi!

One more question. So, the minimum pool time is 15 seconds?

Bye,

Simon


Attached Files
.png   ecatcher.png (Size: 210,45 KB / Downloads: 49)
.png   Tags.png (Size: 150,46 KB / Downloads: 45)
.png   IO_server.png (Size: 131,17 KB / Downloads: 42)
Reply

simon Offline
eWON Support
#11
So here you are polling Tags every 120 seconds (2 min). I set the minimum poll rate at 15 sec because this Ioserver uses the M2Web API (https://developer.ewon.biz/content/m2web-api-0) and you are limited to 30000 calls/day/account. So, as I use one call each time I poll an eWON (no matter the number of Tags since I poll the Instantaneous Tag values file), you could poll at a frequency of 3 sec if you use 1 eWON (86400 / 30000) if you poll one eWON and at a frequency of 30 sec max if you poll 10 eWONs (86400/30000/10). As as an average, I put 15 sec :-)

Regarding your snapshots, I do not see the real time logs.
These Tags are configured in another eWON than the HP_Vitrum one, right ?
Reply

simonojstersek Offline
Junior Member
#12
Hi Simon,

so the remote tags (2. ewon) has to be in real time logging mode (also historical logging)?

BR,

Simon

Hi!

I forgot for real time log.

Bye,

Simon


Attached Files
.png   Tags_2_ewon.png (Size: 137,96 KB / Downloads: 29)
.png   Real_time_log_2.png (Size: 199,24 KB / Downloads: 24)
.png   Real_time_log_1.png (Size: 209,82 KB / Downloads: 20)
Reply

simon Offline
eWON Support
#13
Simon,

So the problem you have is that your eWON cannot resolve the name m2web.talk2m.com to access the M2Web API.
I added an option named "m2u" in the IOserver config that allows to go through M2U to connect M2Web (https://developer.ewon.biz/content/https-m2u)
In your case, it fixes your problem as the m2u.talk2m.com URL does not have to be resolved as its IP is hardcoded in the eWON.
REM : This new option also allows to run the addon the old eWON CD.

Here is what it implies for your config :
  • You must use the latest version of the addon attached
  • You must add the option "m2u:true" in your IOserver config

    account:myaccountusername:usernamepassword:passwordloglevel:2forcereadingafterwriting:truepollrate:120m2u:true
  • You must make sure your eWON Flexy (the one running the addon) is connected to Talk2M as well
  • You must associate the URL "eu1.m2web.talk2m.com" to the first m2u URL (m2u.talk2m.com) in eCatcher (see snapshot attached)

Also, another issue you may face is if your account/login or password use special characters. If yes, you have to escape them first --> See https://meyerweb.com/eric/tools/dencoder/ before configuring them in the addon settings.


Attached Files
.jpg   m2u.jpg (Size: 76,18 KB / Downloads: 71)
.zip   ShareTagsOverTalk2M.zip (Size: 14,15 KB / Downloads: 40)
Reply

nico.oosthuizen Offline
Junior Member
#14
Hi Simon,

I have used your latest addon above on a Flexy201 to read tags from a Flexy205 and all works well. But when I use this addon on a Flexy205 to read tags from the Flexy201 I get the following errors:

httpc-http request error
dns-Unable to resolve host name (m2u.talk2m.com)

Any advice?
Reply

simon Offline
eWON Support
#15
Hi,

Is this eWON (Flexy 205) connected on Talk2M ? It must be to be able to use m2u.
BTW, it is usually not mandatory to use m2u. Can you try with "m2u:false" ?

Simon
Reply



Possibly Related Threads…
  LAN device to talk2m Started by sommmen
3 Replies - 672 Views
16-10-2019, 02:45 PM
Last Post: simon
08-08-2019, 06:20 PM
Last Post: simon
18-06-2019, 12:38 PM
Last Post: simon
08-04-2019, 03:54 PM
Last Post: anilkaygisiz
  Ewon flexy Started by jenesha
1 Replies - 712 Views
01-03-2019, 07:20 PM
Last Post: simon
24-07-2018, 03:38 PM
Last Post: iw3bti
  Data to Azure BI? Started by hsaelens
3 Replies - 3.119 Views
07-03-2018, 04:46 PM
Last Post: simon



Users browsing this thread:
1 Guest(s)



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