I think it depends on the system used, protocol, and device support.
Mine was relatively easy, but I'm using several commercial products and integrating Z-Wave, Insteon, HomeKit, Davis Weather Station with plug-ins (typically FOSS) and for the most part it has just worked. Only Nanoleaf has given me issues (well, Siri <-> Apple Home has issues on HomePods intermittently for no apparent reason). Z-wave is far, far more reliable than Insteon, which is why I'm moving in that direction and Insteon command modules have to be directly on power and thus power issues cause reliability issues.
FOSS has several advantages - mainly you have more troubleshooting ability, more flexibility and you will never be locked out of your devices. I'm not going to say cost, because it typically costs more in time. My HA system started in 1997! and has just evolved over time.