Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

We Value Your Feedback!
Could you please spare a few minutes to share your thoughts on Cloud Connected vs On-Premise Services. Your feedback can help us shape the future of services.
Learn more about the survey or Click here to Launch the survey
Schneider Electric Services Innovation Team!

sending object log by object address or name via email

SpaceLogic KNX Forum

Schneider Electric SpaceLogic KNX forum to get support and share knowledge including selection, installation and troubleshooting for spaceLYnk, Wiser for KNX, eConfigure KNX, SpaceLogic KNX Hybrid module and other topics.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • EcoStruxure Building
  • Light and Room Control
  • SpaceLogic KNX Forum
  • sending object log by object address or name via email
Options
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
Thomas_Rohde
Sisko Thomas_Rohde Sisko
123
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
54
Heribert_Dölger
Lt. Commander Heribert_Dölger Lt. Commander
30
FZetina
Lt. Commander FZetina Lt. Commander
27
View All
Related Products
product field
SpaceLogic KNX - 4ʺ Touch Unit
product field
KNX Push Button Dynamic Labeling, universal
product field
Wiser for KNX : logic controller

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to SpaceLogic KNX Forum
Solved
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2020-10-03 02:57 AM . Last Modified: ‎2024-07-14 11:47 PM

0 Likes
28
1124
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2020-10-03 02:57 AM

sending object log by object address or name via email

hello every one 

I found this function script in the community that receives the log hours and the email addresses, and it will send the logged objects by email.

 

I want the function script to send only the logged data for a specific object address.

 

script:  "

  ------------------------BEGINNING OF CSV CREATING-------------------------------
  logtime = os.time() - 60 * 60 * log_hrs
 
-- list of objects by id
objects = {}
 
-- objects with logging enabled
query = 'SELECT address, datatype, name FROM objects WHERE disablelog=0'
for _, object in ipairs(db:getall(query)) do
  objects[ tonumber(object.address) ] = {
    datatype = tonumber(object.datatype),
    name = tostring(object.name or ''),
  }
end
--log("objects",objects)
-- csv buffer
  buffer = {'sep=,'..'\r\n'.. '"date","address","name","value"' }
 
-- get object logs
query = 'SELECT src, address, datahex, logtime, eventtype FROM objectlog WHERE logtime >= ? ORDER BY id DESC'
--log(query, logtime)
for _, row in ipairs(db:getall(query, logtime)) do
  object = objects[ tonumber(row.address) ]
  --log("object " .. _, object)
  -- found matching object and event type is group write
  if object and row.eventtype == 'write' then
    datatype = object.datatype
 
    -- check that object datatype is set
    if datatype then
      -- decode data
      data = knxdatatype.decode(row.datahex, datatype)
 
      -- remove null chars from char/string datatype
      if datatype == dt.char or datatype == dt.string then
        data = data:gsub('%z+', '')
      -- date to DD.MM.YYYY
      elseif datatype == dt.date then
        data = string.format('%.2d.%.2d.%.2d', data.day, data.month, data.year)
      -- time to HH:MM:SS
      elseif datatype == dt.time then
        data = string.format('%.2d:%.2d:%.2d', data.hour, data.minute, data.second)
      end
    else
      data = ''
    end
 
    -- format csv row
    logdate = os.date('%Y.%m.%d %H:%M:%S', row.logtime)
    csv = string.format('%q,%q,%q,%q', logdate, knxlib.decodega(row.address), object.name, tostring(data))
 
    -- add to buffer
    table.insert(buffer, csv)
  end
end
  
  -------------------------END OF CSV CREATING----------------------------

 

 

 

 

 

"

 

this is the community link:  https://community.se.com/t5/KNX-Forum/HomeLynk-sending-object-log-via-email/td-p/51550

 

 

 

 

@Erwin-vd-Zwart 

Best Regards,
  • Thumbnail of SpaceLogic KNX - 4ʺ Touch Unit
    SpaceLogic KNX - 4ʺ Touch Unit
  • Thumbnail of KNX Push Button Dynamic Labeling, universal
    KNX Push Button Dynamic Labeling, universal
  • Thumbnail of Wiser for KNX : logic controller
    Wiser for KNX : logic controller
View products (3)
Labels
  • Labels:
  • Scripts
  • SpaceLYnk
Tags (1)
  • Tags:
  • english
