esp32 wifi server or client

hello,
i'm planning on using the esp32 to control my aquarium air pump, light, etc... using my phone.
i do have wifi at home, and it's mostly on, but it's not on 24/7.
so my question is, should i setup the esp32 as wifi server or client?
or in case the home wifi is available the esp32 should behave as a client, and if the home wifi is not available then the esp32 should behave as wifi server?

Something seems to be missing from your description. (I am looking for the punchline). If you have no WiFi, how do you plan to connect the ESP to the Internet? Do you have no WiFi or no Internet?

ESP as server would cover both situation.

If you have WiFi, the ESP and your phone can connect to your home WiFi. You can then access the ESP server via its IP address

If you don't have WiFi, you can setup the ESP as an access point, and you can connect your phone to it directly.

I think, the OP's problem is that they want the mode to change dynamically, i.e. client when there is an access point, access point when there isn't any. That may be very awkward to implement.

The simplest solution is to permanently configure it as an access point.

@aarg, that's exactly what i meant.
I guess i will follow your "sugestion", and set it up only as a client. At least until i get to know it and understand it better.
Thanks to all.

aarg:
The simplest solution is to permanently configure it as an access point.

True.

aarg:
I think, the OP's problem is that they want the mode to change dynamically, i.e. client when there is an access point, access point when there isn't any. That may be very awkward to implement.

Took me several months of digging through sketches and experimenting to do this for an ESP8266.
WiFi.setAutoConnect(false); and WiFi.setAutoReconnect(false); // might help,
to stop the ESP from constantly trying to reconnect to the router while you're using it's AP.
Then you must periodically try to re-connect in loop() when idle.
Leo..

Thanks @Wawa, this is a great hint.
This is what i was looking for.