There would be a script, which would contain such information:
Device name;
Table headers (names);
Table entries (names and if needed objects for control).
For example the device would be "Logicmachine5", table headers would be like "Input name" "Input state" "Output name" "Control output" "Comment" and table entries would be for example "IA" IA State" "OA" "OA State" "Not checked", so the whole table would look like this:
Logicmachine5
Input Input State Output Control output Comment
A A State A On/Off Not checked
And then if the script would run, it would create such a table in visualisation with all the objects, for this example it would have to create everything like this:
Device name and table headers as text labels;
Input entries as text labels;
Input states as "read-only" object states;
Output entries are text labels;
Control output entries are objects;
Comment entries are 250 string objects which can be modified from visualisation by end user.
All entries which are controllable or show states need to have the ability to assign them group address in the table creation script.
Is it possible to do this?
Maybe someone could give me a short example how this would work so I can build something out of it? The main part which I need is to know how can I create, if possible, visualisation elements from a script.
This is possible but you will need to do direct db queries.
You can log all elements from a single plan (change 123 to your plan ID) like this:
Code:
id = 123
items = db:getall('SELECT * FROM visobjects WHERE floor=?', id)
log(items)
Then you can insert new elements into a plan. Data must be a table containing all the required field apart from id which must be nil to add a new element:
1. Check Errog log for errors because your code has correct syntax but running it will produce an error
2. Log the return value of the insert function call. Otherwise you won't know why insert does not happen
3. As I've already mentioned do not specify ID because it must be unique. The database will set it automatically if ID is not specified
4. type value is missing, this will cause the visualization to stop working completely
I have used the code above with success, but i have a problem using additional icons. When making a log out of my sample floor, i get this sub table for the param section:
17.03.2021, 08:45 (This post was last modified: 17.03.2021, 08:46 by khalil.)
(07.12.2020, 07:18)admin Wrote: 1. Check Errog log for errors because your code has correct syntax but running it will produce an error
2. Log the return value of the insert function call. Otherwise you won't know why insert does not happen
3. As I've already mentioned do not specify ID because it must be unique. The database will set it automatically if ID is not specified
4. type value is missing, this will cause the visualization to stop working completely
Hello
To run this code in different machine one should change
Name: which is the plan name?
icon_on, icon_off, icon_touch: script created Icon, and the icon name should be in my machine
object, statusobject! I don't understand what are these what else should be changed? regards
(16.03.2021, 21:12)Håvard Fosså Wrote: How do i write the section for the additional icons?
Code:
icons_table = {
{ min = 1, max = 2, icon = "icon1.svg" },
{ min = 3, max = 4, icon = "icon2.svg" },
}
Add to params table:
Code:
icons_add = icons_table,
(17.03.2021, 08:45)khalil Wrote: Name: which is the plan name?
icon_on, icon_off, icon_touch: script created Icon, and the icon name should be in my machine
floor = 851, where 851 is the plan ID. For icons just specify the filename of each icon that is uploaded to Vis.graphics > Icons.
17.03.2021, 09:05 (This post was last modified: 17.03.2021, 09:07 by khalil.)
(17.03.2021, 08:49)admin Wrote:
(16.03.2021, 21:12)Håvard Fosså Wrote: How do i write the section for the additional icons?
Code:
icons_table = {
{ min = 1, max = 2, icon = "icon1.svg" },
{ min = 3, max = 4, icon = "icon2.svg" },
}
Add to params table:
Code:
icons_add = icons_table,
(17.03.2021, 08:45)khalil Wrote: Name: which is the plan name?
icon_on, icon_off, icon_touch: script created Icon, and the icon name should be in my machine
floor = 851, where 851 is the plan ID. For icons just specify the filename of each icon that is uploaded to Vis.graphics > Icons.
thank you, admin
what about object = 2305, statusobject = 2405, what are these see what I got