Does my novice approach to interface with Weather Underground make sense?

I’m new to TTN and LoRaWAN and am wondering if I’m misunderstanding how to use TTN and LoRaWAN. I’d like to get data wirelessly from a small home-made weather station to Weather Underground for display. I thought I would try to do this with LoRa. I’m using an Arduino and Dragino Arduino shield at the weather station and a Raspberry Pi with Dragino hat as the gateway. The node and gateway are sending data to TTN and I’ve created a storage integration on TTN that allows me to query the data from the node. I’m using Curl to request the data from TTN and store it in a file (JSON). I’m planning to parse the JSON file returned from TTN, then post the data to my page on Weather Underground again using Curl. I was planning to write a shell script to periodically invoke Curl to query TTN for new data, call the JSON parsing program to retrieve parameters from the JSON file, format a message with new data to send to Weather Underground, and invoke Curl again to post the message to Weather Undergroud. Longer term I’d like to write a single program to replace the script and Curl, but thought Curl and shell scripts would get things going faster. Is there a better way?

2 Likes

Using the Data Storage integration does not require your scripts to be running 24/7. That’s nice, but it’s also not really real-time, and needs you to filter data you already processed. (Note that only 7 days of data is kept.)

I’d make my application subscribe to the MQTT Data API, which indeed requires that application to be running at all times. Or go serverless by using the HTTP integration, along with AWS Lambda or Azure functions.

2 Likes

Thanks very much for responding and thanks for the suggestion to use MQTT. I’d looked at this before but wasn’t sure if it was the right approach. I did more investigation and was able to subscribe to the uplink topic of my device using mosquitto_sub. I now have something running from the command line that periodically displays my payload fields such as “payload_fields”:{“humidity”:50,“tempc”:25}. I’m wondering how to proceed. Should I now write a program that uses something like the paho.mqtt.c library to subscribe, and then process the response message and parse the json file payload fields? Is there a better way?
Thanks again

I use node red, with a MQTT node to subscribe to the TTN API, then parse the JSON file and build the URL with a function node and HTTP request to finally send to WU

Seems to work but they dont publish the URL structure/API anywhere that I can find it easily anymore

"https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID=XXXXXXX&PASSWORD=XXXXXXXXX&dateutc=now&winddir=230&windspeedmph=12&windgustmph=12&tempf=70&rainin=0&baromin=29.1&dewptf=68.2&humidity=90&weather=&clouds=&softwaretype=vws%20versionxx&action=updateraw

I have the same problems, How do they solved this problem?

2 posts were split to a new topic: ESP32 to get weather forecast using Climacell’s API