+2
Under review
Data base
Hello,
Is there a way to create a database with i2control (with javascript or other means) ?
Or is it possible to create tokens by program (but a large amount several thousand) ?
The goals is to save data related to the measurement of energy. Backup hourly measurements every day and years !
Sincerely,
Patrick
Is there a way to create a database with i2control (with javascript or other means) ?
Or is it possible to create tokens by program (but a large amount several thousand) ?
The goals is to save data related to the measurement of energy. Backup hourly measurements every day and years !
Sincerely,
Patrick
Customer support service by UserEcho
The easiest way that I know of is to store the data is a JSON format. Then use JSON.Stringify(mydata); that will convert the json object into a string so you can write the string to an project token. When reloading the project token you can use JSON.Parse(mydata) to convert the string back into an json object.
Thanks,
Roger
Thank you Roger
Is it possible to create tokens in the i2control program?
I use the instructions:
IR.GetVariable("Global.Type_Graphe"); //Read Type_Graphe token
IR.SetVariable("Global.Type_Graphe", true); //Write Type_Graphe token
But the tokens already exist, I created them manually
JSON
To use JSON with javascript, it is necessary to include a library?
Or I can use instructions directly in the program ?
JSON.Stringify(mydata);
JSON.Parse(mydata);
thank you
Sincerely,
Patrick
You can do something on the line of:
var mydb = [{ name:"value 1", value:100}, { name:"value 2", value:75},{ name:"value 3", value:50}];
function loaddb(){
var dbtxt = IR.GetVariable("Global.mydb");
mydb = JSON.Parse(dbtxt);
}
function savedb(){
var dbtxt = JSON.Stringify(mydb);
IR.SetVariable("Global.mydb", dbtxt);
}
Whenever I work with project tokens in script, I always create the token in the project itself with the GUI Editor.
Using these as a basis, it will allow you to structure the data you use in scripts and take advantage of project tokens to keep the data in permanent storage.
Thanks,
Roger
Hello,
I do this, I created all tokens with gui editor, which allowed me to structure the data.
But in this case, there will be thousands of data to create dynamically.
I need to save the measurement data sent by KNX components.
The RT2012 standard (for France) request to make the consumption of 5 measurement circuits.
In addition to data sent every day, every week, every month, the KNX component sends data every hour. And this data should be backed up in real time (in case of power failure).
The user can view the measures (visualized by the graph) to compare the consumption.
In addition to data sent every day, every week, every month, the KNX component sends data every hour. And this data should be backed up in real time (in case of power failure).
The user can view hourly measurements of one day going back several years (visualized by the graph) to compare consumption.
One problem with i2control is that tokens that are created dynamically do not appear in the structure with Gui edit.
I think JSON not bring me anything because I have to save the data in real time.
Are tokens suitable for my problem?
No possibility of structuring in the case of a dynamic creation (by the program).
No possibility to visualize by Gui Editor the structure created.
There are a limited number of tokens?
In my case counting only the data hourly measurements (over 10 years:):
365 days x 24 measures = 8760 datas x 5 circuits = 43800 datas x 10 years = 438 000 datas
Thank you,
Sincerely,
Patrick
JSON will provide you with way to structure your data as a single object, so you would only have to save one token. JSON is is a lightweight data interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate The great thing is its a subset of Javascript so an subset iRidium script.
When you want to have the possibility to store this info or export to other systems I would look at Logic Machine. It will give you the ability to store >10 years of data. You could either get the Logic machine to gather, store the data or and an iRidium project to retrieve and visualize this information OR an iRidium project which gathers the data and stores it in the logic machine. Either way will work.
To give you an example, I was in the situation were my installations there was an increasing need by the end user to create their own scenes. I could have developed an scene saver directly into an iRidium project and used project token to store the scenes. The downside to this would be that the scenes created are specific to the iRidium client (ipad). You create a scene on the lviing ipad, then only the living ipad has that scene. I need an server\client based solution. Given the iRidium server is in development, I created my own.
I have built an scene server ( for KNX lights and shades ) on the Logic Machine, a client driver in iRidium, Both the Logic Machine server and iRidium generate, exchange JSON objects. I created a database structure using JSON to store the scenes at room, floor and house level. The Logic Machine is used to playback the scenes which can run on-demand, on-time and with time offset to sunrise\sunset..
Thanks,
Roger
I have not yet chosen the central module which will have the server function (intel CPU? ARM?) there is a choice and many opportunities.
On my project, there may be :
Only the master operates according to the user programming, climate, watering ...
Slaves supervisors visualize states and can perform manual controls.
Data synchronization is done by an object server, the interface Weinzierl IP / KNX BAOS 772.
I am not a expert in javascript, I made it simple for me. I do not control the programming for the exchange of data over a network, such as client / server exchanges.
Thousands of measures (seen in the above email) to safeguard data in real time will be displayed only on the master.
The use of tokens in I2control (as there is no opportunity to structure in dynamic) is not a good solution.
Is it possible to create a JSON file with javascript, in which safeguard the data for one month for example.
And on each KNX data reception (each hour):
Thank you,
Sincerely,
Patrick
Sure its possible to write something to meet your requirements. Contact me and we can discuss this further, ( support@rocfusion.com )
Thanks,
Roger