ESPEASY V2.0 Notifications Syntax

Moderators: rtenklooster, Voyager, BertB, Stuntteam

Forum rules
You have entered the experimental forum, beware!!!
Post Reply
Message
Author
Humanoidx
New user
Posts: 9
Joined: 01 Apr 2017, 20:50

ESPEASY V2.0 Notifications Syntax

#1 Post by Humanoidx » 16 Apr 2017, 21:29

Does anyone know what the Rules Syntax is for the new Email Notifications on ESPEASY V 2.0?
I think the command is "Notify" but i'm not sure what is supposed to go after that.

Also, what is meant by domain in the notification setup page?
Image

I really appreciate the help.

Martinus

Re: ESPEASY V2.0 Notifications Syntax

#2 Post by Martinus » 18 Apr 2017, 21:07

The notification part within ESP Easy Mega is actually some unfinished development. I only ran some tests using the first entry in the notification list using a plain smtp server. There's a command to test this feature:

Notify <notification index id>,[<message body>]

I can use
Notify 1
or
Nofity 1,Demo Body text...

alexpi01
New user
Posts: 2
Joined: 20 Feb 2017, 13:26

Re: ESPEASY V2.0 Notifications Syntax

#3 Post by alexpi01 » 09 May 2017, 15:32

To connect by SMTP to a mail server user/passw are needed. I don't see a way to connect...
Watching the log I could find that there was an attempt to connect but the connection was closed with error. Perhaps this is the error: no user/pass

psy0rz
Normal user
Posts: 232
Joined: 02 Feb 2017, 12:12

Re: ESPEASY V2.0 Notifications Syntax

#4 Post by psy0rz » 04 Jun 2017, 23:32

I created a practical example for notifications: https://www.letscontrolit.com/wiki/inde ... ifications
Please support ESPEasy development via Patreon or buy us a coffee.

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: ESPEASY V2.0 Notifications Syntax

#5 Post by BertB » 07 Jun 2017, 12:38

v2.0.0-dev11is not yet available?

subcamera
New user
Posts: 2
Joined: 20 Jul 2017, 14:14

Re: ESPEASY V2.0 Notifications Syntax

#6 Post by subcamera » 20 Jul 2017, 14:21

Hi,
is there any hint to solve the problem of required password while sending email-notifications?
THX
Joachim

Carlini
Normal user
Posts: 16
Joined: 09 Apr 2017, 17:45
Location: Brazil

Re: ESPEASY V2.0 Notifications Syntax

#7 Post by Carlini » 28 Jul 2017, 02:24

psy0rz wrote: 04 Jun 2017, 23:32 I created a practical example for notifications: https://www.letscontrolit.com/wiki/inde ... ifications
How did you configured the SMTP ? Do you have emial without password ?

psy0rz
Normal user
Posts: 232
Joined: 02 Feb 2017, 12:12

Re: ESPEASY V2.0 Notifications Syntax

#8 Post by psy0rz » 30 Jul 2017, 01:13

yes i used my own mailserver so i didnt need a password.

find out your so called MX record of your maildomain, and deliver the mail directly on port 25.

you could use a site like https://mxtoolbox.com/ or just the "dig" command in linux.
Please support ESPEasy development via Patreon or buy us a coffee.

psy0rz
Normal user
Posts: 232
Joined: 02 Feb 2017, 12:12

Re: ESPEASY V2.0 Notifications Syntax

#9 Post by psy0rz » 30 Jul 2017, 01:14

BertB wrote: 07 Jun 2017, 12:38 v2.0.0-dev11is not yet available?
it wasn't but it is now. :)

versions before dev11 have bugs in smtp notifications.
Please support ESPEasy development via Patreon or buy us a coffee.

riker1
Normal user
Posts: 344
Joined: 26 Dec 2017, 18:02

Re: ESPEASY V2.0 Notifications Syntax

#10 Post by riker1 » 04 Jun 2018, 16:58

Hi
is notification further developed?

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

Re: ESPEASY V2.0 Notifications Syntax

#11 Post by grovkillen » 04 Jun 2018, 18:25

It's not prioritized no.
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:

