Has anyone been able to switch between local and remote access?

Ok, let’s make a few assumptions:

  1. My devices are all custom written plugins
  2. None of them are cloud based
  3. I have a static IP from my ISP and have successfully set up port forwarding

I want to be able to open Home Remote and for it to work whether I’m home or away. Has anyone done this? Is it possible?

Somebody has already but I don’t recall if an example has been posted to the forum here. Basically what they did was in “onConnect” try to connect locally but supply a timeout. Wrap that local connect call in a try-catch. In the catch, where it failed, connect using the cloud address.

1 Like

Great idea. I didn’t know if we could programatically mess with one of the plugin.settings values (aka ip address). I’ll give that a try, thanks!

You won’t change the setting on the fly. Typically, from what other users have done, is create 2 settings: LocalIP & RemoteIP. They will use the LocalIP for the 1st attempt, & then RemoteIP for the 2nd attempt.

1 Like

I did something like this for camera access - either local or port forward ip. I polled the IP address from a ip tracking web address and used this data for the remaining plugin.

@john_wallace do you happen to have the code to share? No big deal if not, I can create it. It would just take my time from an hour down to about 5 min!

ipcheck.txt (905 Bytes)

Hi Greg,

Ive attached my simple code - as you will see a device opject is set to either “internal” or “external” depending on whether the first 2 digits of the ip is 90. You can adjust to suit or change the method easy enough. My original plan was to have 2 handsets, one for when im home and one cut down version for when im out - but i never finished the latter.

John

1 Like

Thank you sir! This is perfect. Yes, I had the same idea for two versions - a full one and a simple one. I wish we were able to run two instances of the app.