How to use the Email Node

I have a basic flow working with an IMAP email account. When there is unread email my inbox an LED is turned on.

I have two issues that I am trying resolve.

  1. In order to turn off the LED when there is no unread email, I have turn off the LED before checking if there is any email, then turn on the LED again if there is unread email. I would like the LED to always be on. How do I turn off the LED, only if there is no unread email?

  2. I check my inbox every 10 seconds. I have played around with TTS to tell me when there is unread email. I only want to be notified once by speech that there is unread email. At the moment I am being told every 10 seconds, which is annoying. Ideally I would like TTS to only run once when the LED goes from off to on.

What does the payload from the email node look like when

  • you have mail
  • you do not have mail

(I honestly dont know - please add debug nodes and show us)

If there is something immediately obviously different, then use a switch node to tell the difference between the 2, then you can set or reset the LED as required.

NOTE: I have no idea if there is even a payload from the Email-in when there are no emails. If that is the case, then you can use a trigger node to check if there was a response...

@Steve-Mcl Thanks Steve. There is no payload when there are no emails. I am new to node-red, so still trying to understand all the different tunes I can play with the different nodes. I will try your suggestion of the trigger. I have been trying to use Interval length node, I am getting somewhere with it, but I think it's making things more complicated than they need to be.

Will let you know how I get on and may have to ask for some more advice.

Thanks again

Setting the trigger node something like this :point_down:should get you somewhere near

Some tips / canned entries that should help...

top tips playlist

I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Get the most from the debug node

There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.


Joining separate message streams into one msg

See this article in the cookbook for an example of how to join messages into one object.

@Steve-Mcl Thanks for the links, I will be watching those while having my lunch today. In the mean time, I have solved all my issues with the following flow. You really helped me understand a lot more with your example.

(post deleted by author)

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.