riker1
Normal user
Posts: 344
Joined: 26 Dec 2017, 18:02

Re: ESPEASY V2.0 Notifications Syntax

#12 Post by riker1 » 04 Jun 2018, 18:47

ok, sad

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

Re: ESPEASY V2.0 Notifications Syntax

#13 Post by grovkillen » 05 Jun 2018, 07:18

Yes, sad but we don't have very much time to spend on the project. Our daily job pays our bills.
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:

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

Re: ESPEASY V2.0 Notifications Syntax

#14 Post by TD-er » 05 Jun 2018, 14:09

Well, you can send emails using notifications from within rules.
But the number of mail-hosts accepting non-secure connections is rather limited.
I use SMTP2go as an intermediate, or you can use any Linux machine to route the mails.

Sandominion
Normal user
Posts: 11
Joined: 02 Aug 2018, 12:36

Re: ESPEASY V2.0 Notifications Syntax

#15 Post by Sandominion » 02 Aug 2018, 12:50

I ran crazy trying to send an E-Mail form my Sonoff before I found out about the missing SSL feature in ESPEasy.
Now I got a new account on one of the few providers left (smart-mail.de) with simple SMTP (w/o SSL), made it work with my device and found this discussion only afterwards.

Would be nice for the next users to add a NO-SSL hint in the corresponding Wiki article where this looks much easier:
https://www.letscontrolit.com/wiki/inde ... y_settings
I would change it by myself if the account Request for the Wiki wouldn't be more complex than for the SMTP-Email service.
It was difficult enough to register for this forum because I failed on your CAPTCHA check with drag and drop on different Android devices.

Can anybody tell me how to add a 2nd receipient?

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

Re: ESPEASY V2.0 Notifications Syntax

#16 Post by TD-er » 03 Aug 2018, 21:55