Reply
  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2020-10-04 02:55 PM

2 Likes
25
1106
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2020-10-04 02:55 PM

Yes, sorry for the mistake but the address is encoded in the DB so you need an extra command (:

 

Change:

 

db:getall(query, "1/1/1", logtime)

 

into:

 

db:getall(query, knxlib.encodega("1/1/1"), logtime)

See Answer In Context

Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-04 12:16 AM

0 Likes
16
1056
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-04 12:16 AM

Try this:

 

1) Add a unique TAG to your objects of interest you want to show in your logs view, in this sample i used 'logs' 

1) Run code below once to automatically create the logs.lp file in the user FTP folder, after that you can deleted this code.

3) To test this .lp file open your browser and open http://192.168.0.10/user/logs.lp?tag=logs

4) Create a frame with the URL /user/logs.lp?tag=logs  or  /user/logs.lp?tag=logs&limit=10 to limit the number of logged items for each object.

 

 

-- Run this code once and use with url: /user/logs.lp?tag=logs or when to limit each log with less then 100 results use: /user/logs.lp?tag=logs&limit=10
dst = '/www/user/logs.lp'
io.writefile(dst, [[
<?
require('apps')
tagname = getvar('tag') or ''
limit = getvar('limit') or 100
objects = grp.tag(tagname)
logitems = {}
for _, obj in ipairs(objects) do
query = 'SELECT * FROM objectlog WHERE address=? ORDER BY id DESC LIMIT ?'
items = db:getall(query, obj.id, limit)
for _, item in ipairs(items) do
logtime = os.date('%c', item.logtime)
value = busdatatype.decode(item.datahex, obj.datatype)
if item.src > 0 then
src=buslib.decodeia(item.src)
else
src='local'
end
table.insert(logitems, {name = obj.name, datetime = logtime, value = value, src=src, eventtype = item.eventtype})
end
end
if #logitems == 0 then
print('no data found from objects with this tag in the object logs')
return
end
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Logs</title>
<link rel="stylesheet" href="/apps/css/bootstrap.css">
<style>
.table { table-layout: fixed; }
.name { width: 60%; }
.value { width: 20%; }
.datetime { width: 20%; }
/* .source { width: 20%; } */
/* .event { width: 20%; } */
</style>
</head>
<body>
<table class="table">
<tr>
<th class="name">Name</th>
<th class="value">Value</th>
<th class="datetime">Date/time</th>
<!-- <th class="source">Source</th> -->
<!-- <th class="event">Event type</th> -->
</tr>
<?
for _, item in ipairs(logitems) do
?>
<tr>
<td><?=escape(item.name)?></td>
<td><?=escape(item.value)?></td>
<td><?=escape(item.datetime)?></td>
<!-- <td><?=escape(item.src)?></td> -->
<!-- <td><?=escape(item.eventtype)?></td> -->
</tr>
<? end ?>
</table>
<script type="text/javascript">
</script>
</body>
</html>
]])
script.disable(_SCRIPTNAME)

See Answer In Context

Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-04 01:53 PM

1 Like
8
1033
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-04 01:53 PM

