LogicMachine Forum
Sending E-mail when the "System starts" - Printable Version

+- LogicMachine 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: Sending E-mail when the "System starts" (/showthread.php?tid=6584)



Sending E-mail when the "System starts" - Fotaje - 29.10.2026

Hello dear experts,

i need some support on eventually simple task.
I want to send e-mail to a specific user every time when the system "starts again", mainly after power failure. I have seen that there is a record on the Alert manager. It is a for of an internal (system) message and i'm struggling on how to send this exact message as e-mail Notification.

My e-mail configuration works fine. I have tested with other group object.
Common scripts are configured. i'm using the Google e-mail server.

Event script is created.

I need help with the syntax of the script.

Sincerely,


RE: Sending E-mail when the "System starts" - Daniel - 30.10.2026

Just use Start up(init)script


RE: Sending E-mail when the "System starts" - Fotaje - 30.10.2026

(2 hours ago)Daniel Wrote: Just use Start up(init)script

Thanks for the fast reply, 
unfortunately it's a bit complex for me to understand.
Can you describe the process step-by-step so i can test it 

Sincerely,

(2 hours ago)Fotaje Wrote:
(2 hours ago)Daniel Wrote: Just use Start up(init)script

Thanks for the fast reply, 
unfortunately it's a bit complex for me to understand.
Can you describe the process step-by-step so i can test it 

Sincerely,

Ah, u mean that just to replace the Event script for Notification with initial script for notification. ? Am i geting it right ?


RE: Sending E-mail when the "System starts" - Daniel - 30.10.2026

Init script will run once after each system starts so just send yourself an email then.


RE: Sending E-mail when the "System starts" - Fotaje - 30.10.2026

(2 hours ago)Daniel Wrote: Init script will run once after each system starts so just send yourself an email then.

OK, i have never done it to be honest. (setting initial scripts)

This is my event Script, how to adapt it to be initial one ? 

value = event.getvalue()

to = 'mymail@gmail.com'
subject = 'Alert'
message = 'KNX object 4/0/1 value is: ' .. tostring(value)

res, err = mail(to, subject, message)

if not res then
  log(err)
end


RE: Sending E-mail when the "System starts" - Daniel - 30.10.2026

As it is not event, you cannot use value = event.getvalue(), Use value = grp.getvalue('1/1/1') instead


RE: Sending E-mail when the "System starts" - admin - 30.10.2026

You should add a delay to the init script. If you have a power outage LM can start faster than your router so sending an email can fail.

Code:
os.sleep(60) to = 'mymail@gmail.com' subject = 'Alert' message = 'LM started' res, err = mail(to, subject, message) if not res then   log(err) end