API for WOW - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: API for WOW (/showthread.php?tid=4977) |
API for WOW - jobb@nordstrandsel.se - 20.09.2023 Hello, I try to send data from a weather station to "WOW" The instructions from them is folowing... Using the API directly If you're a developer and would like to use the API directly, details are provided below. Upload URL: WOW expects an HTTP request, in the form of either GET or POST, to the following URL. When received, WOW will interpret and validate the information supplied and respond as below. The URL to send your request to is: http://wow.metoffice.gov.uk/automaticreading? followed by a set of key/value pairs indicating pieces of data. Response and Errors All requests will return a status code. A success is indicated by 200. Anything else is a failure. A human readable error message will accompany all errors in JSON format. Mandatory Information: All uploads must contain 4 pieces of mandatory information plus at least 1 piece of weather data.
The date must be in the following format: YYYY-mm-DD HH:mms, where ':' is encoded as %3A, and the space is encoded as either '+' or %20. An example, valid date would be: 2011-02-29+10%3A32%3A55, for the 2nd of Feb, 2011 at 10:32:55. Note that the time is in 24 hour format. Also note that the date must be adjusted to UTC time - equivalent to the GMT time zone.. This is especially important for users outside the UK, and British users must also take note of the difference between British Summer Time and UTC Weather Data: The following is a list of items of weather data that can be uploaded to WOW. Provide each piece of information as a key/value pair, e.g. winddir=225.5 or tempf=32.2. Note that values should not be quoted or escaped. Frequency of submitting observations It is recommended that the interval between automatic observations from your AWS is at least 5 minutes. Pressure & MSLP: Some weather stations record Mean Sea Level Pressure, and some record Station Pressure (also referred to as Air Pressure). The Site Definition in WOW will be used to determine which pressure measurement to use. If your site specifies a unit for Air Pressure, and MSLP is marked as 'Not Captured', then baromin will be treated as an Air Pressure reading. Otherwise it will be treated as an MSLP reading. To edit your site definition and ensure the correct pressure is selected, visit the edit pages of your site and the options for pressure will be near the bottom. Ensure one is set to 'hectopascals (hPa)' and the other is set to 'not captured'. WOW will then automatically work out the other measurement and store it for you. Example URL: ://wow.metoffice.gov.uk/automaticreading?siteid=123456&siteAuthenticationKey=654321&dateutc=2011-02-02+10%3A32%3A55&winddir=230&windspeedmph=12&windgustmph=12&windgustdir=25&humidity=90&dewptf=68.2&tempf=70&rainin=0&dailyrainin=5&baromin=29.1&soiltempf=25&soilmoisture=25&visibility=25&softwaretype=weathersoftware1.0 Standard vs. Alternative units My try to script is like this, but it boes not work. How can i get it work? /Fredrik Code: local http = require("socket.http") RE: API for WOW - admin - 20.09.2023 Try this, replace ... with real values for siteid / siteAuthenticationKey / softwaretype: Code: escape = require('socket.url').escape RE: API for WOW - jobb@nordstrandsel.se - 20.09.2023 Thank You! I have this in log. Something seems not still work. The password must be at least 9 characters and contain at least one digit, one uppercase, one lowercase, and one special character. I have a ! But in the string i can se its %21 /Fredrik RE: API for WOW - admin - 20.09.2023 Special characters must be escaped in the URL so this part is correct. Check the siteAuthenticationKey contents. Documentation says that is is a pin number, chosen by the user to authenticate with WOW. RE: API for WOW - jobb@nordstrandsel.se - 20.09.2023 Thank you! I think it work properly now. |