Note:
- I did not test this, so take it as a general idea
- I do not know the RFXTRX, so the reading names below may be different, please check before testing.
- there are solutions for this problem already described in the Wiki/Forum, but I don't know them, so probably my solution can be streamlined
How I would do it:
Split the task in two parts, the first concerning the inside/outside temperature, the second the fridge:
1.st part, the inout temperature.
define a dummy which prevents the sending of more than one mail for a problem. You have to reset it manually on the FHEM frontend in order to receive another mail.
define dummy mailsent_inout
attr mailsent_inout setList yes no
attr mailsent_inout webCmd yes:no
Define the notify first in FHEMWEB by entering a minimal one (define ntfy_inout notify X Y) in the command-line, then go to its detail window and click DEF. This way you can avoid the \ at the line-end and the ;; instead of the ;
define ntfy_inout notify THGR132N_1:temperature.*|THGR132N_1:temperature.* {
my $in = ReadingsVal("THGR132N_1", "temperature", 15);
my $out = ReadingsVal("THGR132N_2", "temperature", 15);
my $txt = "";
if($in > $out) {
$txt = "Open the window";
}
if($out > $in) {
$txt = "Close the window";
}
if($txt ne "" && Value("mailsent_inout") ne "yes") {
system "send_me_mail $txt &"
}
}
send_me_mail is a shellscript, located in one of the directories of the PATH environment variable:
#!/bin/sh
FRM=me@my.email.address
TO="me@my.email.address"
OUT=/tmp/sm.$$
DT=`date`
cat > $OUT << EOF
From: Fhem <fhem@my.email.address>
To:$TO
Subject: $*
$DT
EOF
/usr/bin/esmtp -f $FRM -N failure,delay -R hdrs -- $TO < $OUT
rm -f $OUT
You have to change the email adresses above to something sensible. The text is kept short, as I am using this method to send me an SMS via an EMAIL to SMS gateway. You can enter multiple email addresses in the TO variable separated by spaces.
I choose esmtp, as it is (in my opinion) easy to configure: You need an entry like the following in your ~/.esmtprc:
identity me@my.email.address
hostname smtp.provider.com:25
helo=my.email.address
username "me@my.email.address"
password "secret"
starttls enabled
default
you probably should install esmpt first, test this last shell-script first from the UNIX command line, and proceed then with the notify above.
The second part (the fridge) is left as an execrcise to the reader :)