Skip to content

Commit

Permalink
Output enumerated value as msg.textvalue
Browse files Browse the repository at this point in the history
For input nodes that use an enumerated value as data, also output
the textual value as `msg.textvalue`.
For these nodes also show this textual value in the status text.
  • Loading branch information
dirkjanfaber committed Mar 1, 2024
1 parent 11e64b0 commit 5821dcd
Show file tree
Hide file tree
Showing 5 changed files with 5,503 additions and 128 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It is also possible to use this library when running Node-RED on a separate host

This library is not officially supported by Victron Energy: don't call our dealers or other support channels for help.

For any questions or help, please turn to [community.victronenergy.com](https://community.victronenergy.com/smart-spaces/71/node-red.html). Pull-requests are willingly encouraged!
For any questions or help, please turn to [community.victronenergy.com](https://community.victronenergy.com). Pull-requests are willingly encouraged!

## Requirements when self-installing this node palette
- A Victron system that includes a GX device (note that for trial & development you could use the demo mode in Venus OS, Settings -> General)
Expand Down Expand Up @@ -46,6 +46,8 @@ In case the data type is enumerated, an approppriate enum legend is shown below
If in the configuration node, the _Context store_ checkbox has been set, the received values will also
be stored in the (global) context.



### Output Nodes

Input Nodes have the same options available, but the selectable 'measurement' only lists writable services. Additionally, the user can set an initial value to the service, which is sent whenever the flow is deployed.
Expand Down
3 changes: 2 additions & 1 deletion scripts/service2doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ searchLabelInfo(registerHTML).then(function (labelinfo) {
show('md', 'The measurement unit type is shown in the measurement label in brackets, e.g. Battery voltage (V). In case the data type is enumerated, an appropriate enum legend is shown below the selected option.\n')
show('md', 'If the data type is _float_, a dropdown for rounding the output appears.\n')
show('md', 'By default the node outputs its value every five seconds. If the only changes is checked, the node will only output on value changes.\n')
show('md', 'In case of an enumerated type, the textual value of the payload is also send out as `msg.textvalue`.')
show('md', '![input nodes](https://github.com/victronenergy/node-red-contrib-victron/blob/master/documentation/images/edit-vebus-input.png)\n')
Object.keys(services).forEach(function (k) {
show('nodered', '<script type="text/x-red" data-help-name="victron-' + k + '">')
Expand All @@ -108,7 +109,7 @@ searchLabelInfo(registerHTML).then(function (labelinfo) {
show('md', '## ' + labelinfo[k])
show('nodered', '<h3>Details</h3>')
if (/input-/.test(k)) {
show('nodered', '<p>The <strong>input nodes</strong> have two selectable inputs: the devices select and measurement select. The available options are dynamically updated based on the data that is actually available on the Venus device.</p> <ul> <li><em>Device select</em> - lists all available devices</li> <li><em>Measurement select</em> - lists all available device-specific measurements</li> <li><em>Node label input field</em> - sets a custom label for the node</li> </ul> <p>The measurement unit type is shown in the measurement label in brackets, e.g. Battery voltage (V). In case the data type is enumerated, an appropriate enum legend is shown below the selected option.</p>')
show('nodered', '<p>The <strong>input nodes</strong> have two selectable inputs: the devices select and measurement select. The available options are dynamically updated based on the data that is actually available on the Venus device.</p> <ul> <li><em>Device select</em> - lists all available devices</li> <li><em>Measurement select</em> - lists all available device-specific measurements</li> <li><em>Node label input field</em> - sets a custom label for the node</li> </ul> <p>The measurement unit type is shown in the measurement label in brackets, e.g. Battery voltage (V). In case the data type is enumerated, an appropriate enum legend is shown below the selected option. In this case the node will also output the enumerated textual value as <tt>msg.textvalue</tt>.</p>')
show('nodered', '<p>If the data type is <em>float</em>, a dropdown for rounding the output appears.</p>')
show('nodered', '<p>By default the node outputs its value every five seconds. If the <em>only changes</em> is checked, the node will only output on value changes.</p>')
} else {
Expand Down
Loading

0 comments on commit 5821dcd

Please sign in to comment.