{"id":14751,"library":"node-red-node-openweathermap","title":"Node-RED OpenWeatherMap Node","description":"This package provides two Node-RED nodes, 'OpenWeatherMap' (input) and 'OpenWeatherMap Query' (query), for integrating weather data from the OpenWeatherMap API into Node-RED flows. The 'input' node periodically fetches current weather or a 5-day forecast based on configured location (city/country or lat/lon) and outputs a message if data changes. The 'query' node allows on-demand fetching of current weather, triggered by input messages containing location details. It returns detailed weather information including temperature, humidity, wind, and precipitation, as well as an object with full API data. Currently at version 1.0.1, it is part of the broader Node-RED ecosystem and follows its release cadence for updates and compatibility. A key differentiator is its seamless integration into Node-RED's visual programming environment, abstracting direct API calls and simplifying complex API interactions into configurable nodes. This makes it accessible for users who prefer visual programming over writing code for data fetching and processing.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/node-red/node-red-web-nodes#master","tags":["javascript","node-red","weather","openweathermap"],"install":[{"cmd":"npm install node-red-node-openweathermap","lang":"bash","label":"npm"},{"cmd":"yarn add node-red-node-openweathermap","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-red-node-openweathermap","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This package provides nodes for the Node-RED platform and requires Node-RED to function.","package":"node-red","optional":false}],"imports":[],"quickstart":{"code":"/*\n  Step 1: Install the node in your Node-RED environment.\n  Open your Node-RED user directory (typically ~/.node-red) in your terminal and run:\n*/\n// npm install node-red-node-openweathermap\n\n/*\n  Step 2: Restart Node-RED to load the new nodes (if it was running).\n*/\n// node-red\n\n/*\n  Step 3: In the Node-RED editor (usually accessible at http://localhost:1880),\n  drag an \"OpenWeatherMap Query\" node from the palette onto the canvas.\n  Double-click the node to configure it, providing your OpenWeatherMap API Key\n  (obtained from openweathermap.org/appid).\n\n  Step 4: To trigger the 'OpenWeatherMap Query' node and fetch current weather\n  for a specific location, inject a message (e.g., using an 'Inject' node)\n  with the following structure:\n*/\nconst msg_by_city = {\n  payload: {},\n  location: {\n    city: \"London\",\n    country: \"UK\"\n  }\n};\n\n// Alternatively, you can specify location using latitude and longitude:\nconst msg_by_coords = {\n  payload: {},\n  location: {\n    lat: 51.5074,\n    lon: 0.1278\n  }\n};\n\n/*\n  The 'OpenWeatherMap Query' node will then output a message (msg.payload)\n  containing detailed weather data, similar to the following:\n  {\n    \"description\": \"light rain\",\n    \"weather\": \"Rain\",\n    \"icon\": \"10d\",\n    \"id\": 500,\n    \"tempc\": 15.2,\n    \"tempk\": 288.35,\n    \"humidity\": 87,\n    \"windspeed\": 2.1,\n    \"winddirection\": 240,\n    \"location\": \"London\",\n    \"rain\": 0.5,\n    \"lat\": 51.5074,\n    \"lon\": 0.1278,\n    \"city\": \"London\",\n    \"country\": \"UK\",\n    \"time\": 1678886400, // example epoch timestamp\n    \"data\": { /* full JSON from OpenWeatherMap API */ } // full JSON from OpenWeatherMap API\n  }\n*/","lang":"javascript","description":"This quickstart guides you through installing the Node-RED OpenWeatherMap node, configuring it, and providing example input messages to trigger the 'OpenWeatherMap Query' node for fetching weather data."},"warnings":[{"fix":"Register for a free API key at openweathermap.org/appid and configure it in the Node-RED node's properties within the editor.","message":"An OpenWeatherMap API key is mandatory for the nodes to function correctly. Without a valid API key configured in the node properties, the nodes will fail to retrieve any weather data.","severity":"gotcha","affected_versions":">=0.2.0"},{"fix":"If you require on-demand weather data regardless of changes, use the 'OpenWeatherMap Query' node, which triggers on every input message. For debugging, consider connecting a debug node to observe any messages, even if filtered by change.","message":"The 'OpenWeatherMap' (Input Node) is designed to output a message only when the fetched weather data changes. If the weather conditions remain stable, you might not see frequent outputs from this node.","severity":"gotcha","affected_versions":">=0.2.0"},{"fix":"Ensure your Node-RED flow is designed to correctly parse and process the array structure of the forecast data, extracting the specific daily metrics required.","message":"The 5-day forecast data is returned as a 5-part array, where each element represents aggregated daily weather information, not granular hourly forecasts. The structure includes various temperatures (day, min, max, night, eve, morn) and other conditions.","severity":"gotcha","affected_versions":">=0.2.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Obtain a valid API key from openweathermap.org/appid and enter it correctly into the API Key field in the Node-RED node's configuration settings.","cause":"The OpenWeatherMap API key field in the node configuration is empty, malformed, or has been revoked/expired.","error":"Error: API key not provided or invalid"},{"fix":"Verify that your Node-RED instance has internet access. Check the `city`, `country`, `lat`, and `lon` parameters for accuracy. Also, confirm that your OpenWeatherMap API key is active and not exceeding rate limits.","cause":"This typically indicates an issue with network connectivity from the Node-RED instance, incorrect location parameters in the input message/node configuration, or an issue with the OpenWeatherMap API itself.","error":"Error: No data received from OpenWeatherMap API"}],"ecosystem":"npm"}