UNPKG

node-red-contrib-twc-weather

Version:

Node-RED nodes for The Weather Company and Weather Underground Data APIs

92 lines (87 loc) 4.75 kB
<script type="text/javascript"> RED.nodes.registerType('pws-forecast',{ category: 'Weather', color: "#a2a9b0", icon: "icons/wi-wu-partlycloudy.png", inputs:1, outputs:1, defaults: { name: { value:""}, units: { value:"e"}, locationtype: {value:"geocode",required: true}, location: {value:"",required: true}, lang: {value:"en-US"}, apikey: {value:"", type:"pwsapikey",required: true} }, label: function() { return this.name||"TWC Forecast"; } }); </script> <script type="text/x-red" data-template-name="pws-forecast"> <div class="form-row"> <label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label> <input type="text" id="node-input-apikey"> </div> <div class="form-row"> <label for="node-input-locationtype"><i class="fa fa-globe"></i> Location Type</label> <select id="node-input-locationtype"> <option value="geocode">Request by Geocode</option> <option value="iataCode">Request by IATA Airport Code</option> <option value="icaoCode">Request by ICAO Airport Code</option> <option value="placeid">Request by Place ID</option> <option value="postalKey">Request by Postal Key</option> </select> </div> <div class="form-row"> <label for="node-input-location"><i class="fa fa-map-marker"></i> Location</label> <input type="text" id="node-input-location" placeholder="40.98,-74.1"> </div> <div class="form-row"> <label for="node-input-lang"><i class="fa fa-language"></i> Language</label> <input type="text" id="node-input-lang" placeholder="en-US"> </div> <div class="form-row"> <label for="node-input-units"><i class="fa fa-thermometer-half"></i> Unit of Measure</label> <select id="node-input-units"> <option value="e">English units</option> <option value="m">Metric units</option> <option value="h">Hybrid units (UK)</option> </select> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <input type="text" id="node-input-name"> </div> </script> <script type="text/x-red" data-help-name="pws-forecast"> <p>The Daily Forecast API is sourced from the The Weather Company Forecast system. This TWC API returns the 5 Day Daily weather forecast. <p>The TWC daily forecast product can contain multiple days of daily forecasts for each location. Each day of a forecast can contain up to (3) "temporal segments" meaning three separate forecasts. For any given forecast day we offer day, night, and a 24-hour forecast (daily summary). Implementing our forecasts requires your applications to perform basic processing in order to properly ingest the forecast data feeds. The data values in this API are correctly populated into Day, Night, or 24-hour temporal segments. These segments are separate objects in the response. <p>See the <a target="_blank" href="https://docs.google.com/document/d/1eKCnKXI9xnoMGRRzOL1xPCBihNV2rOet08qpE_gArAY">online documentation</a> for more information about the <strong>The Weather Company APIs for Personal Weather Stations</strong>.</p> <h3>Inputs:</h3> <dl class="message-properties"> <dt class="optional">msg.twcparams.locationtype <span class="property-type">string</span></dt> <dd>If specified, override edit panel.</dd> <dd>"geocode" - Request by Geocode</dd> <dd>"iataCode" - Request by IATA Airport Code</dd> <dd>"icaoCode" - Request by ICAO Airport Code</dd> <dd>"placeid" - Request by Place ID</dd> <dd>"postalKey" - Request by Postal Key</dd> <dt class="optional">msg.twcparams.location <span class="property-type">string</span></dt> <dd>If specified, override edit panel. See examples in the above documentation for geocodes, IATA/ICAO airport codes, Place ID and Postal Keys</dd> <dt class="optional">msg.twcparams.lang <span class="property-type">string</span></dt> <dd>If specified, override edit panel. ISO 639-1 standard language codes</dd> <dt class="optional">msg.twcparams.units <span class="property-type">string</span></dt> <dd>If specified, override edit panel. 'e' - English units, 'm' - Metric units, 'h' - Hybrid units</dd> </dl> <h3>Outputs:</h3> <dl class="message-properties"> <dt class="optional">msg.payload.observations <span class="property-type">object</span></dt> <dd>Array of json objects containing weather data elements</dd> <dd>Find details on the <a target="_blank" href="https://ibm.co/v3FFDP">TWC Daily Forecast (5 Day)</a> data elements and definitions.</dd> <dt class="optional">msg.twcparams <span class="property-type">object</span></dt> <dd>Array of json objects containing request parameters</dd> </dl> </script>