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?
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
Hi!
I tested this script but it did not work. Is there any bug?
Best regards,
Simon
Hey Simon,
Can you let us know what didn't work? Did you receive a specific error?
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
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 ([
attachment=137], [
attachment=138])
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
(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
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
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 ?
Hi!
I am sending other print screens.
Best regards,
Simon
Hi!
One more question. So, the minimum pool time is 15 seconds?
Bye,
Simon
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 ?
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
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.
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?
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