I have added the correct time ("localdt") in the form WOW like, example: dateutc=2011-02-02+10%3A32%3A55
But the time in that particular line doesnt update...
Here is a partial output from the script beneath.
The upper date time (bold) is good, the power one (bold) isnt and should contain the date and time between those %3A from the above instead of 14:58:09.
Received KNMI WOW 429 The custom error module does not recognize this error.
Thu, 02 Apr 2020 17:10:02
winddir= 299.7
windspeedmph= 0.021
windgustmph= 0.032
windgustdir= 290.9
humidity= 70.68
dewptf= 29.63
tempf= 38.31
rainin= 0
dailyrainin= 0
baromin= 30.12243
solarradiation= 0
&dateutc=2020-04-02+14%3A58%3A09
Hi,
With some changes i managed to get it working.
Now lets see if its uploading the way it supposed to do
.
But the time in that particular line doesnt update...
Here is a partial output from the script beneath.
The upper date time (bold) is good, the power one (bold) isnt and should contain the date and time between those %3A from the above instead of 14:58:09.
Received KNMI WOW 429 The custom error module does not recognize this error.
Thu, 02 Apr 2020 17:10:02
winddir= 299.7
windspeedmph= 0.021
windgustmph= 0.032
windgustdir= 290.9
humidity= 70.68
dewptf= 29.63
tempf= 38.31
rainin= 0
dailyrainin= 0
baromin= 30.12243
solarradiation= 0
&dateutc=2020-04-02+14%3A58%3A09
import requests import time import schedule import csv import urllib date = time.strftime("%Y-%m-%d",time.gmtime()) hours = time.strftime("%H",time.gmtime()) minutes = time.strftime("%M",time.gmtime()) seconds = time.strftime("%S",time.gmtime()) # Save it as a string in a format that WOW likes WUurl = "https://wow.metoffice.gov.uk/automaticreading?" siteid = "xxxxxxxx" siteAuthenticationKey = "xxxxxxx" WUcreds = "siteid=" + siteid + "&siteAuthenticationKey="+ siteAuthenticationKey action_str = "&action=updateraw" localdt = "&dateutc="+date+"+"+hours+"%3A"+minutes+"%3A"+seconds def task(): WeatherUnderground= open("C:\\Campbellsci\\LoggerNet\\CR1000_upload.dat", "r") csvReader = csv.reader(WeatherUnderground) for field in csvReader: a = (field[12]) b = (field[17]) c = (field[19]) d = (field[16]) e = (field[8]) f = (field[7]) g = (field[5]) h = (field[27]) i = (field[25]) j = (field[10]) k = (field[23]) l = (field[16]) winddir=a windspeedmph=b windgustmph=c windgustdir=d humidity=e dewptf=f tempf=g rainin=h dailyrainin=i baromin=j solarradiation=k softwaretype=1 r= requests.get( WUurl + WUcreds + localdt + "&winddir=" + str(winddir)+ "&windspeedmph=" + str(windspeedmph)+ "&windgustmph=" + str(windgustmph)+ "&windgustdir=" + str(windgustdir)+ "&humidity=" + str(humidity)+ "&dewptf=" + str(dewptf)+ "&tempf=" + str(tempf)+ "&rainin=" + str(rainin)+ "&dailyrainin=" + str(dailyrainin)+ "&baromin=" + str(baromin)+ "&solarradiation=" + str(solarradiation)+ str(softwaretype)+ action_str) print("Received KNMI WOW " + str(r.status_code) + " " + str(r.text),flush=True) print (time.strftime("%a, %d %b %Y %H:%M:%S"), flush=True) print ("winddir= " + a, flush=True) print ("windspeedmph= " + b, flush=True) print ("windgustmph= " + c, flush=True) print ("windgustdir= " + d, flush=True) print ("humidity= " + e, flush=True) print ("dewptf= " + f, flush=True) print ("tempf= " + g, flush=True) print ("rainin= " + h, flush=True) print ("dailyrainin= " + i, flush=True) print ("baromin= " + j, flush=True) print ("solarradiation= " + k, flush=True) print (minutes, flush=True) while True: try: task() time.sleep(300 - time.time() % 300) refresh() except: pass time.sleep(1) else: time.sleep(5)
Hi,
With some changes i managed to get it working.
Now lets see if its uploading the way it supposed to do

import requests import csv import hashlib import time import schedule import urllib from time import sleep import sys starttime=time.time() def task(): date = time.strftime("%Y-%m-%d") hours = time.strftime("%H") minutes = time.strftime("%M") seconds = time.strftime("%S") localdt = "&dateutc="+date+"+"+hours+"%3A"+minutes+"%3A"+seconds WUurl = "https://wow.metoffice.gov.uk/automaticreading?" siteid = "" siteAuthenticationKey = "" WUcreds = "siteid=" + siteid + "&siteAuthenticationKey="+ siteAuthenticationKey action_str = "&action=updateraw" WeatherUnderground= open("C:\\Campbellsci\\LoggerNet\\CR1000_upload.dat", "r") csvReader = csv.reader(WeatherUnderground) for field in csvReader: a = (field[12]) b = (field[17]) c = (field[19]) d = (field[16]) e = (field[8]) f = (field[7]) g = (field[5]) h = (field[27]) i = (field[25]) j = (field[10]) k = (field[23]) l = (field[16]) winddir=a windspeedmph=b windgustmph=c windgustdir=d humidity=e dewptf=f tempf=g rainin=h dailyrainin=i baromin=j solarradiation=k softwaretype=1 r= requests.get( WUurl + WUcreds + localdt + "&winddir=" + str(winddir)+ "&windspeedmph=" + str(windspeedmph)+ "&windgustmph=" + str(windgustmph)+ "&windgustdir=" + str(windgustdir)+ "&humidity=" + str(humidity)+ "&dewptf=" + str(dewptf)+ "&tempf=" + str(tempf)+ "&rainin=" + str(rainin)+ "&dailyrainin=" + str(dailyrainin)+ "&baromin=" + str(baromin)+ "&solarradiation=" + str(solarradiation)+ str(softwaretype)+ action_str) print("Received KNMI WOW " + str(r.status_code) + " " + str(r.text),flush=True) print(time.strftime("%Y%m%d%H%M%S"), flush=True) print ("winddir= " + a, flush=True) print ("windspeedmph= " + b, flush=True) print ("windgustmph= " + c, flush=True) print ("windgustdir= " + d, flush=True) print ("humidity= " + e, flush=True) print ("dewptf= " + f, flush=True) print ("tempf= " + g, flush=True) print ("rainin= " + h, flush=True) print ("dailyrainin= " + i, flush=True) print ("baromin= " + j, flush=True) print ("solarradiation= " + k, flush=True) print (localdt, flush=True) while True: try: task() time.sleep(300 - time.time() % 300) refresh() except: pass time.sleep(1) else: time.sleep(300) refresh()