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.

Sending E-mail when the "System starts"
#1
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,
Experience, Exposure, Expertise
Reply
#2
Just use Start up(init)script
------------------------------
Ctrl+F5
Reply
#3
(4 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,

(3 hours ago)Fotaje Wrote:
(4 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 ?
Experience, Exposure, Expertise
Reply
#4
Init script will run once after each system starts so just send yourself an email then.
------------------------------
Ctrl+F5
Reply
#5
(3 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
Experience, Exposure, Expertise
Reply
#6
As it is not event, you cannot use value = event.getvalue(), Use value = grp.getvalue('1/1/1') instead
------------------------------
Ctrl+F5
Reply
#7
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
Reply


Forum Jump: