One problem is determining when you are on your local network, as opposed to someone else's local network. ie: My home subnet is 192.168.1.0/24, but when I'm at work the local subnet is also 192.168.1.0/24.
I also have a number of services I host on a server at home, and I am faced with the same situation. The way that I solve it is by having a domain name for my home external IP address, and by hosting my own DNS server on my home network.
When I am not at home, mydomainname.com resolves to my public IP address, and I connect remotely through the relevant forwarded ports. On my home DNS server, I manually add a DNS record for mydomainname.com and have it point to the local address [192.168.1.x], which overrides the public DNS record.
This means I can simply use mydomainname.com for all of my scripts/configurations, and the IP address used is determined by the DNS server, based on whether I am at home or external.
Setting up a DNS server may of course add a level of complexity to the situation beyond what you are willing to deal with [understandably]. I'd recommend looking at pfSense or some other form of router/gateway firmware which makes it a whole lot easier.
As an alternative, see if you router/gateway supports a feature called "NAT-reflection". This allows you to connect using the external IP address when on the internal network, and still get a correctly routed connection. It's less elegant, but it may be adequate for your situation.