Added other wave data
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
b1459fcbd0
commit
3c6cae92ad
|
|
@ -11,16 +11,20 @@ const writeApi = client.getWriteApi(org, bucket);
|
||||||
|
|
||||||
async function fetchSurfData() {
|
async function fetchSurfData() {
|
||||||
try {
|
try {
|
||||||
|
const lat = 51.58;
|
||||||
|
const lon = -4.29;
|
||||||
console.log("🌊 Fetching latest swell data...");
|
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 response = await axios.get(url);
|
||||||
const swellPeriod = response.data.current.swell_wave_period;
|
const current = response.data.current;
|
||||||
|
|
||||||
const point = new Point('surf_conditions')
|
const point = new Point('surf_conditions')
|
||||||
.tag('location', 'local_break')
|
.tag('location', 'rhossili_beach')
|
||||||
.floatField('swell_height', swellHeight)
|
.floatField('swell_height', current.swell_wave_height)
|
||||||
.floatField('swell_period', swellPeriod);
|
.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...`);
|
console.log(`📡 Sending to InfluxDB: ${swellHeight}m...`);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue