As others have said: most IoT devices “phone home” using the internet. Your phone connects to a server on the internet which then communicates with the IoT device. That’s why it keeps working even when you are not home.
For devices that only work locally you can still make it work. More advanced routers (eg running OpenWRT) can be set up to allow ‘one-way’ traffic between two VLANs. So a device on your home wifi can still connect to the IoT device but not the other way around.
As others have said: most IoT devices “phone home” using the internet. Your phone connects to a server on the internet which then communicates with the IoT device. That’s why it keeps working even when you are not home.
For devices that only work locally you can still make it work. More advanced routers (eg running OpenWRT) can be set up to allow ‘one-way’ traffic between two VLANs. So a device on your home wifi can still connect to the IoT device but not the other way around.