UNPKG

@gravypower/node-red-franklinwh

Version:

Node-RED node to control FranklinWH gateway

160 lines (145 loc) 5.71 kB
<script type="text/javascript"> RED.nodes.registerType('franklinwh-get-battery',{ category: 'FranklinWH', color: '#3399ff', defaults: { server: {type: "franklinwh-config", required: true}, name: {value: ""} }, inputs:1, outputs:1, icon: "font-awesome/fa-battery-half", label: function() { return this.name || "get battery"; } }); </script> <script type="text/html" data-template-name="franklinwh-get-battery"> <div class="form-row"> <label for="node-input-server"><i class="fa fa-server"></i> Server</label> <input type="text" id="node-input-server"> </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" placeholder="Name"> </div> </script> <script type="text/html" data-help-name="franklinwh-get-battery"> <p>Gets comprehensive battery information from the FranklinWH system including charge state, power flow, and system details.</p> <h3>Inputs</h3> <dl class="message-properties"> <dt>payload <span class="property-type">any</span> </dt> <dd>Any input will trigger a battery status request.</dd> </dl> <h3>Outputs</h3> <dl class="message-properties"> <dt>payload <span class="property-type">object</span> </dt> <dd> An object containing: <ul> <li><code>timestamp</code> - ISO timestamp of the data retrieval</li> <li><code>battery</code> - Battery information object: <ul> <li><code>state</code> - Current battery state: <ul> <li><code>chargePercentage</code> - Current charge level (0-100)</li> <li><code>powerOutput</code> - Current power flow in kW (negative = charging, positive = discharging)</li> <li><code>charging</code> - Boolean indicating if battery is charging</li> <li><code>health</code> - Battery health status</li> </ul> </li> <li><code>estimate</code> - Time estimates: <ul> <li><code>type</code> - Either 'timeToFull' when charging or 'timeToReserve' when discharging</li> <li><code>time</code> - Estimated time remaining (e.g., "2h 30m", "45m")</li> <li><code>reservePercentage</code> - Current battery reserve level setting</li> </ul> </li> <li><code>energy</code> - Energy statistics: <ul> <li><code>charged</code> - Total energy charged (kWh)</li> <li><code>discharged</code> - Total energy discharged (kWh)</li> <li><code>unit</code> - Unit of measurement ('kWh')</li> </ul> </li> <li><code>info</code> - Battery specifications: <ul> <li><code>capacity</code> - Total capacity in kWh</li> <li><code>temperature</code> - Current temperature</li> <li><code>cycles</code> - Charge/discharge cycles</li> <li><code>model</code> - Battery model information</li> </ul> </li> </ul> </li> </ul> </dd> </dl> <h3>Status Indicators</h3> <dl> <dt>Grey ring</dt> <dd>Waiting for input</dd> <dt>Blue dot</dt> <dd>Requesting battery data</dd> <dt>Green dot</dt> <dd>Battery charge ≥ 75%</dd> <dt>Yellow dot</dt> <dd>Battery charge between 25% and 74%</dd> <dt>Red dot</dt> <dd>Battery charge < 25%</dd> <dt>Red ring</dt> <dd>Error or timeout occurred</dd> </dl> <h3>Details</h3> <p>Status display shows:</p> <ul> <li>Current charge percentage</li> <li>Power flow in kW (shown in parentheses)</li> <li>Color indicating charge level</li> </ul> <h3>Example Output</h3> <p><pre> { "timestamp": "2024-07-10T15:30:00.000Z", "battery": { "state": { "chargePercentage": 85, "powerOutput": -2.5, "charging": true, "health": "good" }, "estimate": { "type": "timeToFull", "time": "2h 30m", "reservePercentage": 10 }, "energy": { "charged": 1234.567, "discharged": 987.654, "unit": "kWh" }, "info": { "capacity": 13.6, "temperature": 25, "cycles": 123, "model": "aPower X" } } } </pre></p> <h3>Notes</h3> <ul> <li>Power values are shown to 2 decimal places</li> <li>Energy values are shown to 3 decimal places</li> <li>Requests timeout after 10 seconds</li> <li>Power output is positive when charging, negative when discharging</li> </ul> <h3>References</h3> <ul> <li><a href="https://www.franklinwh.com/support" target="_blank">FranklinWH Documentation</a></li> </ul> </script>