node-red-contrib-twc-weather
Version:
Node-RED nodes for The Weather Company and Weather Underground Data APIs
85 lines (80 loc) • 3.79 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('twc-nowcast',{
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 NowCast";
}
});
</script>
<script type="text/x-red" data-template-name="twc-nowcast">
<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="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="twc-nowcast">
<p>The short range Nowcast Forecast API provides a text summary of the weather forecast for the next 6 hour period for today.
<p>The short range Nowcast Forecast API is sourced from the TWC Forecast system.
<p>See the <a target="_blank" href="https://ibm.co/TWCefo">online documentation</a>
for more information about the <strong>The Weather Company Enhanced Forecast APIs</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>"postalKey" - Request by Postal Key : CountryCode</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 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.forecast <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/v1rEFN">TWC Nowcast (6 Hour)</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>