@hlovdal/node-red-display-property 1.0.3
A simple node that displays as its status the value of a message property that passes the node and optional the date/time when the message passed.
This is a fork of the original repository which no longer seems to be maintained.
@hlovdal/node-red-display-property
A simple node that displays as its status the value of a message property that passes the node. Optional it can be configured to also show the date and/or the time when the message passed. The intention of this node is to give you a better overview of the messages that pass your flows and support you debugging your flows by easily displaying the content of massage properties.
Quick Start
Install from your Node-RED Manage Palette or using npm:
npm install @hlovdal/node-red-display-property
Example
[{"id":"9a2098e26d45c777","type":"inject","z":"7fe7fa4eeb8bc36e","name":"JSON data","props":[{"p":"data","v":"{\"id\":\"light-12345\",\"type\":\"light\",\"timestamp\":1748648445,\"attributes\":{\"name\":\"Living room light\",\"brightness\":75}}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":540,"y":500,"wires":[["3c18736cd0888ec6"]]},{"id":"3c18736cd0888ec6","type":"display property","z":"7fe7fa4eeb8bc36e","name":"msg.data.attributes.brightness","property":"msg.data.attributes.brightness","showDate":true,"showTime":true,"x":800,"y":500,"wires":[["22540bb1a20bde39"]]},{"id":"22540bb1a20bde39","type":"debug","z":"7fe7fa4eeb8bc36e","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1060,"y":500,"wires":[]}]
It will gracefully handle attempting to display properties that do not exist:
Help
This documentation is also available in the help section of the node.
This node accepts any massage at the input and passes exactly the same massage to the output.
It can be configured to display the content of a certain property (default is msg.payload
) of the message that passes the node. This content will be displayed as the status of the node along the the date and/or time when it passed.
My intention for creating this little node was to get a better overview of what values running through my nodes without the need to put debug nodes everywhere. So this can also be handy for debugging your flows by displaying the content of massages property.
Two options to display the value of a property
You can either provide the name of the property you want to display in the configuration of the node or you can pass the name of the property you want to display as msg.property
to the node.
To display for example the content of msg.topic you have two options:
- add msg.topic as the property in the configuration of the node, or
- pass a message with
msg.property
and content msg.topic to the node.
No need to mention that you can also display any other properties :-)
What else should you know about this node?
If you pass a msg.property
, this will override the settings in the node-configuration.
If the message does not have a property, either configured in the node or passed via msg.property
, the content of msg.payload
(the default) will be displayed instead.
Bugs and feature requests
Please report any issues or enhancement requests at GitHub.
Development
You want to have a go at modifying the code? Awesome! For the time being there is no explicit build command, so just edit files directly.
Pre-commit
To keep formatting of files in good shape, please install pre-commit
python -m venv venv
source venv/bin/activate # non-windows machines
source venv/Scripts/activate # windows machines
pip install --upgrade pip # Optional
pip install pre-commit
Verify that the tool is working:
pre-commit run --all-files
And then install pre-commit as a git hook:
pre-commit install --allow-missing-config