rapid fire push to custom web server (not using FTP)?

Moderator: Mattk

Post Reply
philip
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: Sat Apr 16, 2011 2:22 am

rapid fire push to custom web server (not using FTP)?

Post by philip »

Hello,

I have a new WeatherHub2 (MeteoHub) from Ambient Weather. The software is working, but I would like to push (upload) data to my Google App Engine web app which does not support FTP. In the docs I see that I can upload data once a minute using an email address which my Google App Engine web app could process. I am interested in getting data more often though.

Is there a way to push data to my custom web server (web app) using the equivalent of "rapid fire" mode and getting the data delivered using HTTP POST / PUT or something like that for all of my sensors? The pushed data could be a template or XML; either would be fine.

Any ideas?
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7877
Joined: Mon Oct 01, 2007 10:51 pm

Re: rapid fire push to custom web server (not using FTP)?

Post by admin »

you can poll data from the Meteohub at any frequency you like using this http protocol:
http://www.meteohub.de/files/HTTP-Data- ... l-v1.2.pdf

This is not exactly what you are asking for, but might be a solution, when you can do some php or perl scripting on your google apps account.... and it will need your meteohub being reachable from the internet via dyndns or so.
philip
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: Sat Apr 16, 2011 2:22 am

Re: rapid fire push to custom web server (not using FTP)?

Post by philip »

Thank you for the quick reply.

I understand this is a pull (polling) solution, but I think I would like to push the data instead for security reasons.

Is there an easy way to set up curl on a custom cron interval, for example, to upload a custom template to a custom web app to push the data on the device?
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7877
Joined: Mon Oct 01, 2007 10:51 pm

Re: rapid fire push to custom web server (not using FTP)?

Post by admin »

when you have a look at crontab, you see that meteohtml is triggerd to fillin weather data into templates. generated result is then uploaded via ftp.
When you like you can design your own bash scripts to generate data more often and send this via wget calls to your web server.
philip
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: Sat Apr 16, 2011 2:22 am

Re: rapid fire push to custom web server (not using FTP)?

Post by philip »

Thank you for your help. So far, I have the following weather-update.sh script running to extract values using a template and then to upload them, if they have changed, to my test web server.

1. Please let me know what the first line should be. So far I have had to comment it out (but it still seems to run ok).

2. Also, what utility should I use to make sure this script starts running automatically when the WeatherHub2 is rebooted (power loss, etc.)? Should I use cron?

Code: Select all

#!/bin/sh

# weather update bash script

cd /data/export

while true; do
  wget http://10.0.1.20/meteohtml.cgi?file=my-template -O actual.json -o my-template.log

  cmp -s actual.json actual-saved.json > /dev/null

  if [ $? -eq 1 ]; then
    wget --post-file actual.json http://10.0.1.10:8086/api/weather-update -Oweather-update-response.json -o weather-update.log
    mv actual.json actual-saved.json
  else
    echo "skipping duplicate weather data"
  fi

sleep 5

done

exit
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7877
Joined: Mon Oct 01, 2007 10:51 pm

Re: rapid fire push to custom web server (not using FTP)?

Post by admin »

ad 2, you can place the script in the /etc/boot folder. make it name something beginning with "z" to make sure it is started past the other scripts in there.
Post Reply