Convert battery powered light

I have a light (appears to be an LED strip of sorts but it’s appears like a continuous strip rather than individual LEDS).

It’s powered by 3 AAA batteries (1.5v) and the battery is connected to a basic on/off switch which is connected to the LED strip.

I’m wanting to convert this to be Wi-Fi enabled and bring it into HA, it doesn’t need to be battery powered and I’m ok with using a usb to power it. I also don’t need to make use of the physical switch.

I assume I need a 5v output from an esp or nodemcu but I’m not sure on the wiring setup needed to take a battery powered light and incorporate an esp module.

You can probably drive the LED strip with 5 volts also.
There is usually 1.6 or 1.65 volts in AAA batteries so thats 4.8 or 4.95.
But make sure that is true first with a multimeter.

I suggest either a relay, a relay board or a opto coupler.
Relay boards are easy to find, you can get a ESP01 board very cheap and it’s pretty much all ready wired for you.

The battery pack says AAA 1.5v so with 3 of them I guess it requires 4.5v. I have used esp32 devices with a nodemcu board so it’s powered by usb. Not sure if I can use them again for this?

Sure you can use ESP32.
But then you need to wire the relay or whatever option you choose yourself

Thanks for your input. I have purchased a standard 5v relay and wired up the relay to the esp32 dev board I had spare.

Got my light working on/off with home assistant. Lot of wires though so maybe an esp01 relay would be better. Just need to understand the power situation with that board.

Question, with this setup is there anyway within Esphome to dim the LEDs by adjusting the power?

When it was on battery the LEDs would dim once the batteries started to drain.

You could use the PWM signal to control it.
But your kind of building a LED driver, so why not just get a LED driver?
This for example integrated well in HA Pre-Assembled QuinLED-Dig-Uno -

So as I dissembled the light I got a glimpse of the led strip. It just has a + and - inputs. No data so I assumed WLED wouldn’t work.

I’ll look into PWM but not sure how to target it as currently the GPIO pin is connected to the data in on the relay.

So I tried the monochromatic light within Esphome but putting the pwm on the signal to the relay didn’t work.

Would I need and mossfet board to allow pwm to control the brightness?

Yes a relay is way too slow.
I’m not sure what components is needed but probably a mosfet or transistor

So I have put the positive to 3.3v rather than 5v and it’s now dimmer so that’s actually achieved what I want as this is a nightlight. Will look further into dimmers though.

You can’t drive the LEDs with a pin, it will destroy the ESP.
The pins can only deliver a few mAh.

All LED driver regulate the brightness with PWM on the + or - connection.
Dig-uno is compatible (unless your LED strip is very unusual)