This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Send email with objekt value
#1
hi everybody,
i´m new in Lua scripting and i need a little bit of your help.
I want to generate a email, with shows me a few values of KNX objekts.
Like an coffee orderlist. 
for example:

"Message:
coffee : 5 (value of knx adress 7/7/7)
coffee with milk: 2 [b][i](value of knx adress 7/7/8)[/i][/b]
coffee with sugar: 9 [b][i](value of knx adress 7/7/9)[/i][/b]
...."

sending emails with simple Objekt values like "door open: true" does already works,
but i have a lot of ??? in my brain ´couse of this mail script.

I use a Schneider Elektric spaceLYnk HW: i.MX6 SW:2.1.1

Thank´s you a lot.

P.S.: sorry for my english, my school time is a few years ago  Blush

greetings from Germany
Reply
#2
Hi
Are those objects bits? Do you want to send each time any of those objects will receive a value, only TRUE or a specific value?
BR
------------------------------
Ctrl+F5
Reply
#3
Hi!

I think i will make a Visu page,
where i can choose the numbers of Coffee etc., maybe in 1byte unsigned integer and
a "apply" button with 1bit value, which runs the event to send the order...

Big Grin
Reply
#4
Hi
Then create additional object Apply(bit) set it on visu to send fixed value 1 and create event based script under it.
Something like that should do

Code:
coffeNo = grp.getvalue('7/7/7')
milk = grp.getvalue('7/7/8')
sugar = grp.getvalue('7/7/8')

milktext= ''
sugartext=''

apply =  event.getvalue()

if (apply) then
 
 if (milk) then
   milktext = ' with milk'
   if (sugar) then
     sugartext = ' and sugar'
   end  
   
    else
   milktext = ' '  
     if (sugar) then
     sugartext = ' and with sugar'
     end
    end
end


-- make sure mail settings are set in user function library before using this function
subject = 'E-mail test'
message = tostring(coffeNo)..milktext..sugartext..' Please'
mail('user@example.com', subject, message)
------------------------------
Ctrl+F5
Reply
#5
(14.01.2019, 15:56)Daniel. Wrote: Hi
Then create additional object Apply(bit) set it on visu to send fixed value 1 and create event based script under it.
Something like that should do

Code:
coffeNo = grp.getvalue('7/7/7')
milk = grp.getvalue('7/7/8')
sugar = grp.getvalue('7/7/8')

milktext= ''
sugartext=''

apply =  event.getvalue()

if (apply) then
 
 if (milk) then
   milktext = ' with milk'
   if (sugar) then
     sugartext = ' and sugar'
   end  
   
    else
   milktext = ' '  
     if (sugar) then
     sugartext = ' and with sugar'
     end
    end
end


-- make sure mail settings are set in user function library before using this function
subject = 'E-mail test'
message = tostring(coffeNo)..milktext..sugartext..' Please'
mail('user@example.com', subject, message)

Hi Daniel,

it works !!  Smile 

thank you !!
Reply


Forum Jump: