Yes, this. Although it's not so much a trick and more managing your home network so it's like any other. Computers connected to the network should automatically detect everything they need to work normally, so no manual settings are needed.
Otherwise, as the parent poster realized, moving the device to another network will require manual changes. And then changes again when you get back.
Otherwise, as the parent poster realized, moving the device to another network will require manual changes. And then changes again when you get back.