Trouble with Tuya light flashed to ESPhome

I have several of these Tuya based lights that I have flashed to ESPhome use Libretiny. I am having a heck of time getting them to connect in HA.

With the lights turned on they show up as connected in my Unifi console

In the ESPhome dashboard it shows “Online”
ESPhome console

But in the HA dashboard it shows Unavailable

If I try to view the ESPhome logs via wireless connection I get this:

INFO ESPHome 2024.2.1
INFO Reading configuration /config/esphome/basement-bar-shelf-light-7.yaml...
INFO Starting log output from basement-bar-shelf-light-7.local using esphome API
WARNING Can't connect to ESPHome API for basement-bar-shelf-light-7.local: Error resolving IP address: [Errno -5] No address associated with hostname (APIConnectionError)

If I try to ping the light’s IP address I get “Destination Host Unreachable”.

I’ve been pulling my hair out for months trying to get these lights to be more reliable. I have 8 total and some of them work all the time while others only work some of the time. Anyone have any pointers?

It seems like this must be a WiFi connection issue. I have a Unifi WiFi system in my house. If I login to my Unifi dashboard and click “Reconnect” on the Tuya/ESPhome devices that are showing unavailable in HA they become connected within 10 seconds.

I have what I think is the correct WiFi settings in ESPhome

wifi:
  ssid: "Phillips_IoT"
  password: "XXXXXXX"
  use_address: 192.168.1.29
  #Static IP
  manual_ip:
    static_ip: 192.168.1.29
    gateway: 192.168.1.1
    subnet: 255.255.255.0

Anything else that might cause this?