Using ESPHome device to control other Wifi devices independently from HA

I am planning a device that is to replace my pool controller and was thinking of using an ESP32 running ESPHome connected to my Home Assistant. However I would like the device (lets call it Controller) to also control some Wifi Relays (Power Outlets).

I have no issues with setting up the Controller using ESPHome and integrate with HA, however I don’t yet know the best way to have it also control two separate Wifi relays?
I figure that if the Wifi Relays are running ESPHome then they can be on the same Wifi network and be controlled via HA however if the Wifi goes down, I still want the Controller to control the Wifi Relays.

If the Controller has an Access Point added and the Wifi Relays have both normal Wifi and AP Wifi credentials added, then can they still communicate if the Controller switches to AP mode?
Will the Controller still operate all its other components in AP mode?
Is using a UDP component a reasonable option for the Wifi Relays to communicate with the Controller?
If I want to use MQTT then I also need a MQTT broker somewhere - can I do that as a component on the Controller? (I couldn’t see any components for this)
Can I setup a API service on the Controller so the Wifi Relays connect to the Controller instead of HA?

Any advice?

I went a different route and set up a UPS to make sure HA, network, Wi-Fi, server and CCTV and power to all nodes was never down. We have quite a lot of brown outs. So far three years in and no down time.

UDP Component — ESPHome
Edit just noticed you knew about this and the idea was without router.
Not sure that will work

In theory you could have the relays connect to the AP of the controller. But then how is the commands going to be sent?
And then the controller won’t be able to be on HA network.

Perhaps if the relays have the controller AP as secondary wifi.
But it will still be issues with sending the commands I believe.

If they haven’t got the ethernets maybe Wifi is a choice? :+1:

Yes. :white_check_mark:

No, esphome nodes only host the API server and no API client. :x:

If you are afraid of the Wifi’s you could also try ESPNow :signal_strength:

Depends what you have. My esphome devices control stock Shelly relays in local network without HA or internet. Without flashing Shellys anyhow, just using http api.

IMHO if You able to maintain power for couple of devices - just add WiFi AP to this list and assure ESPHome devices have stable and uninterruptable WiFi network.
Then UDP component is a good chocice to commuinicate inbetween ESPHome device.
IMHO

Web server component and http client will work well between independent ESP devices. Problem is that, if the router kicks the bukkit, that will not work.

Perhaps you can use BTHome instead. That doesnt require an access point going.

Wait there IS an ESPNow component. This will work without tne router up. ripnetuk-root / ripnetuk-public / esphome / ripnetuk-esphome-easynow · GitLab

But note that ESPHome devices by default will reboot every 15 minutes if they can’t connect to an AP.

OK, Thanks for the suggestions and advice. I think that maybe I go back to my first design and use GPIO pins to drive actual relays. That way its less complicated and will work but just need a sparky to wire up the power outlets.
I will also have a look at the ESPNow and BTHome. Maybe I can also just try it first with a few devices in a trial setup.

1 Like

Relays are more relayable indeed.

There’s also another espnow component discussed here

Do tell if you manage to get it working cause I want to do the same thing.