Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

422 Errors #3

Open
justinhorner opened this issue Aug 12, 2024 · 6 comments
Open

422 Errors #3

justinhorner opened this issue Aug 12, 2024 · 6 comments

Comments

@justinhorner
Copy link

justinhorner commented Aug 12, 2024

I noticed that when sending up a POST request, I would always get a 422 error.

It looks like the culprit was some incorrectly named params. I pushed up a fixed in a fork

After addressing this issue, I noticed I was getting other 422 errors when I would send up data that had '0.0' for some of the value(s) (e.g. windspeedmph). I would think it is considered valid to have 0 windspeed, so I pushed up another commit (justinhorner@0d7b97b) that checks for null, to ensure the API will accept (valid) 0 values.

I just thought I would share my findings, in case you wanted to merge in the changes to your branch (if not, please feel free to close this 'issue'). I ended up forking, fixing and deploying to my own worker.

Thanks for all the work, this is a great solution for (more easily) pushing up data to CWOP

leoherzog added a commit that referenced this issue Aug 20, 2024
@leoherzog
Copy link
Owner

Thanks so much for this! I had started to switch the parameter from windspeedmph to windspeed in my testing, but that one snuck out to prod. Nice catch!

@tavdog
Copy link

tavdog commented Sep 12, 2024

I'm seeing 422 errors sporadically too. python3 WS8B_to_CWOP.py GET request sent to: https://send.cwop.rest/?id=GW5395&lat=20.938017&long=-156.347942&time=2024-09-12T00:19:50.750121Z&tempf=80&windspeedmph=26.0&windgustmph=32.0&winddir=74 Response status code: 422

i tried shortly after and got 200, then tried shortly after and got a 429

@leoherzog
Copy link
Owner

@tavdog Hrm. There are a few cases where the code throws a 422. Can you start logging in your WS8B_to_CWOP.py file not only the HTTP status code, but also the contents of the page when it throws an error? That would tell us if the code thinks that your specified time is invalid or the location is invalid, for example.

@leoherzog leoherzog reopened this Sep 12, 2024
@tavdog
Copy link

tavdog commented Sep 13, 2024

here is the result. seems my script is attempting to send the same packet so it makes sense it's refusing

GET request sent to: https://send.cwop.rest/?id=GW5395&lat=20.938017&long=-156.347942&time=2024-09-13T02:10:14.471301Z&tempf=80&
windspeedmph=25.3&windgustmph=35.1&winddir=89
Response status code: 200
Response body : APRS packet 'GW5395>APRS,TCPIP*:@130210z2056.28N/15620.87W_089/026g036t080cwop.rest' sent to 'cwop.aprs.net'
GET request sent to: https://send.cwop.rest/?id=GW5395&lat=20.938017&long=-156.347942&time=2024-09-13T02:10:14.471301Z&tempf=80&
windspeedmph=25.3&windgustmph=35.1&winddir=89
Response status code: 422
Response body : Timestamp in packet is not within last 5 minutes```

@leoherzog
Copy link
Owner

leoherzog commented Sep 13, 2024

@tavdog CWOP reports are required to be as close to realtime as possible. The CWOP system assumes that the reading is "right now". Because of that, cwop.rest rejects readings that were taken more than 5 minutes past current time.

  1. What is the APRS time format? In an APRS weather data packet, the part between "@" and "z" is the time of the weather station clock when the packet was sent. However, many computer clocks frequently have large errors and to avoid these errors, the data time is taken as the time that the packet arrives at the findu.com server. This does introduce an error of the time that it took for the packet to travel from the station to the server, but that is usually not significant for weather uses.

http://wxqa.com/faq.html

@tavdog
Copy link

tavdog commented Sep 13, 2024

ok, smart coding on your part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants