This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automate GRIB Downloads
#5
(2018-02-08, 01:02 PM)st599 Wrote: Many Thanks

Looking a Git, one additional request I have would be as well as:

Hourly
Daily

Would it be possible to have:

"When an IP Connection occurs"

We'd be using Marina WiFi, which would not be available all the time.

(2018-02-06, 03:15 PM)PaddyB Wrote: Hi Simon, you can do that with node-red sending an automated email to saildocs. I have it set up to save the grib (GFS) to dropbox so opencpn always has the latest grib when it is run. I'll post the node-red flow at some point if anyone is interested.

I'd be interested to see it.  I've never used NodeRED, but am interested in having a play with it.

Could be useful for automating some things on the boat.

Node-red is just wonderful :Cool

Try this , go to https://fred.sensetecnic.com/ and make an account. Then copy the code below and press control I to insert, paste the code in. Then you'll need to dig in and fill in email passwords and dropbox stuff then it will send you a grib 4 times a day. Really handy 

Code:
[
   {
       "id": "17d3d13f.30215f",
       "type": "e-mail",
       "z": "c676bef7.1661e",
       "server": "smtp.gmail.com",
       "port": "465",
       "secure": true,
       "name": "",
       "dname": "send email",
       "x": 490,
       "y": 60,
       "wires": []
   },
   {
       "id": "5802db4f.e61384",
       "type": "e-mail in",
       "z": "c676bef7.1661e",
       "name": "get email",
       "protocol": "IMAP",
       "server": "imap.gmail.com",
       "useSSL": true,
       "port": "993",
       "box": "INBOX",
       "disposition": "Read",
       "repeat": "60",
       "x": 60,
       "y": 120,
       "wires": [
           [
               "711358ba.286ca8"
           ]
       ]
   },
   {
       "id": "bb666145.e08df",
       "type": "dropbox out",
       "z": "c676bef7.1661e",
       "dropbox": "",
       "filename": "",
       "localFilename": "",
       "name": "upload",
       "x": 450,
       "y": 180,
       "wires": []
   },
   {
       "id": "2b8cc36a.a0d37c",
       "type": "inject",
       "z": "c676bef7.1661e",
       "name": "",
       "topic": "saildocs",
       "payload": "send GFS:38N,25N,19W,1W|1.0,1.0|0,6,12|WIND,PRESS,APCP,TCDC,GUST",
       "payloadType": "str",
       "repeat": "21600",
       "crontab": "",
       "once": false,
       "x": 110,
       "y": 60,
       "wires": [
           [
               "f7c7a174.2cf3d"
           ]
       ]
   },
   {
       "id": "9519e8a0.2e7418",
       "type": "change",
       "z": "c676bef7.1661e",
       "name": "",
       "rules": [
           {
               "t": "set",
               "p": "payload",
               "pt": "msg",
               "to": "attachments.content",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 360,
       "y": 120,
       "wires": [
           [
               "8d39fd28.bfb1a"
           ]
       ]
   },
   {
       "id": "f7c7a174.2cf3d",
       "type": "function",
       "z": "c676bef7.1661e",
       "name": "Create message ",
       "func": "msg.payload = \"send GFS:60N,21N,38W,6E|0.5,0.5|0,3,6..168|WIND,PRESS,APCP,TCDC,HTSGW,WVPER,WVDIR,GUST\";\nmsg.to='query@saildocs.com';\nmsg.from=\"minetologon@gmail.com\"; //needed to set return-path in the header, otherwise that filed is ampty and saildocs will ignore the email\n\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 310,
       "y": 60,
       "wires": [
           [
               "17d3d13f.30215f"
           ]
       ]
   },
   {
       "id": "711358ba.286ca8",
       "type": "switch",
       "z": "c676bef7.1661e",
       "name": "Filter",
       "property": "from",
       "propertyType": "msg",
       "rules": [
           {
               "t": "eq",
               "v": "query-reply@saildocs.com",
               "vt": "str"
           }
       ],
       "checkall": "true",
       "outputs": 1,
       "x": 210,
       "y": 120,
       "wires": [
           [
               "9519e8a0.2e7418"
           ]
       ]
   },
   {
       "id": "8d39fd28.bfb1a",
       "type": "function",
       "z": "c676bef7.1661e",
       "name": "Add date to filename",
       "func": "var today = new Date();\n\ntoday.setDate(today.getDate() + 1);\n\nvar hour = today.getHours();\nvar day = today.getDate();\nvar month = today.getMonth()+1;\nvar year = today.getFullYear();\nvar folderdate = year +\"-\" + month;\n\n//node.warn(\"folderdate=\" + folderdate);\n//\nvar filedate= hour + '--' + day +'-' + month + '-' + year;\nnode.warn(\"filedate=\" + filedate);\n\n\nmsg.filename=\"Gribs/\" + folderdate +'/'+ filedate + \".grb\";\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 180,
       "y": 180,
       "wires": [
           [
               "bb666145.e08df"
           ]
       ]
   },
   {
       "id": "8790ba4.9b42048",
       "type": "comment",
       "z": "c676bef7.1661e",
       "name": "Downloads & saves gribs to dropbox",
       "info": "",
       "x": 180,
       "y": 20,
       "wires": []
   }
]
Reply


Messages In This Thread
Automate GRIB Downloads - by st599 - 2018-02-06, 11:37 AM
RE: Automate GRIB Downloads - by PaddyB - 2018-02-06, 03:15 PM
RE: Automate GRIB Downloads - by Sailoog - 2018-02-06, 09:16 PM
RE: Automate GRIB Downloads - by st599 - 2018-02-08, 01:02 PM
RE: Automate GRIB Downloads - by PaddyB - 2018-02-08, 01:32 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)