Beginners questions regarding esphome

Hi!

I’m about to make my mailbox smart. It’s a two lid mailbox and I’m thinking about using a wemos d1 with two reed or micro switches and then power it with a battery pack.

From what I have read deep sleep is I good function to use to save battery.

Do I need any more components eg resistors?

I have searched for examples but haven’t found anything like I’m looking for.

I want to have a binary sensor I HA eg mail/ no mail and I want my second lid to reset to no mail regardless off how many times the first lid has been open and triggered mail

Does any one have some tips?

Br Mathias

The ESP2866 boards (like the D1) only have one wake pin. Use the ESP32. You can have more than one wake from sleep pin with the ESP32 boards. One for each lid. Much simpler.

There’s some good info here:

First thing I would do through is check whether you get a good WiFi signal between esp8266 in your mailbox and your network. Otherwise you could be wasting a lot of time.

You’ll want to wake it up on either of those reed switches. As I read this, you’ll need an esp32. https://esphome.io/components/deep_sleep.html

Why do the reed switches need to be separate, could just wire them in series if NC or parallel if NO.
Unless one of them tells when the box is emptied and one when it’s filled?

Yes I think the mail is put in one door, and extracted from the other.

Of course if someone walks past and opens the box, you get a false alarm.

Hi!

My plan is to mount the esp outside the mailbox in a weather proof box or an external antenna.

Ok, I will look in to the esp32.

If I mount them in parallel then it will toggle if I get mail twice before I empty, right?

Some info on my 2 door mailbox setup here:

and here:

The esp32 looks like a good choice except the price, you can get to d1 for one esp32, is that a better way or just go with the esp32?

Does any one have some code examples regarding the toggle one way and just on and keep state on the other switch so that the binary sensor behaves like I want?

Good lord, you looking like $10 instead of $5. Don’t be so tight.

Pretty sure @tom_l has given you a link to his code.

@tom_l thanks for the code!

@nickrout regarding price I was found prices that was more like 2.3$ I was thinking that it maybe was a better way. Either way, it was just I question on how to do it cheep and same way good. As I said I’m new to this area regarding the whole ESP

You really need to take heed of suggestions to check coverage at your mailbox (WiFi) because my experience is it’s not that impressive. There’s no way I could get a signal from my mailbox and it’s pretty close to my house.

Yes if it is out of wifi range, you should look at lora solutions.

Ok, can I use my phone for WiFi measure? Is that equal in WiFi straight?

Well it is a good start, but try a simple esphome config and that will be a better test.

1 Like

I’m getting about -74dBm 50m away from a Unifii Lite AP. Which is ok. I plan on doing this in the next few days to see what sort of improvement it makes:

Hoping for at least 3dB improvement, not just from the antenna gain, but from better antenna placement as well.

Thanks! I will look in to this!

Regarding the ESP32 it seems hard to get I Europe compared to the wemos d1 if you don’t want to wait a month for arrival, any tips on sites? I have googled, eBay, some Swedish sites as well.

I’ve only ever bought from China.

Yeah China… what about Amazon Marketplace as well? Can’t be that hard.
I’d just flash the device and put it out where it’s going to ‘live’ and see if it gets any signal… then you will know and not be guessing. Even if your phone works, the esp may or may not work… it’s a 5 minute test.

Assuming WiFi signal is fine at mailbox, you can change your wiring to not need deep sleep. Wire both switches in parallel NC so when the doors are closed, the switches are open. Feed the ESP unit power through these switches. If either door is open, the ESP gets power. If both doors are closed, no power. Then write your ESP program so that it sends a “door open” message at startup then sleeps forever. No GPIO necessary.