node-red-contrib-ocpp
Version:
A set of nodes to communicate via OCPP to a compatible charge box or central system
169 lines (149 loc) • 6.65 kB
HTML
<style>
.header {
text-decoration: underline;
font-weight: bold;
margin-top: 5px;
}
.bordered {
padding-left: 12px;
padding-top: 4px;
border: 1px solid lightgrey;
box-sizing: border-box;
}
</style>
<script type="text/javascript">
RED.nodes.registerType('CS request SOAP', {
category: 'OCPP',
color: '#3FADB5',
defaults: {
name: {value: "", required: false},
remotecb: {value: "", type: "ocpp-remote-cp"},
command: { value: "", required: false},
cmddata: { value: "", required: false},
log: { value: false, required: true },
pathlog: {value: "", required: false}
},
inputs: 1,
outputs: 1,
icon: "file.jpg",
label: function() {
if (this.remotecb)
return this.name||RED.nodes.node(this.remotecb).label();
else
return this.name||"OCPP CS SOAP Request";
},
oneditprepare: function() {
var cblist = [
{
cb: "#node-input-log",
cont: "#containerlog"
},
]
function updateHideContainer(checkbox,container){
if ($(checkbox).is(':checked')){
$(container).show();
}
else{
$(container).hide();
}
}
cblist.forEach(x => {
updateHideContainer(x.cb,x.cont);
$(x.cb).on('click', function(){
updateHideContainer(x.cb,x.cont);
});
});
}
});
</script>
<script type="text/x-red" data-template-name="CS request SOAP">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name (defaults to EVSE setup name)" />
</div>
<div class="form-row">
<label for="node-input-remotecb"><i class="icon-tag"></i> EVSE</label>
<input type="text" id="node-input-remotecb" placeholder="Setup" />
</div>
<div class="form-row">
<label for="node-input-command"><i class="icon-cog"></i> Command</label>
<select id="node-input-command">
<option value=""><None></option>
<option value="UnlockConnector">UnlockConnector</option>
<option value="Reset">Reset</option>
<option value="ChangeAvailability">ChangeAvailability</option>
<option value="GetDiagnostics">GetDiagnostics</option>
<option value="ClearCache">ClearCache</option>
<option value="UpdateFirmware">UpdateFirmware</option>
<option value="ChangeConfiguration">ChangeConfiguration</option>
<option value="RemoteStartTransaction">RemoteStartTransaction</option>
<option value="RemoteStopTransaction">RemoteStopTransaction</option>
<option value="CancelReservation">CancelReservation</option>
<option value="DataTransfer">DataTransfer</option>
<option value="GetConfiguration">GetConfiguration</option>
<option value="GetLocalListVersion">GetLocalListVersion</option>
<option value="ReserveNow">ReserveNow</option>
<option value="SendLocalList">SendLocalList</option>
<option value="ClearChargingProfile">*ClearChargingProfile</option>
<option value="GetCompositeSchedule">*GetCompositeSchedule</option>
<option value="SetChargingProfile">*SetChargingProfile</option>
<option value="TriggerMessage">*TriggerMessage</option>
</select><br/>
<p>* = 1.6 command only</p>
</div>
<div class="form-row">
<label for="node-input-cmddata"><i class="icon-cog"></i> Command Params</label>
<textarea rows="4" cols="50" id="node-input-cmddata" placeholder="JSON formatted parameters"></textarea>
</div>
<div class="header">Logging</div>
<div class="bordered">
<div class="checkbox">
<label>
<input type="checkbox" value="" id="node-input-log"/>
logging enabled
</label>
</div>
<div id="containerlog" class="form-row">
<label for="node-input-pathlog" >
<i class="icon-globe"></i> Path
</label>
<input type="text" id="node-input-pathlog" placeholder="log file path and name" />
</div>
</div>
</script>
<script type="text/x-red" data-help-name="CS request SOAP">
<p>Send Central System (CS) OCPP SOAP requests messages to EVSEs (CP)</p>
<h3>Configuration Settings</h3>
<dl>
<dt>EVSE:</dt>
<dd>Choose, create, or modify an ESVE</dd>
<dt>Command:</i></dt>
<dd>(Optional) Select an OCPP command to send if none is passed in via <code>msg.payload.command</code></dd>
<dt>Command Params:</dt>
<dd>(Optional) OCPP command data object to send if none is passed in via <code>msg.payload.data</code>. Must be JSON formatted</dd>
<dt>Name:</dt>
<dd>The name shown on the workspace</dd>
</dl>
<h3>Inputs</h3>
<dl class="message-properties">
<dt><code>msg.payload.command</code> <i>optional</i> <span class="property-type">string</span></dt>
<dd>OCPP "Central System" request command</dd>
<dt><code>msg.payload.data</code> <i>optional</i> <span class="property-type">object</span></dt>
<dd>Object containing parameters for the command</dd>
</dl>
<h3>Outputs</h3>
<dl class="messge-properties">
<dt>ocpp <span class="property-type">object</dt>
<dd><code>msg.ocpp</code> objcet containing ocpp related information
<ul>
<li><code>command</code>: the request command sent</li>
<li><code>chargeBoxIdentity</code>: name identifying the charge box</li>
<li><code>url</code>: URL of the targe EVSE request was sent to</li>
<li><code>data</code>: object containing the parameters passed to the EVSE for the request (if any)</li>
</ul>
</dd>
<dt>payload <span class="property-type">object</dt>
<dd><code>msg.payload</code> object containing response data sent back from the EVSE. Contents vary depending on the request command.
</dd>
</dl>
</script>