OpenSprinkler › Forums › Comments, Suggestions, Requests › External Access without DynDNS
Tagged: External Access;without DynDNS
- This topic has 15 replies, 5 voices, and was last updated 8 years, 11 months ago by Andreas.
-
AuthorPosts
-
July 11, 2015 at 2:34 am #39189
AndreasParticipantUnfortunately 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.
July 12, 2015 at 4:21 am #39203
WokkeltjeParticipantIf 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_hpXQ8VgPIFiles 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
July 12, 2015 at 4:59 am #39205
AndreasParticipantThanks 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. 🙁
July 13, 2015 at 3:24 pm #39237
RayKeymasterI 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.
July 14, 2015 at 2:32 am #39252
AndreasParticipantIn 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.
July 15, 2015 at 2:41 pm #39278
RayKeymasterI 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.
July 16, 2015 at 1:34 am #39299
WokkeltjeParticipantHere 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
July 16, 2015 at 2:08 pm #39306
PatParticipant@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!
July 16, 2015 at 11:49 pm #39327
AndreasParticipantThanks 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 🙂July 17, 2015 at 1:26 am #39332
WokkeltjeParticipantTo be clear, the script isn’t mine, I just found it on the Internet.
Credits go to the person who posted the YouTube video.
July 17, 2015 at 7:23 pm #39350
RayKeymaster@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.
July 18, 2015 at 1:01 am #39354
AndreasParticipantAs 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.
July 21, 2015 at 9:27 pm #39397
RayKeymasterYou 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.
July 24, 2015 at 11:27 pm #39447
RayKeymasterA 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.
August 24, 2015 at 5:46 pm #39965
DavidParticipantNice 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).February 13, 2016 at 2:27 am #41510 -
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Comments, Suggestions, Requests › External Access without DynDNS