Every customer wants custom development for their special needs, We can’t support all off that (:

 

I can provide info on how to build your own app but it requires quite some knowledge of HTML, CSS, JS, SQL queries and LUA.

See Answer In Context

Tags (1)
  • Tags:
  • english
Reply
Replies 28
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2020-10-03 03:38 AM . Last Modified: ‎2020-10-03 03:41 AM

0 Likes
27
1121
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2020-10-03 03:38 AM

Hi,

 

You just need to change the query in that case:

 

-- get object logs
query = 'SELECT src, address, datahex, logtime, eventtype FROM objectlog WHERE address = ? AND logtime >= ? ORDER BY id DESC'
--log(query, logtime)
for _, row in ipairs(db:getall(query, "1/1/1", logtime)) do
 
In this query only object 1/1/1 is selected

 

BR,

 

Erwin

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2020-10-04 01:36 AM

0 Likes
26
1116
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2020-10-04 01:36 AM

hank you @Erwin-vd-Zwart  for your reply 

 

I tried that but I receive an empty CSV file.

 

is there anything else that should be changed?

 

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2020-10-04 02:55 PM

2 Likes
25
1107
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2020-10-04 02:55 PM

Yes, sorry for the mistake but the address is encoded in the DB so you need an extra command (:

 

Change:

 

db:getall(query, "1/1/1", logtime)

 

into:

 

db:getall(query, knxlib.encodega("1/1/1"), logtime)

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2020-10-05 01:03 AM

0 Likes
24
1101
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2020-10-05 01:03 AM

thank you @Erwin-vd-Zwart  I appreciate your time.

 

with your permission, I need one last thing: 

 

how to send in the same CSV file multiple sheets.

I have three objects logged and I want to send one CSV file containing three sheets for each object log.

 

regards,

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2020-10-05 03:35 AM

1 Like
23
1093
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2020-10-05 03:35 AM

Hi,

 

CSV does not support multiple sheets, that is a Excel functionality..

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2020-10-05 06:08 AM

1 Like
22
1091
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2020-10-05 06:08 AM

thanks @Erwin-vd-Zwart 

 

appreciate your help

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-02 10:05 AM

0 Likes
21
1070
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-02 10:05 AM

Hi @Erwin-vd-Zwart  I hope you are doing well 

I want to show some of the objects log values in the visualisation, but I am lost in this code.

Could you tell me how to deal with object log values using lua script.

 

Regards

 

 

 

 

 

 

 

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-02 01:30 PM

1 Like
20
1066
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-02 01:30 PM

Well basically we do 2 query’s on the SQLite DB because the object log table holds only the records for the encoded GA, timestamp and value, so to get the name and other parameter we do the second request to map both together..

 

To help you better it would be good if you can elaborate a bit in what you try to achieve..

 

i also have a .lp code (client side lua in HTML) so you can create an app view for the object logs so you can embed the view by a frame into the visu after adding the .lp just need to add /user/logs.lp as URL in the frame to show them.

 

 

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-02 08:12 PM

0 Likes
19
1063
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-02 08:12 PM

Hi @Erwin-vd-Zwart  I want to show daily/monthly energy which saved in the object logs.

I think what you say about .ip code will be a good solution, and its interesting.

Regard,

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-03 05:48 AM

0 Likes
18
1060
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-03 05:48 AM

I can prepare something, but do you need to filter certain objects from the log, or just show all that is available in the list?

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-03 07:20 AM

0 Likes
17
1058
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-03 07:20 AM

thank you @Erwin-vd-Zwart  for your response and effort 

yah I want to filter certain objects.

 

regards,

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-04 12:16 AM

0 Likes
16
1057
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-04 12:16 AM

Try this:

 

1) Add a unique TAG to your objects of interest you want to show in your logs view, in this sample i used 'logs' 

1) Run code below once to automatically create the logs.lp file in the user FTP folder, after that you can deleted this code.

3) To test this .lp file open your browser and open http://192.168.0.10/user/logs.lp?tag=logs

4) Create a frame with the URL /user/logs.lp?tag=logs  or  /user/logs.lp?tag=logs&limit=10 to limit the number of logged items for each object.

 

 

-- Run this code once and use with url: /user/logs.lp?tag=logs or when to limit each log with less then 100 results use: /user/logs.lp?tag=logs&limit=10
dst = '/www/user/logs.lp'
io.writefile(dst, [[
<?
require('apps')
tagname = getvar('tag') or ''
limit = getvar('limit') or 100
objects = grp.tag(tagname)
logitems = {}
for _, obj in ipairs(objects) do
query = 'SELECT * FROM objectlog WHERE address=? ORDER BY id DESC LIMIT ?'
items = db:getall(query, obj.id, limit)
for _, item in ipairs(items) do
logtime = os.date('%c', item.logtime)
value = busdatatype.decode(item.datahex, obj.datatype)
if item.src > 0 then
src=buslib.decodeia(item.src)
else
src='local'
end
table.insert(logitems, {name = obj.name, datetime = logtime, value = value, src=src, eventtype = item.eventtype})
end
end
if #logitems == 0 then
print('no data found from objects with this tag in the object logs')
return
end
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Logs</title>
<link rel="stylesheet" href="/apps/css/bootstrap.css">
<style>
.table { table-layout: fixed; }
.name { width: 60%; }
.value { width: 20%; }
.datetime { width: 20%; }
/* .source { width: 20%; } */
/* .event { width: 20%; } */
</style>
</head>
<body>
<table class="table">
<tr>
<th class="name">Name</th>
<th class="value">Value</th>
<th class="datetime">Date/time</th>
<!-- <th class="source">Source</th> -->
<!-- <th class="event">Event type</th> -->
</tr>
<?
for _, item in ipairs(logitems) do
?>
<tr>
<td><?=escape(item.name)?></td>
<td><?=escape(item.value)?></td>
<td><?=escape(item.datetime)?></td>
<!-- <td><?=escape(item.src)?></td> -->
<!-- <td><?=escape(item.eventtype)?></td> -->
</tr>
<? end ?>
</table>
<script type="text/javascript">
</script>
</body>
</html>
]])
script.disable(_SCRIPTNAME)

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-04 11:22 AM . Last Modified: ‎2021-01-04 11:25 AM

