I think in prior rulings against the HOA's, they can't forbid you from flying a flag, butm they can tell you how to fly it as long as it doesn't violate the flag code(i.e can't fly it at night unless its lit, has to come down at dusk, what type of pole can be used, etc).
Not just HOA's, The American Legion came to dads door one day about a flag pole he erected outside and demanded him to either take the flag down at night or have it lit up. Out of the blue this came and had someone in the Legion just mentioned this dad would have complied. As it was this hostile attitude got dads Goat.
So as the next door neighbor who he had known all his life was the one instigating all this he did indeed have the flag lit up at night with the lights also going into the neighbors bedroom window.
What fun a neighborhood fight between two WW2 old duffers. This got a bit out of control for a while the neighbor had my Mother served with a cease and disest for mowing her yard 3-4 inches onto his property.
Dad began to make plans for a statue of a naked Barbera Bush with just her pearls and the butt end facing his front door. I cannot imagine what the Legion meetings were for every one for a year or so.
Never know when the old folks go on a rampage, but I believe the last few years of Dads life were the most interesting for him in how to out Witt his boyhood friend.