From 3c6cae92adaeec646fc5d81c6eba1b60dc35dd9a Mon Sep 17 00:00:00 2001 From: GeorgeWebberley Date: Tue, 27 Jan 2026 21:04:39 +0100 Subject: [PATCH] Added other wave data --- fetcher/index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fetcher/index.js b/fetcher/index.js index 4a3b1fe..0ad169f 100644 --- a/fetcher/index.js +++ b/fetcher/index.js @@ -11,16 +11,20 @@ const writeApi = client.getWriteApi(org, bucket); async function fetchSurfData() { try { + const lat = 51.58; + const lon = -4.29; console.log("🌊 Fetching latest swell data..."); - const response = await axios.get(`https://marine-api.open-meteo.com/v1/marine?latitude=-33.89&longitude=151.27¤t=swell_wave_height,swell_wave_period`); + const url = `https://marine-api.open-meteo.com/v1/marine?latitude=${lat}&longitude=${lon}¤t=swell_wave_height,swell_wave_period,swell_wave_direction,wind_wave_height`; - const swellHeight = response.data.current.swell_wave_height; - const swellPeriod = response.data.current.swell_wave_period; + const response = await axios.get(url); + const current = response.data.current; const point = new Point('surf_conditions') - .tag('location', 'local_break') - .floatField('swell_height', swellHeight) - .floatField('swell_period', swellPeriod); + .tag('location', 'rhossili_beach') + .floatField('swell_height', current.swell_wave_height) + .floatField('swell_period', current.swell_wave_period) + .floatField('swell_direction', current.swell_wave_direction) // 0-360 degrees + .floatField('wind_wave_height', current.wind_wave_height);// You can add weather-api for wind! console.log(`📡 Sending to InfluxDB: ${swellHeight}m...`);