0 Likes
11
1050
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-04 11:22 AM

Thank you @Erwin-vd-Zwart  i appreciate your time and effort.

Amaizing its work greate

 

I have the following questions:

1- if i want to add more objects i will add tag to this object snd rerun the code again, this will not make any issue?

2- could I make the limit value as variable GA in the visu and the user change it.

3- also is it possible to let the user choose the objects he want to show?

3- the limit value shouldn't exceed 100?

 

Regards,

 

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-04 11:59 AM . Last Modified: ‎2021-01-04 12:04 PM

1 Like
10
1044
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-04 11:59 AM

1- Just add the tag 'logs' at multiple objects, no need to run the .lp creation code again as that won't change the .lp file..

2- Yes it could but that would require a change in the code of the .lp file and re-run it once.

3- Yes can be made, but this is next level (kinda goes to an app level as you need a html selection box with JS code)

4- Yes can be exeeded, when the argument &limit= is missing the value 100 is used as a default but you can set it in any value as it's only used in the SQL query as limit of fetching items from the DB.

 

For item 2 change the start of the .lp creation code like this and run once again:

 

-- Use with URL /user/logs/lp?tag=logs
dst = '/www/user/logs.lp'
limitaddr = '1/1/1' -- use a 1, 2 or 4 byte integer object for this
io.writefile(dst, [[
<?
require('apps')
tagname = getvar('tag') or ''
limit = grp.getvalue(limitaddr) or 100

 

.... rest of the code unchanged

 

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-04 12:53 PM . Last Modified: ‎2021-01-04 01:05 PM

0 Likes
9
1040
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-04 12:53 PM

Thank you @Erwin-vd-Zwart  for your response.

Regarding point 3 it will be a better solution for the end user.

I will be waiting for that 🙂

Appreciate your time and effort.

Regards,

 

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-04 01:53 PM

1 Like
8
1034
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-04 01:53 PM

Every customer wants custom development for their special needs, We can’t support all off that (:

 

I can provide info on how to build your own app but it requires quite some knowledge of HTML, CSS, JS, SQL queries and LUA.

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-04 07:19 PM . Last Modified: ‎2021-01-04 08:16 PM

0 Likes
0
1031
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-04 07:19 PM

Oh really 

I didn't think it will be in this complexity.

 

For me this is a new way of showing data, Could you tell me where I can use this method in the SL. This is my last question 🤣

I know that I am asking a lot but I like to learn from experts, and not always you got this chance  ☺️

thanks for your support @Erwin-vd-Zwart .

 

Hope you a good life .

 

Regards,

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-05 12:22 AM

0 Likes
3
1018
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-05 12:22 AM

Hello @Erwin-vd-Zwart  

I tried to use GA for the limit but I got This:

 Capture.JPG

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-05 12:31 AM

0 Likes
2
1015
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-05 12:31 AM

Are you using /user/logs/lp?tag=logs

 

must be /user/logs.lp?tag=logs

 

 

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-05 12:41 AM

0 Likes
1
1013
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-05 12:41 AM

I try this: /user/logs.lp?tag=logs

 

I got data but the limit didn't change!

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-05 01:49 AM

1 Like
0
1009
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-05 01:49 AM

The limit is per object that is tagged, so if you have 3 objects tagged and set the limit to 10 you get 3 times the limit of 10 so 30 lines, try to reduce the limit if you have a lot of tagged objects

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-05 01:51 AM

0 Likes
6
1008
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-05 01:51 AM

Hi @Erwin-vd-Zwart 

is there any thing in the limit?

 

I try an easy way for the list by adding and removing TAG using script 🙂

and it works fine but should refresh to view the changes.

 

 

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-05 02:42 AM

1 Like
5
1004
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-05 02:42 AM

Hi,

 

In the .lp creation code below i added a listener on the limit object, if the value is changing i reload the document

 

-- Use with URL /user/logs.lp?tag=logs
dst = '/www/user/logs.lp'
io.writefile(dst, [[
<?
require('apps')
tagname = getvar('tag') or ''
limitaddr = '5/0/3' -- use a 1, 2 or 4 byte integer object for this
limit = grp.getvalue(limitaddr) or 100
objects = grp.tag(tagname)
logitems = {}
for _, obj in ipairs(objects) do
query = 'SELECT * FROM objectlog WHERE address=? ORDER BY id DESC LIMIT ?'
items = db:getall(query, obj.id, limit)
for _, item in ipairs(items) do
logtime = os.date('%c', item.logtime)
value = busdatatype.decode(item.datahex, obj.datatype)
if item.src > 0 then
src=buslib.decodeia(item.src)
else
src='local'
end
table.insert(logitems, {name = obj.name, datetime = logtime, value = value, src=src, eventtype = item.eventtype})
end
end
if logitems == nil or #logitems == 0 then
print('no data found from objects with this tag in the object logs')
return
end
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Logs</title>
<link rel="stylesheet" href="/apps/css/bootstrap.css">
  <script src="/apps/js/jquery.js.gz"></script>
  <script src="/apps/js/localbus.js.gz"></script>
  <script src="/scada/vis/busdecode.js.gz"></script>
<style>
.table { table-layout: fixed; }
.name { width: 60%; }
.value { width: 20%; }
.datetime { width: 20%; }
/* .source { width: 20%; } */
/* .event { width: 20%; } */
</style>
</head>
<body>
<table class="table">
<tr>
<th class="name">Name</th>
<th class="value">Value</th>
<th class="datetime">Date/time</th>
<!-- <th class="source">Source</th> -->
<!-- <th class="event">Event type</th> -->
</tr>
<?
for _, item in ipairs(logitems) do
?>
<tr>
<td><?=escape(item.name)?></td>
<td><?=escape(item.value)?></td>
<td><?=escape(item.datetime)?></td>
<!-- <td><?=escape(item.src)?></td> -->
<!-- <td><?=escape(item.eventtype)?></td> -->
</tr>
<? end ?>
</table>
<script type="text/javascript">
var limitaddr = <? print('"' .. limitaddr .. '"') ?>;
var startlimit = <? print(limit) ?>;
localbus.init();
// listen to a single object
localbus.listen('object', limitaddr, function(value) {
if (value != startlimit){
startlimit = value;
location.reload();
}
}, true);
</script>
</body>
</html>
]])
script.disable(_SCRIPTNAME)

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-05 03:03 AM

0 Likes
1
1002
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-05 03:03 AM

Great Jop @Erwin-vd-Zwart 

Many thanks 🙂

 

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-05 03:10 AM

0 Likes
2
999
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-05 03:10 AM

@Erwin-vd-Zwart  How Can I add another listener, I want to use it to reload the document when the TAG List changed

 

regards, 

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-05 03:11 AM

1 Like
0
998
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-05 03:11 AM

Make sure to set the min setting (in the vis params of the object) of the limit object to 1 (otherwise with 0 there are no values fetched and loading discarded)

Tags (1)
  • Tags:
  • english
Reply
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-01-05 03:17 AM

1 Like
1
994
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-05 03:17 AM

You can solve that server side, add this add the end of your TAG adding script:

 

limitobject = '1/1/1'

limitvalue = grp.getvalue(limitobject)

grp.write(limitobject, limitvalue+1)  -- increase value with 1 to trigger the refresh

grp.write(limitobject, limitvalue) -- write original limit value back

Tags (1)
  • Tags:
  • english
Reply
IC_Systems
Captain IC_Systems
Captain

Posted: ‎2021-01-05 03:24 AM

0 Likes
0
992
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-01-05 03:24 AM

@Erwin-vd-Zwart  I don't know how to thank you.

 

Appreciate your time and effort.

 

Many thanks 🙂

 

regards,

Best Regards,
Tags (1)
  • Tags:
  • english
Reply
Preview Exit Preview

never-displayed

You must be signed in to add attachments

never-displayed

 
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of