would need to add date and some variables in the email notification

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Gilles
Normal user
Posts: 101
Joined: 21 Dec 2017, 11:09

would need to add date and some variables in the email notification

#1 Post by Gilles » 26 Jan 2018, 11:13

I run a SONOFF S20 with the normal 1MB v2.0-20180120.

I use 3 different rules (boot, switched on , switched off) with 3 different "notify email" statements.
1) %sysmonth%, %sysyear% and %sysday% don't work.
I have read the forum but I don't understand if I would need to compile the sources by myself or if it is already or will be included in a "normal" version

2) Would be it possible to pass some parameters (variable) to the email notification, using a %xxx% that the rule would have stored. So the same "notify" could be used for different events.

3) Today the syntax is "notify 1,blabla" , It seems that "blabla" is used in the body of the mail, but whatever the event, it is always the "blabla" which comes from the event 1. The right "blabla" is written in the SYSLOG along with the notify command.


Thanks
Gilles

mattlward
Normal user
Posts: 70
Joined: 24 Jan 2018, 15:20

Re: would need to add date and some variables in the email notification

#2 Post by mattlward » 26 Jan 2018, 20:08

I would love to see this work also. Would be great at boot to email %sysname% and %ip% to myself.

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: would need to add date and some variables in the email notification

#3 Post by TD-er » 27 Jan 2018, 00:33

Could you please test with one of the latest builds?
I have changed the way how system variables are used a few days ago and it was merged 3 or 4 days ago I guess.

The change is that now all occurrences of using these variables is now done the same way.
So all should now support the same variables.
See this pull request: https://github.com/letscontrolit/ESPEasy/pull/757

If it still doesn't work, please open an issue on Github for it.

mattlward
Normal user
Posts: 70
Joined: 24 Jan 2018, 15:20

Re: would need to add date and some variables in the email notification

#4 Post by mattlward » 27 Jan 2018, 01:07

I will try this asap, likely Sunday or Monday.

Thanks

Gilles
Normal user
Posts: 101
Joined: 21 Dec 2017, 11:09

Re: would need to add date and some variables in the email notification

#5 Post by Gilles » 27 Jan 2018, 19:05

It works,
congrat
Here is the configuration that I use :

THE RULE SECTION:
On AL do
gpio,12,1
notify 1
EndOn

THE NOTIFY SECTION:
Subject: %sysname% a été activée %sysday% %sysmonth% %sysyear% %systime%
Body : La prise 2 a été activée

The subject of the mail that I receive is :"Prise2 - Bureau a été activée 27 01 2018 18:30:52 " which is the subject of the notify section so is correct

The body of the mail contains the body of the mail from the Notify section("La prise 2 a été activée") so works well.

NB : I have tried to replace "notify 1" with "notify 1,La prise 2 a été activée". In this case the body of the mail that I receive contains the first word of the "notify 1,La prise 2 a été activée" command, I mean that I only receive the word "La". It overrides the configuration of the mail from the notify section, but it takes only the first word. If you link all the words with an underscore , then it will show you the entire sentence.
Hope it helps
Gilles

Gilles
Normal user
Posts: 101
Joined: 21 Dec 2017, 11:09

Re: would need to add date and some variables in the email notification

#6 Post by Gilles » 27 Jan 2018, 19:06

nothing to add. Just to allow me to tick the "Notify me when a reply is posted" :)

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: would need to add date and some variables in the email notification

#7 Post by TD-er » 28 Jan 2018, 20:00

Maybe @Grovkillen knows some workaround?
If not, then you may have found a bug (the first one in at least like... 5 minutes or so), which needs its own entry on the issue page of Github. https://github.com/letscontrolit/ESPEasy/issues

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: would need to add date and some variables in the email notification

#8 Post by grovkillen » 28 Jan 2018, 20:54

I think the way we allow spaces instead of only allowing comma (,) is the problem here.

Code: Select all

tmpString.replace(" ", ",");
This code will replace each and every one of the spaces in the command.

https://github.com/letscontrolit/ESPEas ... c.ino#L215 as an example...
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

mattlward
Normal user
Posts: 70
Joined: 24 Jan 2018, 15:20

Re: would need to add date and some variables in the email notification

#9 Post by mattlward » 29 Jan 2018, 22:51

So, I am trying to set up a notifier to send email thru gmail.
The options I see are as follows:
Fully qualified domain name of SMTP service
Configuration requirements
smtp-relay.gmail.com
Options: Port 25, 465, or 587
Secure Socket Layer (SSL)/Transport Layer Security (TLS) protocols.
One or more static IP addresses are required.


smtp.gmail.com
Port 465 (SSL required)
Port 587 (TLS required)
Dynamic IPs allowed


aspmx.l.google.com
Port 25
TLS not required
Dynamic IPs allowed
Mail can only be sent to Gmail or G Suite users.


It looks like I would need to use the last option.
I have set the unit up to notify at boot to notify 1 with the listed options.... not sure what to put in the domain field.
I get the following errors logged on serial on boot:
ACT : Notify 1
Timeout while reading input data!
Timeout while reading input data!
Timeout while reading input data!
EMAIL: Connection Closed With Error

Has anyone made this work with gmail?

Gilles
Normal user
Posts: 101
Joined: 21 Dec 2017, 11:09

Re: would need to add date and some variables in the email notification

#10 Post by Gilles » 30 Jan 2018, 14:06

I don't use gmail, but I think that you should configure your internet provider smtp server and domain instead of the gmail ones. There are a lot of posts about this.
Gilles

wim16
Normal user
Posts: 88
Joined: 01 May 2017, 20:35

Re: would need to add date and some variables in the email notification

#11 Post by wim16 » 30 Jan 2018, 14:16

I think gmail requires username and password which are not in ESPEasy.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 138 guests