State update not happening when App not "running"

I have a weird situation. My wife and I both have iPhone 11’s running iOS 17.2.1 and the latest iOS HA app.
I have an automation that turns off our bedside lights when the phone’s battery switches to ‘Charging’ after 10pm.
In the last 2 weeks (maybe 3?) my wife’s phone does not update HA when the App isn’t running. Prior to the last 2 (or 3) weeks everything worked perfectly.
My phone doesn’t experience this issue. The battery state is updated whether the App is open or not.
I’ve verified that the Home Assistant App settings are the same on both phones.

So an update on this. It turns out that the Battery state isn’t changing. The Battery state remains at ‘Not Charging’ until magically a few hours later it changes to ‘Full’.

This is History graph for my wife’s phone from later yesterday morning until earlier this morning (not quite 24 hours). The phone was plugged in and the phone was indeed charging.

I was able to sort this out.

Somehow the external address in the companion app got replaced by the internal IP, and the Internal address field was blanked.
It is interesting that everything worked as it should when the App was open, but somethings that needed background refresh didn’t work when the App was closed.

So I have this problem popping up again.
This time it is with my new phone. Work replaced my original iPhone 11 was replaced with a new iPhone 11 due to a failing battery.
I added the phone to HA, same user but with a new phone name in the HA App.

Now I am experiencing the same issue that I had a while back with my wife’s iPhone 11. The sensors are not updating if the app is closed. When the App is open the sensors are updated.
The real kicker is that my wife’s new iPhone 15 doesn’t have this issue. Her new phone was added to her existing user and also uses a new name for the phone in the App.

I’ve resolved this issue.
In the companion app under the server settings there is a feature called ‘Local Push’.
In the Status section the Local Push reported as disabled.

The switch to turn Local Push on and off is located under Internal URL. It turns out that even though Local Push was turned on in the Internal URL section it was on.
I had to turn Local Push off and then back on to actually get Local Push to show Available(0) in the Status section.
I turned Local Push off, closed and relaunched the App, turned it back on, closed and relaunched the app. Once Local Push showed Available the background updates of the sensors started working.

**Update: It appears iOS updates reset the Local Push setting to ‘off’