I can see the value of something like this, but I doubt that NR can or should try to do it in the runtime or core nodes. I suspect that the node status does not actually exist except in the editor display and in the message that is sent when the status changes. This is another case where the fact that NR is flow-based rather than state-based requires a different approach. Although @prof7bit objects to the
it is really the cleanest way to manage this. One change
node to update a status object
and one to retrieve it is all that is needed to track the status of as many nodes as you wish. Consider this flow:
[{"id":"c73cb128c57b0562","type":"tab","label":"status","disabled":false,"info":"","env":[]},{"id":"1d182830e00d6f74","type":"inject","z":"c73cb128c57b0562","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":250,"y":60,"wires":[["19cc7bcb4d06bef8"]]},{"id":"19cc7bcb4d06bef8","type":"debug","z":"c73cb128c57b0562","name":"device0","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":400,"y":80,"wires":[]},{"id":"6d4c7ef3ee78f294","type":"status","z":"c73cb128c57b0562","name":"","scope":null,"x":600,"y":140,"wires":[["b3d5e00767aaf762"]]},{"id":"838f8ce714d58962","type":"inject","z":"c73cb128c57b0562","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":250,"y":260,"wires":[["11852881256b574f"]]},{"id":"11852881256b574f","type":"debug","z":"c73cb128c57b0562","name":"device2","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":400,"y":280,"wires":[]},{"id":"e5c2d438ad08bdc3","type":"inject","z":"c73cb128c57b0562","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":250,"y":160,"wires":[["ea4e84ce496bf82b"]]},{"id":"ea4e84ce496bf82b","type":"debug","z":"c73cb128c57b0562","name":"device1","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":400,"y":180,"wires":[]},{"id":"0e0f5cb4cbd91a80","type":"inject","z":"c73cb128c57b0562","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":250,"y":100,"wires":[["19cc7bcb4d06bef8"]]},{"id":"2c7595d3c28c5dab","type":"inject","z":"c73cb128c57b0562","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":250,"y":200,"wires":[["ea4e84ce496bf82b"]]},{"id":"b9684ec4aceffb40","type":"inject","z":"c73cb128c57b0562","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":250,"y":300,"wires":[["11852881256b574f"]]},{"id":"6cc6e01ea8213dc7","type":"inject","z":"c73cb128c57b0562","name":"status","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":610,"y":201,"wires":[["90f8ee1e54812cb4"]]},{"id":"90f8ee1e54812cb4","type":"change","z":"c73cb128c57b0562","name":"get status","rules":[{"t":"set","p":"payload","pt":"msg","to":"status","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":201,"wires":[["bea2a356936103c7"]]},{"id":"bea2a356936103c7","type":"debug","z":"c73cb128c57b0562","name":"continue","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":920,"y":201,"wires":[]},{"id":"b3d5e00767aaf762","type":"change","z":"c73cb128c57b0562","name":"set status","rules":[{"t":"set","p":"status[msg.status.source.name]","pt":"global","to":"status.text","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":140,"wires":[[]]}]
Obviously, the status could be saved in flow instead of global context, and selected nodes could be monitored rather than all of them. Multiple status objects could be defined, and so on. Additionally, the status would be available immediately to any node type that can access context, including function
nodes.