Logic Machine Forum
Send email with objekt value - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Send email with objekt value (/showthread.php?tid=1834)



Send email with objekt value - Mariolatrie - 14.01.2019

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


RE: Send email with objekt value - Daniel - 14.01.2019

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


RE: Send email with objekt value - Mariolatrie - 14.01.2019

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


RE: Send email with objekt value - Daniel - 14.01.2019

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)



RE: Send email with objekt value - Mariolatrie - 15.01.2019

(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 !!