They only need to agree on whether it's a heating period or a cooling period. I know many buildings are different, but there's a sizeable number of them in my city providing some form of central heating. I do live in a very dense city, where I bet most people don't know their neighbors.
The building management and HOA usually set up a fixed scheme, such as "heating is on from start_date to end_date. These dates tend to make sense according to the usual local climate. If I'm not mistaken, in my building it's something like late October to early May.
Of course, when the actual temperature is outside expected ranges around those dates, it's not optimal. Luckily, it's never more than a few days.
The same approach could be applied for providing cooling.