I tried SMTP2go. Is also free, for a limited amount of mails per month (1000 I think)
Adding some warning on the info page on the wiki about it (and adding a link to the wiki if there isn't one of those questionmark buttons on the page) isn't a bad idea.

Sandominion
Normal user
Posts: 11
Joined: 02 Aug 2018, 12:36

Re: ESPEASY V2.0 Notifications Syntax

#17 Post by Sandominion » 04 Aug 2018, 00:22

TD-er wrote: 03 Aug 2018, 21:55 Adding some warning on the info page on the wiki about it (and adding a link to the wiki if there isn't one of those questionmark buttons on the page) isn't a bad idea.
Thanks for your answer. Indeed there is no hint or warning about SSL in your Wiki article about EasyNotifications (and I can't add any). Inside the Notification Settings of the running device there is a link to exactly this Wiki article already.

How about my question about 2nd Receiver? Do I have to separate them with comma or space or something or do I have to use another Notification for each recipient?

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

Re: ESPEASY V2.0 Notifications Syntax

#18 Post by TD-er » 04 Aug 2018, 11:49

Sandominion wrote: 04 Aug 2018, 00:22
TD-er wrote: 03 Aug 2018, 21:55 Adding some warning on the info page on the wiki about it (and adding a link to the wiki if there isn't one of those questionmark buttons on the page) isn't a bad idea.
Thanks for your answer. Indeed there is no hint or warning about SSL in your Wiki article about EasyNotifications (and I can't add any). Inside the Notification Settings of the running device there is a link to exactly this Wiki article already.

How about my question about 2nd Receiver? Do I have to separate them with comma or space or something or do I have to use another Notification for each recipient?
You could try a comma separated list, as long as it fits in the fixed size "to" field.
See: https://tools.ietf.org/html/rfc2822#page-22

Sandominion
Normal user
Posts: 11
Joined: 02 Aug 2018, 12:36

Re: ESPEASY V2.0 Notifications Syntax

#19 Post by Sandominion » 11 Aug 2018, 10:54

Sandominion wrote: 04 Aug 2018, 00:22
TD-er wrote: 03 Aug 2018, 21:55 Adding some warning on the info page on the wiki about it (and adding a link to the wiki if there isn't one of those questionmark buttons on the page) isn't a bad idea.
Thanks for your answer. Indeed there is no hint or warning about SSL in your Wiki article about EasyNotifications (and I can't add any). Inside the Notification Settings of the running device there is a link to exactly this Wiki article already.
I've got an account for the Wiki and wrote not only a warning but a chapter about my experience:
https://www.letscontrolit.com/wiki/inde ... tification

TD-er wrote: 04 Aug 2018, 11:49
Sandominion wrote: 04 Aug 2018, 00:22 How about my question about 2nd Receiver? Do I have to separate them with comma or space or something or do I have to use another Notification for each recipient?
You could try a comma separated list, as long as it fits in the fixed size "to" field.
See: https://tools.ietf.org/html/rfc2822#page-22
I tried to seperate the Receivers with different seperators without success. What is the fixed size?

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

Re: ESPEASY V2.0 Notifications Syntax

#20 Post by TD-er » 11 Aug 2018, 13:11

Sandominion wrote: 11 Aug 2018, 10:54 [...]
I've got an account for the Wiki and wrote not only a warning but a chapter about my experience:
https://www.letscontrolit.com/wiki/inde ... tification
Great :)
One remark about the examples given for the rules.
A space can be used in texts, since very recent builds, but then you have to use quotes like "This is a body with spaces"
I am not sure how spaces are currently interpreted in the rules parser, but at least in the past it was translated into a "," which is essentially a parameter separator.
Sandominion wrote: 11 Aug 2018, 10:54 [...]
I tried to seperate the Receivers with different seperators without success. What is the fixed size?
The fixed size is 64 bytes, which seems to include the trailing 0, so essentially it is 63 bytes.

A quick google search points me to this site: https://mailformat.dan.info/headers/from.html
If you need to put more than one e-mail address in a header, for instance when you wish to send a message to several people at once, the addresses are separated with commas, like this (with "simple" addresses):

jsmith@example.net, mjones@example.org

Or this (with names and addresses):

"John Smith" <jsmith@example.net>, "Mark Jones" <mjones@example.org>

The space after the comma is optional, but improves the readability. (The whitespace characters, space and tab, are allowed before or after each address within a header.)

Note that the comma (,) is the proper separator between multiple addresses, not the semicolon (;) or any other character. There are some mail programs that display lists of addresses with semicolons, and accept this format when taking input of addresses, but any standards-compliant program will actually use commas when transmitting the address list in a message header. There are reports that some mail programs launched by Web browsers in response to mailto: links require lists of multiple addresses within such a link to be separated by semicolons (and choke on comma-separated lists), while others are the opposite way; it is for reasons like this that it is not recommended that you use anything other than a single address in a mailto: link, even if there are standards documents allowing more complex values.

Sandominion
Normal user
Posts: 11
Joined: 02 Aug 2018, 12:36

Re: ESPEASY V2.0 Notifications Syntax

#21 Post by Sandominion » 12 Aug 2018, 12:51

Thanks for reading my Wiki artikle. I wasn't sure if somebody would be interested.
TD-er wrote: 11 Aug 2018, 13:11 A space can be used in texts, since very recent builds, but then you have to use quotes like "This is a body with spaces"
I am not sure how spaces are currently interpreted in the rules parser, but at least in the past it was translated into a "," which is essentially a parameter separator.
The body text in quotation marks works fine even inside Rules. I added it to the artikle. Thanks for the hint.

If you need to put more than one e-mail address in a header, for instance when you wish to send a message to several people at once, the addresses are separated with commas, like this (with "simple" addresses):

jsmith@example.net, mjones@example.org
That definitely does not work with ESPEasy Notifikation. I did many tests but the Email always goes out to the first Receiver only for example with filled in Receiver like:

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

Re: ESPEASY V2.0 Notifications Syntax

#22 Post by TD-er » 12 Aug 2018, 21:39

I guess that's somewhere inbetween a "bug" and a "very much desired feature" :)
Can you make an issue for it on Github?

Sandominion
Normal user
Posts: 11
Joined: 02 Aug 2018, 12:36

Re: ESPEASY V2.0 Notifications Syntax

#23 Post by Sandominion » 13 Aug 2018, 20:25

TD-er wrote: 12 Aug 2018, 21:39 I guess that's somewhere inbetween a "bug" and a "very much desired feature" :)
Can you make an issue for it on Github?
I agree that it’s not really a bug.
According to the SMTP-Syntax in https://tools.ietf.org/html/rfc5321#section-4.1.1 the command RECIPIENT (RCPT) “is used to identify an individual recipient of the mail data; multiple recipients are specified by multiple uses of this command.”

I took a look inside the SMTP handling inside sources of ESPEasy and found the piece of code responsible for setting together the string for RCPT. There is foreseen the command only once for the one-and-only recipient:
if (!NPlugin_001_MTA(client, String(F("RCPT TO:<")) + notificationsettings.Receiver + ">", F("250 "))) break;
Seems it would be necessary to seek the string for (different) separators and distinguish the receivers. For each optional receiver there needs to be an extra RCPT command.
Are you sure it’s worth to create an issue for that (if nobody else has asked this feature)?

The alternative is to mention it in the Wiki that only one Receiver is allowed and you can create another notification with a second Receiver.
What do you think?

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

Re: ESPEASY V2.0 Notifications Syntax

#24 Post by TD-er » 14 Aug 2018, 13:49

Just make an issue for it with your description of the request, just like you did here.
We also have to take a closer look at the size of some stored settings and how to use them.
This may be an excellent example how to improve it.

HomeJCL
Normal user
Posts: 89
Joined: 03 Feb 2018, 10:42

Re: ESPEASY V2.0 Notifications Syntax

#25 Post by HomeJCL » 11 Dec 2018, 13:34

Hi

Lately SMTP2GO is getting erratic with Gmail (was announced from Gmail) but now arrives at a point to be nearly use less.

Has someone an alternative ?

Thanks
Belgium and land of ESP ... counting :D

Sandominion
Normal user
Posts: 11
Joined: 02 Aug 2018, 12:36

Re: ESPEASY V2.0 Notifications Syntax

#26 Post by Sandominion » 12 Dec 2018, 11:44

HomeJCL wrote: 11 Dec 2018, 13:34 Lately SMTP2GO is getting erratic with Gmail (was announced from Gmail) but now arrives at a point to be nearly use less.
Has someone an alternative ?
For me www.smart-mail.de works fine.
In Wiki you find the server-settings etc. as Example 2:
www.letscontrolit.com/wiki/index.php/Ea ... tification

angelo67
Normal user
Posts: 10
Joined: 08 May 2018, 21:32

Re: ESPEASY V2.0 Notifications Syntax

#27 Post by angelo67 » 17 Dec 2018, 16:15

Hello,
sorry for my english (use google tratutore).
My question is this:
using email notification and everything works very well,
using its correct syntax :
"Notify <position>, [message_in_the_body]"

I would like to edit the text in the "[message_in_the_body]"
so that it is sent over several lines for an easier reading of the email.

I can change the text but everything is written on one very long line.
Type the <BR> command for the html.

thank you

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

Re: ESPEASY V2.0 Notifications Syntax

#28 Post by grovkillen » 17 Dec 2018, 18:32

angelo67 wrote: 17 Dec 2018, 16:15 Hello,
sorry for my english (use google tratutore).
My question is this:
using email notification and everything works very well,
using its correct syntax :
"Notify <position>, [message_in_the_body]"

I would like to edit the text in the "[message_in_the_body]"
so that it is sent over several lines for an easier reading of the email.

I can change the text but everything is written on one very long line.
Type the <BR> command for the html.

thank you
You can try the system variables %R% and %N%
Attachments
IMG_20181217_183135.jpg
IMG_20181217_183135.jpg (192.92 KiB) Viewed 47277 times
IMG_20181217_183011.jpg
IMG_20181217_183011.jpg (312.02 KiB) Viewed 47277 times
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:

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

Re: ESPEASY V2.0 Notifications Syntax

#29 Post by grovkillen » 17 Dec 2018, 18:38

%CR%, %SP% and %LF% might also be of help.
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:

angelo67
Normal user
Posts: 10
Joined: 08 May 2018, 21:32

Re: ESPEASY V2.0 Notifications Syntax

#30 Post by angelo67 » 17 Dec 2018, 21:30

Hello,
thank you grovkillen

%CR% is very good
is like <BR> in HTML .
Now the email is very nice and simple to read

thank you

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

Re: ESPEASY V2.0 Notifications Syntax

#31 Post by grovkillen » 17 Dec 2018, 22:20

Great! :)
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:

Temperotos
New user
Posts: 2
Joined: 18 Mar 2019, 10:20

Re: ESPEASY V2.0 Notifications Syntax

#32 Post by Temperotos » 18 Mar 2019, 10:46

E-Mail at each time of sensor reading (becomes to many of them...)

Hello together,

I found quite a lot of information all over the wiki, got my notify rule running, but still one issue:
I basically want to get one mail, when it gets to cold and the danger of water could be freezing, which is damaging a pump.

on TEMP#Cel do
if [TEMP#Cel]<3.0
notify 1, "Temperature under 3°C! %CR% [TEMP#Cel]°C above the water."
endif
endon

But in this case I get a mail all 15 min, which is the interval of my sensor reading and gets annoying after a while.
I tried with a dummy switch, but there it's the same with the cycle I set. Just with a real GPIO - Switch input I find the toggling with e.g. a rising flank.

Is there any other idea or solution, maybe like latching, to do the event just one time, as long as the value is below the point and reset the latch after the temperature rises over 3°C again?

Thanks so far!

Temperotos
New user
Posts: 2
Joined: 18 Mar 2019, 10:20

Re: ESPEASY V2.0 Notifications Syntax

#33 Post by Temperotos » 21 Mar 2019, 09:18

I found a solution with a separate SW-switch, but if somebody has a more smart solution, let me know, cause here I need a switch for each temp. value I want a notification for.

on TEMP#Cel do
if [TEMP#Cel]>4.0
TaskValueSet 12,1,1
endif
endon
on Switch#Dummy1 do
if [[TEMP#Cel]<3 and [Switch#Dummy1]=1
notify 1, "Actual temp. above the water: [TEMP#Cel]°C"
TaskValueSet 12,1,0
endif
endon

Sandominion
Normal user
Posts: 11
Joined: 02 Aug 2018, 12:36

Re: ESPEASY V2.0 Notifications Syntax

#34 Post by Sandominion » 15 Jul 2019, 04:42

Temperotos wrote: 21 Mar 2019, 09:18 I found a solution with a separate SW-switch, but if somebody has a more smart solution, let me know...
I would solve it this way:

on TEMP#Cel do
if [TEMP#Cel]>4.0
TaskValueSet 12,1,0 //reactivate warning msg
endif
if [Switch#Dummy1]=0 do
if [TEMP#Cel]<3
notify 1, Actual_temp._above_the_water:_[TEMP#Cel]°C
TaskValueSet 12,1,1 //deactivate warning msg
endif
endif
endon

duelago
New user
Posts: 9
Joined: 13 Aug 2017, 10:41

Re: ESPEASY V2.0 Notifications Syntax

#35 Post by duelago » 23 Mar 2020, 13:18

Hello folks,

Old thread but I wonder if anyone else got this problem with email notifications. I'm running mega-20200310 and spent a couple of hours to get the notifications to work.
I have configured my device with a static ip and to use 8.8.8.8 as a dns. However, the only way to be able to communicate with an external SMTP-server is to use an IP-address instead of proper host name. I.e Everything works if I use 176.58.103.10 instead of mail.smtp2go.com No big deal as long as the mail service is not switching IP, but I would prefer a proper host name.

Any advice?

(I have followed the instructions at https://www.letscontrolit.com/wiki/inde ... ifications )

Best regards,
/David

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: ESPEASY V2.0 Notifications Syntax

#36 Post by Shardan » 23 Mar 2020, 19:53

At first check from a windows PC:
- open a CMD windows
- enter "nslookup mail.smtp2go.com" [enter]
nslookup should show the correct IP adress of the service.
If not, there is a problem with DNS in your network.

If the nslookup command works, check the DNS settings with the ESP,
there might be something wrong.
Regards
Shardan

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests