Hey Shareef Yousef,
Thanks for using Apple Support Communities. We understand you're needing help with HomeKit. We'd be happy to assist.
While there's a variety of reasons you could be getting this error, we'll try to help you isolate things a bit further. To start, you've already mentioned that you're connected to your home Wi-Fi network without issues, however also ensure that you have Bluetooth enabled.
Next, you'll also want to ensure you're signed into your iCloud account. This is very simple, just go to Settings and ensure you're name is showing at the top of the page. Also, make sure you're running the latest version of iOS or macOS, as well as on your HomeKit hub, like the Apple TV or HomePod.
Now that that is all out of the way, since you're able to connect and control your HomeKit devices from the device-specific app, you are correct that the issue lies with HomeKit. If your accessory is available in another app, you can check for firmware updates that may address the problem.
Are you only having this issue while you're at home or while you're away from your home? If happening while away from home, you may need a HomeKit hub. HomeKit hubs bridge the gap between the accessory and the internet, allowing you to access your gear while out and about while also letting you create automations.
There are currently three types of HomeKit hubs that are available: the Apple TV (4th generation or later), HomePod, and iPad (running the latest version of iOS). If you already have a hub, check its status in the Home app to ensure it says it's connected.
Afterward, please reboot your HomeKit hub, iOS device, and even the accessory itself, as this is one of the best and quickest ways to get unresponsive devices working again.
If all else fails, you may need to reset your HomeKit accessories and set them back up again altogether. For help with getting things set back up again afterward, check out: Add a HomeKit accessory to the Home app
We hope this information helps out! If you continue to have issues afterward with any particular device, you may also want to work with the manufacturer of it for further support.
Take care!