With sales in the neighborhood of 15M units and revenue of $4.5 billion dollars? LOL, that is a massive success by any measure. Sonos, as a reminder, does the same $1.5 billion in sales per year as HomePod and that's with dozens of different products, installations, accessories, etc. Do not forgeet the impact to Apple Music, the biggest streaming music entity in the United States, which overtook Spotify during the HomePod's first two years.
Thousands of companies axe successful products. And success in consumer acceptance and sales is allowed to be different than success on a P&L if it is a new product that enters a new market. Apple dropped the most successful music player in history, the iPod Mini, because they developed a superior product to advance its market position, not because it made more money than its predecessor. Macintosh ran in the red for its first several years. The first few years of mobile phones in the US, all the phones were money losers, the carriers were giving them away to entice subscription models- similar to HomePod and its relationship with Apple Music.
The HomePod is eventually going to be replaced with a new premium version. In the meantime, the Mini can add millions of new Apple Music subscribers and help grow Apple's smart home business. Remember, a $300 audiophile mono streaming speaker isn't for everyone. I'd argue that anyone who wanted a HomePod already has one and Apple knows this. They will figure out a way to build something similar for $199 and HomePod Pro will no longer be as much of a niche.