My Device_Tracker Group shows intermittently incorrect Home/Away states - Unifi vs Mobile App

Hi,
For the last 6 months (maybe longer) my Group for determining if an Adult is home, has been unreliable.
I’ve been using HA for 2.5yrs. I’m not a programmer but comfortable. Running HA 2022.11.3 on Odroid.

My iphone seems to be the unreliable device. I’m using the Unifi Network integration to determine who is home (default 300secs off wifi until considered away)
I also have the IOS HA mobile app ios with location tracking on my phone.
Other adults are located only via Unifi presence.

The device_tracker group is defined in configuration.yaml

group:
  adults_home_grp:
    name: Adults Home Group
    entities:
      - device_tracker.gtxxx.4
      - device_tracker.ah_xxx
      - device_tracker.alixxx

HA-tracking-Device

The images illustrate my phone GTxxx.4 has at times a home (lower h) state and a Home (upper H) state.They appear as different colours in the History timeline and appear to affect the group status.
The Orange highlighted “home” states in the images, have the Group registering Home correctly.
The Blue highlighted “Home” states in the images, trigger an Away state REGARDLESS of the state of other devices in the group.
If I force the state of my device to “home” in Dev Tools - States, the group works correctly.
The Group logic fails with “Home” misspelled (ie. Even if another Adult is home, the group will have an Away state).

I’m assuming the location tracking of Unifi is clashing with the HA mobile app location?
Unifi Network triggers “home” away events for other users. So is the HA app tracking causing the issue of “Home” states?
I would have assumed the Mobile App always wins, but there are times when Unifi reports my state correctly. As the images illustrate.
Other forum users have reported unreliable tracking groups, without any clear cause. Group home / not_home behaviour
Is this a bug or expected behaviour for some edge case?
Hoping someone can point me in the right direction please, or if I’m doing it all wrong I’m happy for constructive criticism.

So in case someone else stumbles across this thread with the same issue, which I guess is unlikely given the last 6 months of tumble weeds, ha!

Just wanted to update with what I did to fix it.
Ended up calling a simple python script when my state changed, thanks to @pnbruckner Trying to set state of button to off - #28 by xspudx (the Sept’18 one was enough for me) which allowed me to force a respelling of the data attribute of my device entity from ‘Home’ to ‘home’ whenever my location state is in uppercase.

Seems like a crazy overkill workaround, but it’s working and gets the job done.
I did this in Node Red as I’m more familiar with complex automations there, than the newer overhauled automation area which is great and I do now use more, but for simpler things.
My fix does seems to add a fair bit of entity history noise as my state regularly switches (20-40/day) to Home and is then corrected to home instead of just staying put. But more importantly to me it means my ‘person group’ functions correctly in other automations…hooray!

So, obviously you shouldn’t have to force a value in the State Machine from “Home” to “home” to make things work correctly.

What entity is changing to “Home”? What integration creates this entity? Is there something that’s causing it to be “Home” instead of “home”?

For device tracker entities, “home” (all lowercase) is the correct state value to indicate the device is in the location defined by HA’s home location configuration. If something is changing one of these entities to “Home”, then that is incorrect, and should be fixed, rather than worked around (for the reasons you mention.)