node-red-contrib-twc-weather
Version:
Node-RED nodes for The Weather Company and Weather Underground Data APIs
108 lines (104 loc) • 5.52 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('twc-health-forecast',{
category: 'Weather',
color: "#a2a9b0",
icon: "icons/wi-wu-partlycloudy.png",
inputs:1,
outputs:1,
defaults: {
name: { value:""},
range: { value:"daily",required:true},
conditiontype: {value:"all",required:true},
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 Health Forecast";
}
});
</script>
<script type="text/x-red" data-template-name="twc-health-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-range"><i class="fa fa-area-chart"></i> Forecast Range</label>
<select id="node-input-range">
<option value="1day">1 day</option>
<option value="3day">3 day</option>
<option value="5day">5 day</option>
<option value="7day">7 day</option>
<option value="15day">15 day</option>
</select>
</div>
<div class="form-row">
<label for="node-input-conditiontype"><i class="fa fa-heartbeat"></i> Health Condition</label>
<select id="node-input-conditiontype">
<option value="allergies">Allergies</option>
<option value="migraine">Migraine</option>
<option value="coldAndFlu">Cold and Flu</option>
<option value="pain">Pain</option>
<option value="all">All</option>
</select>
</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-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-health-forecast">
<p>The Cognitive Health Forecast API provides cognitive forecast data for the risk of allergy, migraine, cold and flu, or pain for a given location and for a period of one to 15 days in advance.
<p>Use of this node requires a purchased <a href="https://business.weather.com/resource/lifestyle-indices-data-package-brochure" target="_new">TWC Lifestyle Indices Weather data package</a><br />
<p>See the <a target="_blank" href="https://docs.google.com/document/d/1njmJFG8aBEmxTsbYiTJV6m8nCJbR1JOaiNyy2xFbRQE">online documentation</a>
for more information about the <strong>The Weather Company APIs for Cognitive Health Forecast</strong>.</p>
<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>
<dt class="optional">msg.twcparams.range <span class="property-type">string</span></dt>
<dd>If specified, override edit panel. '1day', '3day', '5day', '7day', '15day'</dd>
<dt class="optional">msg.twcparams.conditiontype <span class="property-type">string</span></dt>
<dd>If specified, override edit panel. 'allergies', 'migraine', 'coldAndFlu', 'pain', 'all'</dd>
</dl>
<h3>Outputs:</h3>
<dl class="message-properties">
<dt class="optional">msg.payload <span class="property-type">object</span></dt>
<dd>Array of json objects containing forecast data elements</dd>
<dd>riskLevel:<br /> 0 = very low risk<br /> 1 = low risk<br /> 2 = medium risk<br /> 3 = high risk<br /> 4 = very high risk</dd>
<dd>expirationTimeUtc: Time the riskLevel prediction becomes outdated</dd>
<dd>validTimeUtc: Time the riskLevel prediction was generated in epoch format</dd>
<dt class="optional">msg.twcparams <span class="property-type">object</span></dt>
<dd>Array of json objects containing request parameters</dd>
</dl>
</script>