FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: alex am 24 November 2014, 14:48:52

Titel: configuring email actor in the alarm module
Beitrag von: alex am 24 November 2014, 14:48:52
Searching in the wiki and forum didn't lead me to the righ answer so let's try it this way.
I look for a way to send the alarm details within the email message. Currently all I get is an email message with a fixed subject and no content.

What did I do:
I have create a dummy device mail.alarm with the attribute AlarmDevice set to Actor.
Then I configured this actor within the alarm wizard with {fb_mail('alex@vanhoboken.nl','Alarm',Value('AAA'))}

I also tried some variants like "EVENT$", or "%" but no succesfull results.

How can I send details within the email meesage like what sensor triggered the alarm, when did it exactly happen and what are the messages I en II.
Any help is highly appreciated.

Thanks,
Alex
Titel: Antw:configuring email actor in the alarm module
Beitrag von: Grisu am 24 November 2014, 22:55:38
Hi alex

Please send the content of your fb_mail method
Regards
Grisu
Titel: Antw:configuring email actor in the alarm module
Beitrag von: alex am 25 November 2014, 07:28:29
I use the standard 99_email module for this:

sub fb_mail {
  my $rcpt = $_[0];
  my $subject = $_[1];
  my $text = $_[2];
  Log3 undef,3,$subject;
  system("/bin/echo \"$text\" | /usr/bin/mail -s \"$subject\" \"$rcpt\"");
}

Regards,
Alex
Titel: Antw:configuring email actor in the alarm module
Beitrag von: fiedel am 25 November 2014, 08:40:45
Hi Alex,

this example should show you, how it works:

# Battery warning
define Func_Bat_Lo_N notify .*:[Bb]attery.* {\
if("%" !~ m/ok/) {\
   fb_mail('user@@provider.de','FHEM Batteriewarnung','@ %');;\
   Log 3, "@: Batteriewarnung %";;\
  }\
}


But " $EVENT " instead of " @ "should work as well or even better.  ;)

Best regards

Frank