Cześć
Przerabiał już ktoś publikację encji do openweathermap.
Posiadam stację pogody z której lokalnie zrzucam dane ale chciałbym to opublikować na openweathermap. Z takim np. Wunderunderground nie ma problemu bo sama stacja to obsługuje.
Jarek
EDIT
Zrobione na Node Red
Funkcja
const globalHomeAssistant = global.get('homeassistant');
var date = new Date();
var timestamp = date.getTime();
var tz_offset = date.getTimezoneOffset() * 60;
var d = timestamp / 1000 + tz_offset;
var opw_dt = parseFloat(d).toFixed(0);
var opw_temp = globalHomeAssistant.homeAssistant.states["sensor.outdoor_temperature"].state;
var opw_humi = globalHomeAssistant.homeAssistant.states["sensor.humidity"].state;
var opw_uv = globalHomeAssistant.homeAssistant.states["sensor.uv_index"].state;
var opw_solar = globalHomeAssistant.homeAssistant.states["sensor.solar_radiation"].state;
var opw_pressure = globalHomeAssistant.homeAssistant.states["sensor.relative_pressure"].state;
var opw_wind_dir = globalHomeAssistant.homeAssistant.states["sensor.wind_direction"].state;
var opw_wind_speed = globalHomeAssistant.homeAssistant.states["sensor.wind_speed"].state;
opw_wind_speed = parseFloat(opw_wind_speed / 3.6).toFixed(1);
var opw_wind_gust = globalHomeAssistant.homeAssistant.states["sensor.wind_gust"].state;
opw_wind_gust = parseFloat(opw_wind_gust / 3.6).toFixed(1);
var opw_rain_rate = globalHomeAssistant.homeAssistant.states["sensor.rain_rate"].state;
var opw_rain_hourly_rate = globalHomeAssistant.homeAssistant.states["sensor.hourly_rain_rate"].state;
var weatherstring = '[{"station_id": "identyfikator stacji", "dt": ' + opw_dt + ', "temperature": ' + opw_temp + ', "pressure": ' + opw_pressure + ', "humidity": ' + opw_humi + ', "wind_speed": ' + opw_wind_speed + ', "wind_gust": ' + opw_wind_gust + ', "wind_deg": ' + opw_wind_dir + ', "rain_1h": ' + opw_rain_hourly_rate +'}]'
msg.payload = weatherstring
return msg;
http request
Method: POST
URL: http://api.openweathermap.org/data/3.0/measurements?appid=nasze_API
Headers: Contenet-Type: applications/json