OpenSprinkler Forums Comments, Suggestions, Requests External Access without DynDNS

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #39189

    Andreas
    Participant

    Unfortunately my internet-router doesn’t support DynDNS or similar services. It would be perfect if the OpenSprinkler firmware would give the option to regularly determine the current external ip-adress and (if changed) write it to a specific file e.g. on Google Drive or even better directly into the opensprinkler-account at opensprinkler.com. The Android-App could then retrieve the ip-Adress from this file or server and connect directly to the OpenSprinkler without using DynDNS-Service.

    #39203

    Wokkeltje
    Participant

    If you have the OS running on Raspberry, I have a script that sends an email if the IP is changed.
    Credits: https://www.youtube.com/watch?v=P_hpXQ8VgPI

    Files attached that you can schedudule every x hours using cron.

    Of course it would be nice if this was build in in the OS firmware and written in the OS-account. +1 for this

    #39205

    Andreas
    Participant

    Thanks for the interesting post. Unfortunately i do not have an SprinklerPi but the all-in-one OpenSprinkler-Solution. That’s the reason why i can’t run any scripts within the OpenSprinkler. 🙁

    #39237

    Ray
    Keymaster

    I am curious how often your external IP changes? Assuming your router is powered on and connected most of the time, the IP should remain the largely the same. The IP change typically only happens when your router or modem restarts.

    #39252

    Andreas
    Participant

    In Germany the common internet-providers cut your DSL-Connection every 24 hours and after reconnection you usually geht a new ip-adress. Even the cable-providers change your IP 2-3 times a week.

    #39278

    Ray
    Keymaster

    I think if the OpenSprinkler device can detect external IP address then it should be able to send a notification somewhere once the external IP changes. However, to be honest I don’t know how it can detect external IP change.

    #39299

    Wokkeltje
    Participant

    Here is the part of the script I mentioned earlier

    # Setup where we will get our IP address
    url = 'http://checkip.dyndns.org'
    print ("IP address service: ", url)
    
    # Open up the url, then read the contents, and take away the IP address
    request = urlopen(url).read().decode('utf-8')
    # We extract the IP address only
    ourIP = re.findall("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}", request)
    ourIP = str(ourIP)
    ourIP = ourIP[2:len(ourIP)-2]
    print ("Current IP: ", ourIP)
    

    Complete script see YouTube link above

    #39306

    Pat
    Participant

    @Andreas, Since you don’t have a Raspberry Pi, I put together a script which could help you out.

    You didn’t specify if you were on Windows or Mac or Linux, so I put together a PowerShell script that’ll run on Windows.

    You will need to run it using Scheduled Tasks. Run it once a day (or twice a day, whatever you want). It will check your external IP address and log it to c:\ip.txt. When the script runs again, it’ll compare your external IP to the saved text file IP. If they do not match, then your IP has changed.

    If it detects that your IP changed, it’ll send you an email.

    Requirements:
    1. Windows
    2. A GMail account to send the email from. Unless you have your own SMTP server, then that can be used instead.

    Simply copy and paste the script to your computer and run it with PowerShell (e.g. from command line or Scheduled Task: powershell.exe & “c:\Check_External_IP.ps1”).

    Here’s a link to the script: https://gist.github.com/drsprite/6b172d1698b42edcef5c

    Hope this helps!

    #39327

    Andreas
    Participant

    Thanks Pat for your script. Since i don’t leave my pc running all day the script would not run regularly. Especially when i’m on vacation i would like to Access my OpenSpinkler externally without a pc running at home. Since the OpenSprinkler is always running and has the capability to execute scripts i would prefere a solution that runs directly on it.


    @Ray
    : Maybe the script posted by Wokkeltje can be integrated into the code of OpenSprinkler. It does exactly what we need and would make your excellent piece of work even a bit better 🙂

    #39332

    Wokkeltje
    Participant

    To be clear, the script isn’t mine, I just found it on the Internet.

    Credits go to the person who posted the YouTube video.

    #39350

    Ray
    Keymaster

    @Andreas: probably the easiest way is to set up a RPi to run the script and monitor the external IP change. The cheapest RPi (the A+ version) is only $20 US dollars, and you can power it via USB so it’s very power efficient.

    #39354

    Andreas
    Participant

    As i just found out (by reading the OS Manual) you have already built in a function to determine the external ip. When holding B2 and pressing B1 the display shows the correct external ip. So i think it would be easy just to write the gathered value to a specific folder e.g. on a google-Drive or as i mentioned before directly into the OS-Account on opensprinkler.com. It would even be not necessesary to check, wheter this value changes but you could write it every ten minutes or so.

    #39397

    Ray
    Keymaster

    You are right: at Samer’s reminder I realized that the firmware is already getting external IP and that can be written to somewhere accessible. It’s not trivial to write to Google Drive because that requires authentication which is easy to do on OSPi but not so easy on Arduino. We will think about what’s the best way to proceed with it.

    #39447

    Ray
    Keymaster

    A quick update: today I found a simple way to post status changes or notifications using Arduino. It’s by using a service called pushingbox:
    https://www.pushingbox.com/
    basically it allows you to use a unique device id and a simple GET (or POST) command to post status changes, and it can be hooked up with email notification, or posting the data to Google Forms. More specifically, when external IP (eip) changes, the firmware can send a GET request such as:
    http://api.pushingbox.com/pushingbox?devid=xxxxx&eip=12345
    where devid is the unique device ID (created by pushingbox). You can set it up such that it can either send the new eip to your through email, or post it to a Google form. This is pretty nice because it delegates authentication (required by Google forms) to pushingbox, and you can associated multiple services with the same request (e.g. send email notification as well as posting the data to Google form).

    Because GET request is already supported in the firmware (this is how it performs weather query), it would be fairly easy to add support for it. In fact this way the firmware can also easily send notifications about zone status changes and so on.

    #39965

    David
    Participant

    Nice idea,
    You can also integrate this small post and get service in the OpenSprinkler cloud. It looks like a small php script with a small database (“cloudID”,ip).

    #41510

    Andreas
    Participant

    @David: This is exactly the solution i would prefer 🙂

Viewing 16 posts - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Comments, Suggestions, Requests External Access without DynDNS