If you have both in the same automation it won’t work as you can have only one condition block. If you tried each of them separately and it didn’t work, then there is an issue.
Sorry I missed typed
it should read " I tried the 2nd one first and couldn’t get it to work, so I change it to have the device_tracker 1st and this works"
It makes no difference to homeassistant which order the conditions are in, they’re just items in a list. If it wasn’t working you had a syntax error of some kind, most likely indentation (as 2 spaces back would take it out of the ‘OR’ list and put it in the default ‘AND’ list).
Copy my automation 1:1 and test it again, it’s impossible that it works one way but not the other,as Marc said, Home Assistant doesn’t care in which order the conditions are, as long as they are on the same indentation level.