ESP-NOW with ESP-HOME

That’s indeed a technical requirment if you want one esp to be connected to a WPAx and working as the same time as ESP-NOW gateway.

But as you wrote one can just make use of a esp32 board with ethernet to have esp-now on whatever channel. I had like the opposite mileage like you btw. and is was super easy (typical esphome magic) to get ethernet working on my esp’s.

I’m no network specialist but have to communicate a lot with them. They never make use of “smart channel” (I think one vendor calls it that way) but always fix the channel manually. There are various reasons for it but one is probably that auto channeling mostly doesn’t work the user think it does and in reality it often degrades the reliability of a network. Often the sensing for other devices is only scheduled hourly (or even less) on the AP and can cause to hog on dense channels just because a mobile hotspot was on for a short time.

I would expect the author want’s to make use of batteries (maybe paired with solar) for the slave devices. In this case using WPAx is not recommended but ESP-Now is a valid way to minimize power consumption.

I did not have that many issues with getting my ethernet port to work, but it is hard to make a general guide for others to follow, becaus there is no standard ethernet port.

And auto channel works pretty good on most APs. It should only be the cheap ones that rely on only visible said. The decent and good ones look at signal to noise ratio on the different channels.
Where people fail is to use auto channels for multiple APs. 2 might go, but with 3 it can become a cyclic loop where one AP move to another As channel forcing that second AP to move to a third APs channel and third third AP then move to the first APs channel and so on.
With 2 and 3 APs manual setting the channels is better.
With more than 3 APs only automatic WiFi controllers are really capable of it.
WiFi controllers are able to know each APs channel and also there neighbors and their channel and signal strengths.
Adjusting more than 3 APs means adjusting the signal strength too.

The issue with having WiFi and ESP-Now on the same channel is that the battery powered devices is forced to listen to WiFi communication too.
ESP-Now is just a WiFi lite protocol.

The only thing I care about is: Does it work with esphome? And that hardware is what I buy.

In case of esp32 boards with ethernet it is simple as opening:

and choose a board from the configuration examples. In ended up with some Wireless Tag WT32-ETH01 boards which were around $10 and work just a treat.

image

This issue is actually more a theoretical one. Having a battery powered device awake for 1 second and in deep sleep (radio off) for like 3600 seconds (1 hour) it is probably negligible in terms of power draw. Beside if you are in a dense environment you might be able to influence the channels used by your own wpa-wifi access points but as air is a shared medium you need to accept other participants ether way :man_shrugging:

Hey, sorry for not saying anything I’ve been too busy lately, thanks for all the replys I’ve been reeading them and gonna try them to my project, I just had one question:

How do I implement this? The board with the ethernet port runs esphome and the others just the code for arduino with espnow? Sorry if this sounds kinda dumb but I’m new in this world of Home assistant and esphome.
Thanks !!

No, the board have an auxiliary ethernet port similar to this one: ENC28J60 Ethernet LAN Network Module – QuartzComponents

The module runs mqtt.

Not sure if you got an answer but, assuming your question is how do you tie espnow to wifi to home assistant, then using two ESP32s (or similar) is a pretty reliable option.

The cleanest and shortest-explanation (!) I’ve seen is over here: Super Simple ESPNow to Wi-Fi / MQTT Gateway & Why I Use Two ESP8266s - YouTube

This just needs 4 wires (RX, TX, GND and Power) to be linked between the two boards. One is free to be your espnow receiver and the other is free to wander all over the wifi and deliver espnow messages to home assistant via MQTT.

1 Like

Latest and greatest work comes from @afarago and is available via custom component for esphome compatible with esp82xx and esp32 :point_down:

1 Like

I made a small sketch that can act like a ESP NOW to MQTT Gateway. I made it for my WLED but its open enough for you to add anything.

1 Like

Hi, could I still use this to control other esphome flashed lights (not using wled)?

Are they on ESPNOW? If yes then you can send a MQTT Message to this and it will broadcast on ESPNOW. May need to tweak a little. If you send me link to the code you used for esphome flashlight then I can add it in.

Should be similar to this

Is there a custom component for espnow I need to add?

I don’t have a wizmote, but I’d like to use it with esphome switches so the button could send mqtt command to the lights via espnow.

Looks like it should directly talk to HA and not ESPNOW. Unless I know what exact message is needed to be sent via ESPNOW it would be difficult for me to add. Currently it broadcasts whatever it gets via MQTT. But ofcourse I need to tweak it to work better.

Is it possible to activate esp long range mode also ?

Stupid question, but wouldn’t it be possible to connect the “Host” ESP with usb to HA?

What I was thinking is to have 2 esp devices.

esp-now slave → esp-now gateway → serial/modbus → esp with ha

Its a shame that you would need a extra esp device but part of the game i guess :slight_smile:

If you choose an ESP device with UART on the USB port, then it is probably possible.

what is that?

ESP-Now can actually run with just one ESP device as a hub, but it puts some limitations on the setup.
If only one device is used, then ESP-Now and WiFi is required to use the same frequency and since the frequency is hardcoded in the ESP_Now code, then it means you WiFi also needs to use a fixed frequency.
Sharing WiFi and ESP-Now on the same frequency might also be problematic, since a high load on the WiFi would then interfere with the ESP-Now.

A better way might be an ESP device with an ethernet board and then it can be MQTT, serial over TCP, webhooks or whatever to connect to HA.

Seems like esp-now is more limited than I thought it would be. Perhaps I should look at a different solution. Bit of a bummer though but it is what it is.

It is not ESP-Now that is limited, but the hardware.
With just one ESP chip you have only one radio.
People link two ESP chips together to get around that limitation, so one chip can run the ESP-Now on one frequency and the WiFi can run on another frequency.

Hi sorry, got sidetracked
Do you have an example how I can include espnow in esphome config?