Replace Weather Underground by OpenWeatherMap

Due to the end of service for Weather Underground API you can replace this service by OpenWeatherMap.

You have to register there and afterwards you can use Current weather data as a free service after subscription.

Access weather data for your location by calling{your location}&APPID={your API key}

for me this was, for example:,CH&APPID=eaxxxxxyyyyyyyyy58

and I got the following answer after formatting by JSON Pretty Print:

  "coord": {
    "lon": 8.83,
    "lat": 47.19
  "weather": [
      "id": 701,
      "main": "Mist",
      "description": "mist",
      "icon": "50n"
  "base": "stations",
  "main": {
    "temp": 279.65,
    "pressure": 1021,
    "humidity": 93,
    "temp_min": 279.15,
    "temp_max": 280.15
  "wind": {
    "speed": 0.32,
    "deg": 82.0013
  "clouds": {
    "all": 75
  "dt": 1544034000,
  "sys": {
    "type": 1,
    "id": 6932,
    "message": 0.0022,
    "country": "CH",
    "sunrise": 1543992940,
    "sunset": 1544024117
  "id": 2661776,
  "name": "Altendorf",
  "cod": 200

Try it and you can replace the Weather Underground API.

Replace Weather Underground by OpenWeatherMap

End of Service for the Weather Underground API

In a post from January 2017 I wrote about getting weather data from Weather Underground (wunderground).

The used Weather Underground API will be out of service end of this year. For further information see this link, please.

Your applications using the Weather Undergound API will get no data afterwards. You have to change the service.

I will show how in a next post.

End of Service for the Weather Underground API

SparkFun MicroView as serial display

I added a SparkFun MicroView display to the Omega2+ to show temperature and humidity from Weather Underground. The display text here is in German but can changed.


The MicroView USB programmer serves as programmer for the Arduino inside MicroView and as serial interface between Omega2+ USB and MicroView TX/RX.

The Arduino program SerialDisplay.ino waits for a telegram containing a start character, the temperature as floating point number, and the humidity as integer.

To control the serial interface /dev/ttyUSB0 at Omega2+ we have to install stty by opkg install coreutils-stty. The Shell script sends the data from Omega2+ to MicroView.

During serial communication MicroView is controlled by DTR (The bootloader will be activated). Therefore, DTR must be disabled in this case. I did not find a solution by stty. A simple way is to connect TX, RX, GND and VCC between MicroView and MicroView programmer only. This way the RST line is not affected during serial communication.

All script including the Arduino sketch are saved at Github as usual.



SparkFun MicroView as serial display

Is your IoT node running?

If you test a new IoT node (or a Linux device in general) it is important to get some information whether the node runs stable or have problems.

The command uptime returns the time elapsed since last boot and some other information.

root@Omega-B2BB:/home# uptime
 23:34:53 up 4 days, 13:56, load average: 0.00, 0.00, 0.00

The uptime command gives a one line display of the following information.

  • The current time (23:34:53)
  • How long the system has been running (up 4 days)
  • The system load averages for the past 1, 5, and 15 minutes (0.00, 0.00, 0.00)

Here the Omega2+ has not a lot to do.

It’s not allways possible to contact that node directly for monitoring. To send the uptime result as a message is a good way to get this info.

My preferred way is to use Pushover messages but I had problem with sending the data by cURL. I have to wait for an answer from Onion’s community because this worked with an older firmware version.

But, to get this info yet I use Twitter direct messages. IFTTT acts as a gateway to twitter.ifttt


I use the Maker event to trigger sending a direct message to myself.

The configuration is quite simple. The event is named Uptime, what else?

After that we can specify the message content. I will send only one value with the complete uptime message inside.

To send the message from Omega2+ (or any other Linux device) I use a POST web request sent by cURL. The complete Shell script looks as follows:


uptime > UPT
MSG=`cat UPT`
echo -n Uptime:
echo "$MSG"

# Send data as Twitter direct message via IFTTT
curl --data "value1=$MSG" \


You can find the script at Github.

I placed the script in a crontab for calling it each hour. There is a second script which calls weather data each 15 minutes.

root@Omega-B2BB:/home# crontab -l
0 */1 * * * /home/
*/15 * * * * /home/

You can see the direct messages sent from my Omega2+ on my mobile phone.




Is your IoT node running?

Publishing data by MQTT

After installing Mosquitto on Omega2+ in the blog post Using MQTT on Onion Omega2+ the subscription of messages was shown. Here I will send data to the MQTT broker to subscribe and access them from anywhere in the world.

For data generation I use the script wunderweather.phy again. The script reads the requested data (temperature & humidity) and publishes these to my MQTT broker. Look for the files at Github.



echo "Send data to MQTT Broker"

DATE="$(date +"%d-%m-%Y")"
read TEMP < /home/TEMP 
echo "Temperature = $TEMP *C"
read HUMI < /home/HUMI 
echo "Rel. Humidity = $HUMI %"

mosquitto_pub -h $BROKER -u $BRUSER -P $BRPASSW -p $BRPORT -t $TEMPTOP -m $TEMP
mosquitto_pub -h $BROKER -u $BRUSER -P $BRPASSW -p $BRPORT -t $HUMITOP -m $HUMI

The screenshot of my MQTT client MyMQTT shows messages from two publishers. WU labels the data received from Weather Underground requestet here and ASH2200 is a sensor placed outside of my house. The difference between the measured values is due to different measuring locations.


Publishing data by MQTT

Get weather data for your location

Find more about Weather in Altendorf, SW
Click for weather forecast

If you have no own weather station but are interested in local weather data then weather data from Weather Underground  (wunderground) can help to close this gap.

I built three small scripts to ask wunderground for data, send the to the thingspeak server for visualization and cover both scripts. You will find them on Github for download. asks Wunderground for locale weather data. Local means here Altendorf in Switzerland.


# Reading weather data from wunderground network

import urllib2
import json

f = urllib2.urlopen('')
json_string =
parsed_json = json.loads(json_string)

location = parsed_json['location']['city']
temp_c = parsed_json['current_observation']['temp_c']
rel_hum = parsed_json['current_observation']['relative_humidity']
weather = parsed_json['current_observation']['weather']
station = parsed_json['current_observation']['station_id']
updated = parsed_json['current_observation']['observation_time_rfc822']
print("Current temperature in %s is: %s *C" % (location, temp_c))
print("Current relative humidity is: %s %%" % (rel_hum))
print("Weather is %s " % (weather))
print("Weather station is %s" % (station))
print("Last updated: %s" % (updated))


f = open("TEMP","w")

f = open("HUMI","w")
f.close() sends temperature und humidity to the Thingspeak server:


echo "Send data to Thingspeak Server"


read TEMP < /home/TEMP
echo "Temperature = $TEMP *C"
read HUMI < /home/HUMI     echo "Rel. Humidity = $HUMI %"     curl --data \       "api_key=$api_key&field1=$TEMP&field2=$HUMI&field3=$DATE" \ > log 2>&1

As you can see from both scripts you need access data for the APIs. Therefore you have to register on both services.

The last script covers both calls. That’s all:


echo "Done."

Temperature Graph

Humidity Graph

Here is a screenshot of a test on Raspberry Pi 3:


Get weather data for your location