node-red-contrib-snap4city-user
Version:
Nodes for Snap4city project, targeted to standard user (no developer)
1,412 lines (1,290 loc) • 43 kB
HTML
<!--
Copyright 2016 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
//////////////////////////////////////////////////// // ORION CONTEXT BROKER SERVICE CONFIG NODE
////////////////////////////////////////////////////
<script type="text/x-red" data-template-name="orion-service">
<div class="form-row">
<label for="node-config-input-url">
<i class="fa fa-cloud"></i> Broker URI</label>
<input type="text" id="node-config-input-url">
</div>
<div class="form-row">
<label for="node-config-input-port">
<i class="fa fa-globe"></i>
<span>Port</span>
</label>
<input type="text" id="node-config-input-port" style="width: 50px">
</div>
<!-- <div class="form-row">
<label> </label>
<input type="checkbox" id="node-config-input-useAuth" style="display: inline-block; width: auto; vertical-align: top;">
<label style="width: 70%;"><span>Authorization required</span></label>
</div>
<div class="form-row node-config-input-useAuth-row">
<label for="node-config-input-user"><i class="fa fa-user"></i> <span>key 1</span></label>
<input type="text" id="node-config-input-user">
</div>
<div class="form-row node-config-input-useAuth-row">
<label for="node-config-input-password"><i class="fa fa-lock"></i> <span>key 2</span></label>
<input type="password" id="node-config-input-password">
</div>-->
<div class="form-row">
<label for="node-config-input-name">
<i class="fa fa-tag"></i>
<span data-i18n="node-red:common.label.name"></span>
</label>
<input type="text" id="node-config-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
</script>
//////////////////////////////////////////////////// // ORION CONTEXT BROKER SUBSCRIBE NODE
////////////////////////////////////////////////////
<script type="text/x-red" data-template-name="fiware orion in">
<div class="form-row" id="rowAuthentication">
<label for="node-input-authentication">Authentication</label>
<input type="text" id="node-input-authentication">
</div>
<div class="form-tips" id="tipAuthentication" style="margin-bottom: 10px;">
If you have private data and you want to access them, you can insert you account data. You can register for one account
<a href="https://www.snap4city.org"
target="_blank">here</a>.
</div>
<div class="form-row">
<label for="node-input-service">
<i class="fa fa-cloud"></i> Service</label>
<input type="text" id="node-input-service">
</div>
<div class="form-row">
<label for="node-input-tls">
<i class="fa fa-cloud"></i> Certificates</label>
<input type="text" id="node-input-tls">
</div>
<div class="form-row">
<label for="node-input-entype">
<i class="fa fa-globe"></i>
<span>Device Type</span>
</label>
<input type="text" id="node-input-entype">
</div>
<div class="form-row">
<label for="node-input-enid">
<i class="fa fa-globe"></i>
<span>Device Identifier</span>
</label>
<input type="text" id="node-input-enid">
</div>
<div class="form-row">
<label for="node-input-userk1">
<i class="fa fa-globe"></i>
<span>key 1</span>
</label>
<input type="text" id="node-input-userk1">
</div>
<div class="form-row">
<label for="node-input-passk2">
<i class="fa fa-globe"></i>
<span>key 2</span>
</label>
<input type="text" id="node-input-passk2">
</div>
<div class="form-row">
<label for="node-input-tenant">
<i class="fa fa-globe"></i>
<span>Service/Tenant</span>
</label>
<input type="text" id="node-input-tenant">
</div>
<div class="form-row">
<label for="node-input-servicepath">
<i class="fa fa-globe"></i>
<span>Service Path</span>
</label>
<input type="text" id="node-input-servicepath">
</div>
<div class="form-row">
<label for="node-input-apikey">
<i class="fa fa-globe"></i>
<span>apikey</span>
</label>
<input type="text" id="node-input-apikey">
</div>
<div class="form-row">
<label for="node-input-basicAuth">
<i class="fa fa-globe"></i>
<span>auth</span>
</label>
<input type="text" id="node-input-basicAuth">
</div>
<div class="form-row">
<label> </label>
<input type="checkbox" id="node-input-ispattern" style="display: inline-block; width: auto; vertical-align: top;">
<label style="width: 70%;">
<span>is pattern</span>
</label>
</div>
<div class="form-row">
<label for="node-input-attributes">
<i class="fa fa-globe"></i>
<span>attributes</span>
</label>
<input type="text" id="node-input-attributes" placeholder="comma-separated values, leave empty for all atributes">
</div>
<div class="form-row">
<label for="node-input-condvalues">
<i class="fa fa-globe"></i>
<span>cond. values</span>
</label>
<input type="text" id="node-input-condvalues" placeholder="comma-separated condition values, leave empty for all">
</div>
<div class="form-row">
<label> </label>
<input type="checkbox" id="node-input-includeattr" style="display: inline-block; width: auto; vertical-align: top;">
<label style="width: 70%;">
<span>include attributes metadata in output</span>
</label>
</div>
<div class="form-row">
<label for="node-input-throttle">
<i class="fa fa-tasks"></i>
<span>throttle</span>
</label>
<select type="text" id="node-input-throttle" style="width:52%;">
<option value="PT1S">PT1S</option>
<option value="PT5S">PT5S</option>
<option value="PT10S">PT10S</option>
<option value="PT30S">PT30S</option>
<option value="PT1M">PT1M</option>
<option value="PT5M">PT5M</option>
</select>
</div>
<div class="form-row">
<label for="node-input-duration">
<i class="fa fa-tasks"></i>
<span>duration</span>
</label>
<select type="text" id="node-input-duration" style="width:52%;">
<option value="P1D">P1D</option>
<option value="P1W">P1W</option>
<option value="P1M">P1M</option>
<option value="P3M">P3M</option>
<option value="P6M">P6M</option>
<option value="P1Y">P1Y</option>
<option value="P2Y">P2Y</option>
<option value="P3Y">P3Y</option>
</select>
</div>
<div class="form-row">
<label> </label>
<input type="checkbox" id="node-input-noderedhostauto" style="display: inline-block; width: auto; vertical-align: top;">
<label style="width: 70%;">
<span>Find node-red routable hostname automatically</span>
</label>
</div>
<div class="form-row node-input-noderedhost-row">
<label for="node-input-noderedhost">
<i class="fa fa-lock"></i>
<span>node-red hostname</span>
</label>
<input type="text" id="node-input-noderedhost">
</div>
<div class="form-row">
<label for="node-input-name">
<i class="fa fa-tag"></i>
<span>name</span>
</label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<div class="form-tips" id="tip-json" hidden>
<span data-i18n="httpin.tip.req"></span>
</div>
</script>
////////////////////////////////////////////////////// //ORION CONTEXT BROKER QUERY NODE //
//////////////////////////////////////////////////////
<script type="text/x-red" data-template-name="fiware orion">
<div class="form-row" id="rowAuthentication">
<label for="node-input-authentication">Authentication</label>
<input type="text" id="node-input-authentication">
</div>
<div class="form-tips" id="tipAuthentication" style="margin-bottom: 10px;">
If you have private data and you want to access them, you can insert you account data. You can register for one account
<a href="https://www.snap4city.org"
target="_blank">here</a>.
</div>
<div class="form-row">
<label for="node-input-service">
<i class="fa fa-cloud"></i> Service</label>
<input type="text" id="node-input-service">
</div>
<div class="form-row">
<label for="node-input-tls">
<i class="fa fa-cloud"></i> Certificates</label>
<input type="text" id="node-input-tls">
</div>
<div class="form-row">
<label for="node-input-entype">
<i class="fa fa-globe"></i>
<span>Device Type</span>
</label>
<input type="text" id="node-input-entype">
</div>
<div class="form-row">
<label for="node-input-enid">
<i class="fa fa-globe"></i>
<span>Device Identifier</span>
</label>
<input type="text" id="node-input-enid">
</div>
<div class="form-row">
<label for="node-input-userk1">
<i class="fa fa-globe"></i>
<span>key 1</span>
</label>
<input type="text" id="node-input-userk1">
</div>
<div class="form-row">
<label for="node-input-passk2">
<i class="fa fa-globe"></i>
<span>key 2</span>
</label>
<input type="text" id="node-input-passk2">
</div>
<div class="form-row">
<label for="node-input-tenant">
<i class="fa fa-globe"></i>
<span>Service/Tenant</span>
</label>
<input type="text" id="node-input-tenant">
</div>
<div class="form-row">
<label for="node-input-servicepath">
<i class="fa fa-globe"></i>
<span>Service Path</span>
</label>
<input type="text" id="node-input-servicepath">
</div>
<div class="form-row">
<label for="node-input-apikey">
<i class="fa fa-globe"></i>
<span>apikey</span>
</label>
<input type="text" id="node-input-apikey">
</div>
<div class="form-row">
<label for="node-input-basicAuth">
<i class="fa fa-globe"></i>
<span>auth</span>
</label>
<input type="text" id="node-input-basicAuth">
</div>
<div class="form-row">
<label for="node-input-attributes">
<i class="fa fa-globe"></i>
<span>Attributes</span>
</label>
<input type="text" id="node-input-attributes" placeholder="comma-separated values, leave empty for all atributes">
</div>
<div class="form-row">
<label> </label>
<input type="checkbox" id="node-input-useFiltering" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-useFiltering" style="width: 70%;">
<span>Use filtering?</span>
</label>
</div>
<div class="form-row node-input-rtype-row">
<label for="node-input-rtype">
<i class="fa fa-tasks"></i>
<span>Filter type</span>
</label>
<select type="text" id="node-input-rtype" style="width:52%;">
<option value="FIWARE::StringQuery">StringQuery</option>
<option value="FIWARE::Filter::Existence">Existence</option>
<option value="FIWARE::Filter::Not::Existence">Not Existence</option>
</select>
</div>
<div class="form-row node-input-rvalue-row">
<label for="node-input-rvalue">
<i class="fa fa-globe"></i>
<span>Restriction value</span>
</label>
<input type="text" id="node-input-rvalue" placeholder="Restriction scope value">
</div>
<div class="form-row">
<label for="node-input-limit">
<i class="fa fa-globe"></i>
<span>Limit</span>
</label>
<input type="text" id="node-input-limit" placeholder="Results limit">
</div>
<div class="form-row">
<label> </label>
<input type="checkbox" id="node-input-includeattr" style="display: inline-block; width: auto; vertical-align: top;">
<label style="width: 70%;">
<span>include attributes metadata in output</span>
</label>
</div>
<div class="form-row">
<label for="node-input-name">
<i class="fa fa-tag"></i>
<span>Name</span>
</label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<div class="form-tips" id="tip-json" hidden>
<span data-i18n="httpin.tip.req"></span>
</div>
</script>
////////////////////////////////////////////////////// //SIMPLE ORION CONTEXT BROKER UPDATE NODE //
//////////////////////////////////////////////////////////////////////////
<script type="text/x-red" data-template-name="orion-test">
<div class="form-row" id="rowAuthentication">
<label for="node-input-authentication">Authentication</label>
<input type="text" id="node-input-authentication">
</div>
<div class="form-tips" id="tipAuthentication" style="margin-bottom: 10px;">
If you have private data and you want to access them, you can insert you account data. You can register for one account
<a href="https://www.snap4city.org"
target="_blank">here</a>.
</div>
<div class="form-row">
<label for="node-input-service">
<i class="fa fa-cloud"></i> Service</label>
<input type="text" id="node-input-service">
</div>
<div class="form-row">
<label for="node-input-tls">
<i class="fa fa-cloud"></i> Certificates</label>
<input type="text" id="node-input-tls">
</div>
<div class="form-row">
<label for="node-input-entype">
<i class="fa fa-globe"></i>
<span>Device Type</span>
</label>
<input type="text" id="node-input-entype">
</div>
<div class="form-row">
<label for="node-input-enid">
<i class="fa fa-globe"></i>
<span>Device Identifier</span>
</label>
<input type="text" id="node-input-enid">
</div>
<div class="form-row">
<label for="node-input-userk1">
<i class="fa fa-globe"></i>
<span>key 1</span>
</label>
<input type="text" id="node-input-userk1">
</div>
<div class="form-row">
<label for="node-input-passk2">
<i class="fa fa-globe"></i>
<span>key 2</span>
</label>
<input type="text" id="node-input-passk2">
</div>
<div class="form-row">
<label for="node-input-tenant">
<i class="fa fa-globe"></i>
<span>Service/Tenant</span>
</label>
<input type="text" id="node-input-tenant">
</div>
<div class="form-row">
<label for="node-input-servicepath">
<i class="fa fa-globe"></i>
<span>Service Path</span>
</label>
<input type="text" id="node-input-servicepath">
</div>
<div class="form-row">
<label for="node-input-apikey">
<i class="fa fa-globe"></i>
<span>apikey</span>
</label>
<input type="text" id="node-input-apikey">
</div>
<div class="form-row">
<label for="node-input-basicAuth">
<i class="fa fa-globe"></i>
<span>auth</span>
</label>
<input type="text" id="node-input-basicAuth">
</div>
<div class="form-row">
<label for="node-input-attrkey">
<i class="fa fa-globe"></i>
<span>Attribute key</span>
</label>
<input type="text" id="node-input-attrkey">
</div>
<div class="form-row">
<label for="node-input-attrvalue">
<i class="fa fa-globe"></i>
<span>Attribute value</span>
</label>
<input type="text" id="node-input-attrvalue">
</div>
<div class="form-row">
<label for="node-input-name">
<i class="fa fa-tag"></i>
<span>Name</span>
</label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<div class="form-tips" id="tip-json" hidden>
<span data-i18n="httpin.tip.req"></span>
</div>
</script>
<script type="text/x-red" data-template-name="fiware-orion-out">
<div class="form-row" id="rowAuthentication">
<label for="node-input-authentication">Authentication</label>
<input type="text" id="node-input-authentication">
</div>
<div class="form-tips" id="tipAuthentication" style="margin-bottom: 10px;">
If you have private data and you want to access them, you can insert you account data. You can register for one account
<a href="https://www.snap4city.org"
target="_blank">here</a>.
</div>
<div class="form-row">
<label for="node-input-service">
<i class="fa fa-cloud"></i> Service</label>
<input type="text" id="node-input-service">
</div>
<div class="form-row">
<label for="node-input-tls">
<i class="fa fa-cloud"></i> Certificates</label>
<input type="text" id="node-input-tls">
</div>
<div class="form-row">
<label for="node-input-entype">
<i class="fa fa-globe"></i>
<span>Device Type</span>
</label>
<input type="text" id="node-input-entype">
</div>
<div class="form-row">
<label for="node-input-enid">
<i class="fa fa-globe"></i>
<span>Device Identifier</span>
</label>
<input type="text" id="node-input-enid">
</div>
<div class="form-row">
<label for="node-input-userk1">
<i class="fa fa-globe"></i>
<span>key 1</span>
</label>
<input type="text" id="node-input-userk1">
</div>
<div class="form-row">
<label for="node-input-passk2">
<i class="fa fa-globe"></i>
<span>key 2</span>
</label>
<input type="text" id="node-input-passk2">
</div>
<div class="form-row">
<label for="node-input-tenant">
<i class="fa fa-globe"></i>
<span>Service/Tenant</span>
</label>
<input type="text" id="node-input-tenant">
</div>
<div class="form-row">
<label for="node-input-servicepath">
<i class="fa fa-globe"></i>
<span>Service Path</span>
</label>
<input type="text" id="node-input-servicepath">
</div>
<div class="form-row">
<label for="node-input-apikey">
<i class="fa fa-globe"></i>
<span>apikey</span>
</label>
<input type="text" id="node-input-apikey">
</div>
<div class="form-row">
<label for="node-input-basicAuth">
<i class="fa fa-globe"></i>
<span>auth</span>
</label>
<input type="text" id="node-input-basicAuth">
</div>
<div class="form-row">
<label for="node-input-name">
<i class="fa fa-tag"></i>
<span>Name</span>
</label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<div class="form-tips" id="tip-json" hidden>
<span data-i18n="httpin.tip.req"></span>
</div>
</script>
<!-- Orion Out -->
<script type="text/x-red" data-help-name="fiware-orion-out">
<p>Provides a node for sending generic json payload to Fiware Orion context broker.</p>
<h3>Configuration</h3>
<dl class="message-properties">
<dt>Authentication (only available on edge scenario)</dt>
<dd>Configuration options for Snap4city Authentication (optional)
</dd>
<dt>Service</dt>
<dd>The URL and port of the Fiware Orion context broker (<b>mandatory</b>).
The URL should not contains any prefix for http/https and any port information (valid example are: 192.168.1.10 or www.example.it or orionUNIFI)
</dd>
<dt>Certificates</dt>
<dd>Configuration for TLS connections (optional). If "verify server certificate" is selected, the CA certificate is <b>mandatory</b>
</dd>
<dt>Device Type
<span class="property-type">string</span>
</dt>
<dd>Context element entity type (optional)</dd>
<dt>Device Identifier
<span class="property-type">string</span>
</dt>
<dd>Context element entity id (optional)</dd>
<dt>key 1
<span class="property-type">string</span>
</dt>
<dd>K1 credential to be specified for context broker secured via Snap4City-OrionFilter (optional). It can be passed in <code>msg.auth.k1</code>
(see example below)</dd>
<dt>key 2
<span class="property-type">string</span>
</dt>
<dd>K2 credential to be specified for context broker secured via Snap4City-OrionFilter (optional). It can be passed in <code>msg.auth.k2</code> (see example below)</dd>
<dt>Service/Tenant
<span class="property-type">string</span>
</dt>
<dd>Tenant of the Device to be specified if the context broker support Multi-Tenancy (optional)</dd>
<dt>Service Path
<span class="property-type">string</span>
</dt>
<dd>Service Path of the Device to be specified if the context broker support Multi-Tenancy/Service Path hierarchy (optional)</dd>
<dt>apikey
<span class="property-type">string</span>
</dt>
<dd>Credential to be specified for context broker secured via HTTP Header "apikey:<credential>" (optional). It can be passed in <code>msg.auth.apikey</code> (see example below)</dd>
<dt>auth
<span class="property-type">string</span>
</dt>
<dd>Credential to be specified for context broker secured via HTTP Header "Authorization: <credential>" (optional). It can be passed in <code>msg.auth.basicAuth</code> (see example below)
If this parameter is not specified, the Snap4City SSo AccessToken will be used (based on (cloud scenario)
the logged user credentials or (edge scenario) the specified username/password) in the form of "Authorization: Bearer <credential>"</dd>
<dt>name
<span class="property-type">string</span>
</dt>
<dd>Label assigned to the current node (optional)</dd>
</dl>
<h3>Inputs</h3>
<dl class="message-properties">
A JSON representing the payload to send to the Fiware Orion context broker. Can be:
<ul>
<li>the complete contextElements (not an array):
<code>
msg.payload = { "id": "angelo-mydevice001", "type": "test-device", "attributes": [{ "name": "temperatura", "value": "8", "type": "float" }] };
</code></br>
NOTE: if msg.payload.type and msg.payload.id are not present, the "Device Type" and "Device Identifier" has to be specified in the Configuration section (<b>mandatory</b>)</li>
<li>the simple attributes (an array)
<code>
msg.payload = [{ "name": "temperatura", "value": "12", "type": "float" }];
</code></br>
NOTE: the "Device Type" and "Device Identifier" has to be specified in the Configuration section (<b>mandatory</b>)</li>
</ul>
An optional JSON representing the set of Credentials (used just if not specified in UI)
<code>
msg.auth={"k1": "1ef0e5e8-bf0c-48d4-9462-0aa4cfcf5e19","k2": "b2b34425-9d97-4fc5-818d-2d6cac2314a6","apikey":"apikey","basicAuth": "basicAuthKey"};
</code>
</dl>
<h3>Details</h3>
<dl class="message-properties">
<p>The node receive a JSON as described in the Inputs section and send a message to the Fiware Broker context broker based on the specified Configuration.
If the values are not present in the input JSON an error is generated.</p>
</dl>
</script>
<script type="text/x-red" data-help-name="orion-service"></script>
<!-- Update -->
<script type="text/x-red" data-help-name="orion-test">
<p>Provides a node for sending specific data to Fiware Orion context broker.</p>
<h3>Configuration</h3>
<dl class="message-properties">
<dt>Authentication (only available on edge scenario)</dt>
<dd>Configuration options for Snap4city Authentication (optional)</dd>
<dt>Service</dt>
<dd>The URL and port of the Fiware Orion context broker (<b>mandatory</b>).
The URL should not contains any prefix for http/https and any port information (valid example are: 192.168.1.10 or www.example.it or orionUNIFI)
</dd>
<dt>Certificates</dt>
<dd>Configuration for TLS connections (optional). If "verify server certificate" is selected, the CA certificate is <b>mandatory</b>
</dd>
<dt>Device Type
<span class="property-type">string</span>
</dt>
<dd>Context element entity type (<b>mandatory</b>)</dd>
<dt>Device Identifier
<span class="property-type">string</span>
</dt>
<dd>Context element entity id (<b>mandatory</b>)</dd>
<dt>key 1
<span class="property-type">string</span>
</dt>
<dd>K1 credential to be specified for context broker secured via Snap4City-OrionFilter (optional). It can be passed in <code>msg.auth.k1</code></dd>
<dt>key 2
<span class="property-type">string</span>
</dt>
<dd>K2 credential to be specified for context broker secured via Snap4City-OrionFilter (optional). It can be passed in <code>msg.auth.k2</code></dd>
<dt>Service/Tenant
<span class="property-type">string</span>
</dt>
<dd>Tenant of the Device to be specified if the context broker support Multi-Tenancy (optional)</dd>
<dt>Service Path
<span class="property-type">string</span>
</dt>
<dd>Service Path of the Device to be specified if the context broker support Multi-Tenancy/Service Path hierarchy (optional)</dd>
<dt>apikey
<span class="property-type">string</span>
</dt>
<dd>Credential to be specified for context broker secured via HTTP Header "apikey:<credential>" (optional). It can be passed in <code>msg.auth.apikey</code></dd>
<dt>auth
<span class="property-type">string</span>
</dt>
<dd>Credential to be specified for context broker secured via HTTP Header "Authorization: <credential>" (optional). . It can be passed in <code>msg.auth.basicAuth</code>
If this parameter is not specified, the Snap4City SSo AccessToken will be used (based on (cloud scenario) the logged user credentials or (edge scenario) the specified username/password) in the form of "Authorization: Bearer <credential>"</dd>
<dt>Attribute key
<span class="property-type">string</span>
</dt>
<dd>name of the sensor to update (<b>mandatory</b>)</dd>
<dt>Attribute key
<span class="property-type">string</span>
</dt>
<dd>new value of the sensor to update (<b>mandatory</b>)</dd>
<dt>name
<span class="property-type">string</span>
</dt>
<dd>Label assigned to the current node (optional)</dd>
</dl>
<h3>Output</h3>
<dl class="message-properties">
The output message contains the following properties:
<ul>
<li>
<code>payload</code> is the body of the response containing list of requested elements</li>
<li>
<code>statusCode</code> is the status code of the response, or the error code if the request could not be completed</li>
</ul>
</dl>
</script>
<!-- Subscribe -->
<script type="text/x-red" data-help-name="fiware orion in">
<p>Provides a node for subscribing on Fiware Orion context broker and listening changes.</p>
<h3>Configuration</h3>
<dl class="message-properties">
<dt>Authentication (only available on edge scenario)</dt>
<dd>Configuration options for Snap4city Authentication (optional)</dd>
<dt>Service</dt>
<dd>The URL and port of the Fiware Orion context broker (<b>mandatory</b>).
The URL should not contains any prefix for http/https and any port information (valid example are: 192.168.1.10 or www.example.it or orionUNIFI).
</dd>
<dt>Certificates</dt>
<dd>Configuration for TLS connections (optional). If "verify server certificate" is selected, the CA certificate is <b>mandatory</b>.
</dd>
<dt>Device Type
<span class="property-type">string</span>
</dt>
<dd>Context element entity type (<b>mandatory</b>)</dd>
<dt>Device Identifier
<span class="property-type">string</span>
</dt>
<dd>Context element entity id (<b>mandatory</b>)</dd>
<dt>key 1
<span class="property-type">string</span>
</dt>
<dd>K1 credential to be specified for context broker secured via Snap4City-OrionFilter (optional)</dd>
<dt>key 2
<span class="property-type">string</span>
</dt>
<dd>K2 credential to be specified for context broker secured via Snap4City-OrionFilter (optional)</dd>
<dt>Service/Tenant
<span class="property-type">string</span>
</dt>
<dd>Tenant of the Device to be specified if the context broker support Multi-Tenancy (optional)</dd>
<dt>Service Path
<span class="property-type">string</span>
</dt>
<dd>Service Path of the Device to be specified if the context broker support Multi-Tenancy/Service Path hierarchy (optional)</dd>
<dt>apikey
<span class="property-type">string</span>
</dt>
<dd>Credential to be specified for context broker secured via HTTP Header "apikey:<credential>" (optional)</dd>
<dt>auth
<span class="property-type">string</span>
</dt>
<dd>Credential to be specified for context broker secured via HTTP Header "Authorization: <credential>" (optional).
If this parameter is not specified, the Snap4City SSo AccessToken will be used (based on (cloud scenario) the logged user credentials or (edge scenario) the specified username/password) in the form of "Authorization: Bearer <credential>"</dd>
<dt>is pattern
<span class="property-type">boolean</span>
</dt>
<dd>Specify whether entity ID is pattern, default is false (optional)</dd>
<dt>attributes
<span class="property-type">string</span>
</dt>
<dd>a comma separated list of context element attributes to be filtered and returned. If not specified, will return all (optional)</dd>
<dt>condvalues
<span class="property-type">string</span>
</dt>
<dd>the "triggering attributes" (attributes that upon change due to Update context elements trigger the notification) (optional)</dd>
<dt>includeattr
<span class="property-type">string</span>
</dt>
<dd>include all element attributes in the output, default is true (optional)</code>
<dt>throttle
<span class="property-type">multiple choice</span>
</dt>
<dd>used to specify a minimum inter-notification arrival time, default value 5 seconds (<b>mandatory</b>)</dd>
<dt>duration
<span class="property-type">multiple choice</span>
</dt>
<dd>time until subscription will expire (<b>mandatory</b>)</dd>
<dt>Find node-red routable hostname automatically
<span class="property-type">boolean</span>
</dt>
<dd>Automatic route the hostname (optional)</dd>
<dt>node-red hostname
<span class="property-type">string</span>
</dt>
<dd>name of the host this nodered is reacheable (optional)</dd>
<dt>name
<span class="property-type">string</span>
</dt>
<dd>Label assigned to the current node (optional)</dd>
</dl>
<h3>Output</h3>
<dl class="message-properties">
The output message contains the following properties:
<ul>
<li>
<code>payload</code> is the body of the response containing list of requested elements</li>
<li>
<code>statusCode</code> is the status code of the response, or the error code if the request could not be completed</li>
</ul>
</dl>
</script>
<!-- Query -->
<script type="text/x-red" data-help-name="fiware orion">
<p>Provides a node for making requests to Fiware Orion context broker.</p>
<h3>Configuration</h3>
<dl class="message-properties">
<dt>Authentication (only available on edge scenario)</dt>
<dd>Configuration options for Snap4city Authentication (optional)</dd>
<dt>Service</dt>
<dd>The URL and port of the Fiware Orion context broker (<b>mandatory</b>).
The URL should not contains any prefix for http/https and any port information (valid example are: 192.168.1.10 or www.example.it or orionUNIFI)</code>
</dd>
<dt>Certificates</dt>
<dd>Configuration for TLS connections (optional). If "verify server certificate" is selected, the CA certificate is <b>mandatory</b>
</dd>
<dt>Device Type
<span class="property-type">string</span>
</dt>
<dd>Context element entity type (<b>mandatory</b>). It can be passed in <code>msg.enid</code></dd>
<dt>Device Identifier
<span class="property-type">string</span>
</dt>
<dd>Context element entity id (optional). It can be passed in <code>msg.entype</code></dd>
<dt>key 1
<span class="property-type">string</span>
</dt>
<dd>K1 credential to be specified for context broker secured via Snap4City-OrionFilter (optional). It can be passed in <code>msg.userk1</code></dd>
<dt>key 2
<span class="property-type">string</span>
</dt>
<dd>K2 credential to be specified for context broker secured via Snap4City-OrionFilter (optional). It can be passed in <code>msg.passk2</code></dd>
<dt>Service/Tenant
<span class="property-type">string</span>
</dt>
<dd>Tenant of the Device to be specified if the context broker support Multi-Tenancy (optional). It can be passed in <code>msg.tenant</code></dd>
<dt>Service Path
<span class="property-type">string</span>
</dt>
<dd>Service Path of the Device to be specified if the context broker support Multi-Tenancy/Service Path hierarchy (optional).It can be passed in <code>msg.servicepath</code></dd>
<dt>apikey
<span class="property-type">string</span>
</dt>
<dd>Credential to be specified for context broker secured via HTTP Header "apikey:<credential>" (optional). It can be passed in <code>msg.apikey</code></dd>
<dt>auth
<span class="property-type">string</span>
</dt>
<dd>Credential to be specified for context broker secured via HTTP Header "Authorization: <credential>" (optional). It can be passed in <code>msg.basicAuth</code>
If this parameter is not specified, the Snap4City SSo AccessToken will be used (based on (cloud scenario) the logged user credentials or (edge scenario) the specified username/password) in the form of "Authorization: Bearer <credential>"</dd>
<dt>attributes</dt>
<dd>a comma separated list of context element attributes to be filtered and returned. If not specified, will return all elements (optional)</dd>
<dt>limit
<span class="property-type">integer</span>
</dt>
<dd>limit number of returned elements (optional). It can be passed in <code>msg.limit</code></dd>
<dt>name
<span class="property-type">string</span>
</dt>
<dd>Label assigned to the current node (optional)</dd>
</dl>
<h3>Inputs</h3>
<dl class="message-properties">
A JSON representing the Configuration. Can be:
<code>
msg = {"enid" : "angelo-mydevice001","entype": "test-device"};
</code>
</dl>
<h3>Details</h3>
<dl class="message-properties">
<p>The node (optionally) can receive a JSON as described in the Inputs section and send a query message to the Fiware Broker context broker based on the specified Configuration.
The Configuration specified in the Input JSON are considered just if <i>not</i> insert the UI</p>
</dl>
<h3>Output</h3>
<dl class="message-properties">
The output message contains the following properties:
<ul>
<li>
<code>payload</code> is the body of the response containing list of requested elements</li>
<li>
<code>statusCode</code> is the status code of the response, or the error code if the request could not be completed</li>
</ul>
</dl>
</script>
<script type="text/javascript">
(function () {
RED.nodes.registerType('orion-service', {
category: 'config',
defaults: {
name: {
value: ""
},
authentication: {
type: "snap4city-authentication",
required: false
},
url: {
required: true
},
port: {
validate: RED.validators.number(),
required: true
}
},
credentials: {
user: {
type: "text",
required: false
},
password: {
type: "password",
required: false
}
},
label: function () {
return this.name || this.namespace || "Orion Service";
},
oneditprepare: function () {
if (this.credentials.user || this.credentials.password) {
$('#node-config-input-useAuth').prop('checked', true);
$(".node-config-input-useAuth-row").show();
} else {
$('#node-config-input-useAuth').prop('checked', false);
$(".node-config-input-useAuth-row").hide();
$('#node-config-input-user').val('');
$('#node-config-input-password').val('');
}
$("#node-config-input-useAuth").change(function () {
if ($(this).is(":checked")) {
$('#node-config-input-user').val('');
$('#node-config-input-password').val('');
$(".node-config-input-useAuth-row").show();
} else {
$('#node-config-input-user').val('');
$('#node-config-input-password').val('');
$(".node-config-input-useAuth-row").hide();
}
});
},
oneditsave: function () {
if ($("#node-config-input-useAuth").is(":checked")) {
$(".node-config-input-useAuth-row").show();
} else {
$(".node-config-input-useAuth-row").hide();
$('#node-config-input-user').val('');
$('#node-config-input-password').val('');
}
}
});
RED.nodes.registerType('fiware orion in', {
category: 'S4CIoT',
color: "rgb(231, 231, 174)",
defaults: {
name: {
value: ""
},
authentication: {
type: "snap4city-authentication",
required: false
},
service: {
type: "orion-service",
required: true
},
tls: {
type: "tls-config",
required: false
},
throttle: {
value: "PT5S"
},
entype: {
value: ""
},
enid: {
value: ""
},
userk1: {
value: ""
},
passk2: {
value: ""
},
tenant: {
value: ""
},
servicepath: {
value: ""
},
apikey: {
value: ""
},
basicAuth: {
value: ""
},
ispattern: {
value: false
},
duration: {
value: "P1Y"
},
attributes: {
value: ""
},
condvalues: {
value: ""
},
includeattr: {
value: true
},
noderedhost: {
value: ""
},
noderedhostauto: {
value: true
}
},
inputs: 0,
outputs: 1,
icon: "orioncb.png",
label: function () {
if (this.name) {
return this.name;
} else {
return "fiware orion subscribe v1";
}
},
paletteLabel: function () {
if (this.name) {
return this.name;
} else {
return "fiware orion subscribe v1";
}
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
},
oneditprepare: function () {
if (this.credentials.includeattr) {
$('#node-input-includeattr').prop('checked', true);
}
$("#node-input-noderedhostauto").change(function () {
if ($(this).is(":checked")) {
$(".node-input-noderedhost-row").hide();
$('#node-input-noderedhost').val('');
} else {
$(".node-input-noderedhost-row").show();
}
});
},
oneditresize: function () {
$("#node-input-authentication option[value='_ADD_']").remove();
},
});
RED.nodes.registerType('fiware orion', {
category: 'S4CIoT',
color: "rgb(231, 231, 174)",
defaults: {
name: {
value: ""
},
authentication: {
type: "snap4city-authentication",
required: false
},
service: {
type: "orion-service",
required: true
},
tls: {
type: "tls-config",
required: false
},
entype: {
value: ""
},
enid: {
value: ".*"
},
userk1: {
value: ""
},
passk2: {
value: ""
},
tenant: {
value: ""
},
servicepath: {
value: ""
},
apikey: {
value: ""
},
basicAuth: {
value: ""
},
attributes: {
value: ""
},
rtype: {
value: ""
},
rvalue: {
value: ""
},
limit: {
value: 20,
validate: RED.validators.number()
},
includeattr: {
value: true
}
},
inputs: 1,
outputs: 1,
icon: "orioncb.png",
label: function () {
return this.name || "fiware orion query v1";
},
paletteLabel: function () {
if (this.name) {
return this.name;
} else {
return "fiware orion query v1";
}
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
},
oneditprepare: function () {
if (this.rtype || this.rvalue) {
$('#node-input-useFiltering').prop('checked', true);
$(".node-input-rtype-row").show();
if ($('#node-input-rtype').val() !== 'FIWARE::StringQuery') {
$(".node-input-rvalue-row").hide();
} else {
$(".node-input-rvalue-row").show();
}
} else {
$('#node-input-useFiltering').prop('checked', false);
$(".node-input-rtype-row").hide();
$(".node-input-rvalue-row").hide();
$('#node-input-rtype').val('');
$('#node-input-rvalue').val('');
}
if (this.credentials.includeattr) {
$('#node-input-includeattr').prop('checked', true);
}
$("#node-input-useFiltering").change(function () {
if ($(this).is(":checked")) {
$('#node-input-rtype').val('FIWARE::StringQuery');
$(".node-input-rtype-row").show();
$('#node-input-rvalue').val('');
$(".node-input-rvalue-row").show();
} else {
$(".node-input-rtype-row").hide();
$(".node-input-rvalue-row").hide();
$('#node-input-rtype').val('');
$('#node-input-rvalue').val('');
}
});
$("#node-input-rtype").change(function () {
if ($('#node-input-rtype').val() === "FIWARE::StringQuery") {
$(".node-input-rvalue-row").show();
} else {
$(".node-input-rvalue").val('');
$(".node-input-rvalue-row").hide();
}
});
},
oneditresize: function () {
$("#node-input-authentication option[value='_ADD_']").remove();
},
});
RED.nodes.registerType('orion-test', {
category: 'S4CIoT',
color: "rgb(231, 231, 174)",
defaults: {
name: {
value: ""
},
authentication: {
type: "snap4city-authentication",
required: false
},
service: {
type: "orion-service",
required: true
},
tls: {
type: "tls-config",
required: false
},
entype: {
value: ""
},
enid: {
value: ""
},
userk1: {
value: ""
},
passk2: {
value: ""
},
tenant: {
value: ""
},
servicepath: {
value: ""
},
apikey: {
value: ""
},
basicAuth: {
value: ""
},
attrkey: {
value: ""
},
attrvalue: {
value: ""
}
},
inputs: 1,
outputs: 1,
icon: "orioncb.png",
oneditresize: function () {
$("#node-input-authentication option[value='_ADD_']").remove();
},
label: function () {
return this.name || "fiware orion update v1";
},
paletteLabel: function () {
if (this.name) {
return this.name;
} else {
return "fiware orion update v1";
}
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
}
});
RED.nodes.registerType('fiware-orion-out', {
category: 'S4CIoT',
color: "rgb(42, 231, 42)",
defaults: {
name: {
value: ""
},
authentication: {
type: "snap4city-authentication",
required: false
},
tls: {
type: "tls-config",
required: false
},
service: {
type: "orion-service",
required: true
},
entype: {
value: ""
},
enid: {
value: ""
},
userk1: {
value: ""
},
passk2: {
value: ""
},
tenant: {
value: ""
},
servicepath: {
value: ""
},
apikey: {
value: ""
},
basicAuth: {
value: ""
}
},
inputs: 1,
outputs: 0,
icon: "orioncb.png",
oneditresize: function () {
$("#node-input-authentication option[value='_ADD_']").remove();
},
label: function () {
return this.name || "fiware orion out v1";
},
paletteLabel: function () {
if (this.name) {
return this.name;
} else {
return "fiware orion out v1";
}
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
}
});
})();
</script>