Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' of github.com:lbehrler/WR2-uploader-WX into main
Browse files Browse the repository at this point in the history
  • Loading branch information
lbehrler committed May 20, 2021
2 parents bd30aeb + 99551f7 commit fe57a2f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 19 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
config.py
./config.py
14 changes: 7 additions & 7 deletions WR2-adv-uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ def sh_arrow():
sense.show_message(shMsg, text_colour=[255, 255, 0], back_colour=[0, 0, 102])
# clear the screen
sense.clear()

#build weather packet for sending to WU and PWS
weather_data = {
'dateutc': time_str,
Expand All @@ -541,13 +541,13 @@ def sh_arrow():
'AqPM10': PM10S_str, # comment out if no AQI
'softwaretype':str("WR2-Advanced-Updater"),
}

weather_data_wdy = {
#'station': Config.WDY_STATION_ID,
'dateutc': time_str,
#'dateutc':"now",
'tempf': temp_str,
'windspeedmph': avewind_str,
'windspeedmph': avewind_str,
'winddir': winddir_str,
'windgustmph': gustwind_str,
'humidity': humidity_str,
Expand All @@ -556,7 +556,7 @@ def sh_arrow():
'rainin': dayrain_str,
'uv': uv_str,
}

# Form URL into WU format and Send
if (Config.WU_ENABLE == True):
# From http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol
Expand All @@ -576,7 +576,7 @@ def sh_arrow():
#traceback.print_exc(file=sys.stdout)
else:
logging.info('Skipping Weather Underground upload')

# Check upload time against interval to insure weather data is sent to PWSweather.com once every 1-30 minutes
# get the current minute
current_minute = dt.datetime.now().minute
Expand All @@ -587,7 +587,7 @@ def sh_arrow():
# reset last_minute to the current_minute
last_minute = current_minute
# is minute zero, or divisible by 10?

# PWS weather upload
# we're only going to use measurements every PWS_INTERVAL minutes
if (Config.PWS_ENABLE == True and ((current_minute == 0) or ((current_minute % Config.PWS_INTERVAL) == 0))):
Expand All @@ -611,7 +611,7 @@ def sh_arrow():
#traceback.print_exc(file=sys.stdout)
else:
logging.info('Skipping PWSweather.com upload')

# WDY weather upload
# we're only going to use measurements every WDY_INTERVAL minutes
if (Config.WDY_ENABLE == True and ((current_minute == 0) or ((current_minute % Config.WDY_INTERVAL) == 0))):
Expand Down
3 changes: 0 additions & 3 deletions WR2-startup.py

This file was deleted.

18 changes: 18 additions & 0 deletions WR2.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /bin/bash

[Unit]
Description=WR2 Advanced Uploader

[Service]
Type=idle
ExecStart=/usr/bin/python /home/pi/WR2-uploader-WX/WR2-adv-uploader.py
RemainAfterExit=yes
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=my_server
User=pi
Group=pi

[Install]

5 changes: 2 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ This project is quite easy to make.

The project folder contains several files and one folder:

+ `config.py` - This is the project's external service configuration file, it provides the weather station with details about your Weather Underground station.
+ `sample.config.py` - Rename to config.py, This is the project's external service configuration file, it provides the weather station with details about your weather station.
+ `LICENSE` - The license file for this project
+ `readme.md` - This file.
+ `WR2-uploader-WU.py` - A basic data collection application for this project. You'll run this application to collect data from the data stream, process it and upload to Weather Underground.
+ `SH-WR2-uploader-WU.py` - The main data collection application for this project, using both the Weather Rack 2 and the Sense Hat. You'll run this application to collect data from the data stream, display data (inside and outside) on the Sense Hat, and upload to Weather Underground.
+ `WR2-adv-uploader.py` - A basic data collection application for this project. You'll run this application to collect data from the data stream, process it and upload to Weather Underground, PWS and several other services.

## Hardware Assembly

Expand Down
12 changes: 7 additions & 5 deletions sample-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ class Config:
AQ_STATION_NAME = ""
LOCATION = {'latitude': 0000000, 'longitude': 0000000}
TOKEN = ""


# MQTT
MQTT_ENABLE = True
MQTT_BROKER = "192.168.1.3"
MQTT_TOPIC = "PWS/raw-wx-readings"

# Sense Hat
SH_ENABLE = False

# Barometer settings
baro = True

# BMP280
BMP280_ENABLE = True

# BMP180 - Depreciated
BMP180_ENABLE = False
BMP280_ENABLE = True

0 comments on commit fe57a2f

Please sign in to comment.