NodeDSF : Interface nodes for Node-Red (V1.1.11 - 06-10-23).
-
i don't think node-red is communicating with DUET when following the email tutorial (https://www.youtube.com/watch?v=cn_XXR3FJ00). link text
here is what my debug looks like. I am now doing this on a rasp pi4 as it wasn't working on my windows 10 machine. I also followed the instructions at link text to install node-red and NODE DSF on it.dsfModel : msg : Object object topic: "dsfModel" payload: null dsf: object monitorMode: "DSF" monitorError: "No server defined or cannot connect to DSF. Checking again in 10 seconds" _msgid: "adf0ddc76a5d1eae"
-
@tekstyle Are you using a standalone duet control board, or do you have it connected to an SBC using a ribbon/spi cable?
If you are using a standalone control board you need to set the type to Duet in the connection properties of the monitor node
Then
-
i am using a duet2wifi with a rasp pi4 for node-red.
-
i changed the type to DUET. i also changed my credentialSecret code to false. it seems to be getting something under debug window on the right now. but following your example, i can not see the OM for the command M117 "xxx". if you go to line 141, that is were STATE starts and I do not see the field for displaymessage = "xxx"
12/20/2021, 9:32:20 AM msg : string[57] "Error loading flows: Error: Failed to decrypt credentials" 12/20/2021, 9:32:20 AMnode: b881bf70e5d5eca0 dsfModel : msg : Object object topic: "dsfModel" payload: object fullModel: object boards: array[1] 0: object directories: object empty fans: array[3] 0: object actualValue: 0 requestedValue: 0 rpm: -1 1: object actualValue: 0 requestedValue: 1 rpm: -1 2: object actualValue: 0 requestedValue: 0 rpm: -1 global: object ext1: 1 SensorTriggered: 2 heat: object heaters: array[3] 0: object active: -273 current: 15.1 standby: 0 state: "active" 1: object active: 0 current: 14.2 standby: 160 state: "active" 2: object active: 0 current: -273.1 standby: 0 state: "off" inputs: array[12] [0 … 9] 0: object feedRate: 50 lineNumber: 69 state: "idle" 1: object feedRate: 50 lineNumber: 0 state: "idle" 2: object 3: object 4: object 5: object 6: object 7: object 8: null 9: object [10 … 11] job: object build: null duration: null filePosition: 0 layer: null layerTime: null pauseDuration: null rawExtrusion: null timesLeft: object warmUpDuration: null limits: object empty move: object axes: array[3] 0: object machinePosition: 0 userPosition: 0 1: object 2: object currentMove: object extruders: array[1] 0: object virtualEPos: -3 network: object empty scanner: object empty sensors: object analog: array[3] 0: object lastReading: 15.1 1: object 2: object endstops: array[3] 0: object triggered: false 1: object 2: object filamentMonitors: array[1] 0: object status: "ok" gpIn: array[2] 0: null 1: object value: 0 probes: array[1] 0: object value: array[1] seqs: object boards: 0 directories: 0 fans: 6 global: 2 heat: 14 inputs: 29753 job: 39 move: 82 network: 7 reply: 168 scanner: 1 sensors: 36 spindles: 0 state: 45 tools: 13 volChanges: array[2] 0: 77 1: 0 volumes: 64929 spindles: array[4] 0: object current: 0 state: "unconfigured" 1: object 2: object 3: object state: object messageBox: object title: null message: null atxPower: true currentTool: 0 gpOut: array[0] laserPwm: null msUpTime: 634 nextTool: 0 previousTool: -1 status: "idle" time: "2021-12-20T09:32:32" upTime: 476541 tools: array[2] 0: object active: array[1] 0: 0 standby: array[1] state: "active" 1: object volumes: array[2] 0: object empty 1: object patchModel: null prevModel: null dsf: object monitorMode: "Duet" _msgid: "7916fbc1145cf6f1"
-
@tekstyle ""Error loading flows: Error: Failed to decrypt credentials" is a node-red error (not from NodeDSF) because you have changed your credentialSecret code configuration in your setting.js.
The help text for credentialSecret states changing it will prevent node-red from decrypting existing credentials:
// By default, credentials are encrypted in storage using a generated key. To // specify your own secret, set the following property. // If you want to disable encryption of credentials, set this property to false. // Note: once you set this property, do not change it - doing so will prevent // node-red from being able to decrypt your existing credentials and they will be // lost. //credentialSecret: "a-secret-key",
Which means any ip addresses, usernames, passwords (etc) you configured in your nodes before you changed credentailSecret are no longer accessible to node-red.
I suggest you Reset the settings.js beck to what it was before you changed it.
The default setting is just commented out eg://credentialSecret: "a-secret-key",
-
@mintytrebor
i changed it back to credentialsecret: "a-secret-key" with it commented out. restarted. this is my start logStarting as a systemd service. 20 Dec 20:55:41 - [info] Welcome to Node-RED =================== 20 Dec 20:55:41 - [info] Node-RED version: v2.1.4 20 Dec 20:55:41 - [info] Node.js version: v14.18.2 20 Dec 20:55:41 - [info] Linux 5.10.63-v7l+ arm LE 20 Dec 20:55:42 - [info] Loading palette nodes 20 Dec 20:55:44 - [info] Dashboard version 3.1.2 started at /ui 20 Dec 20:55:44 - [info] Settings file : /home/pi/.node-red/settings.js 20 Dec 20:55:44 - [info] Context store : 'storeInFile' [module=localfilesystem] 20 Dec 20:55:44 - [info] Context store : 'default' [module=memory] 20 Dec 20:55:44 - [info] User directory : /home/pi/.node-red 20 Dec 20:55:44 - [warn] Projects disabled : editorTheme.projects.enabled=false 20 Dec 20:55:44 - [info] Flows file : /home/pi/.node-red/flows.json 20 Dec 20:55:44 - [info] Server now running at http://127.0.0.1:1880/ 20 Dec 20:55:44 - [warn] --------------------------------------------------------------------- Your flow credentials file is encrypted using a system-generated key. If the system-generated key is lost for any reason, your credentials file will not be recoverable, you will have to delete it and re-enter your credentials. You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change. --------------------------------------------------------------------- 20 Dec 20:55:44 - [warn] Error loading credentials: SyntaxError: Unexpected token � in JSON at position 1 20 Dec 20:55:44 - [warn] Error loading flows: Error: Failed to decrypt credentials 20 Dec 20:55:44 - [info] +----------------------------------------------------- 20 Dec 20:55:44 - [info] | uibuilder v4.1.4 initialised 20 Dec 20:55:44 - [info] | root folder: /home/pi/.node-red/uibuilder 20 Dec 20:55:44 - [info] | Using Node-RED's webserver at: 20 Dec 20:55:44 - [info] | http://127.0.1.1:1880/ or http://localhost:1880/ 20 Dec 20:55:44 - [info] | Installed packages: 20 Dec 20:55:44 - [info] | jquery, socket.io 20 Dec 20:55:44 - [info] +----------------------------------------------------- 20 Dec 20:55:44 - [info] Starting flows 20 Dec 20:55:44 - [info] Started flows
settings.js below
flowFile: 'flows.json', /** By default, credentials are encrypted in storage using a generated key.$ * specify your own secret, set the following property. * If you want to disable encryption of credentials, set this property to f$ * Note: once you set this property, do not change it - doing so will preve$ * node-red from being able to decrypt your existing credentials and they w$ * lost. */ // credentialSecret: false, // credentialSecret: "a-secret-key",
for every change made, how do I apply those changes so node-red knows to reset itself or something to decrypt exisiting credentials properly? right now , I just do node-red-stop followed by node-red-start in terminal.
-
@tekstyle Node-red has probably generated a new key automatically now..
Look for a file called something like "flows_#####cred.json" in .node-red folder (the same folder as settings.js) and rename it to "flows#####_cred.old". Then restart node red.
It will probably clear all of the node settings you have already entered, but it should clear the error.
You will have to re-enter the IP and set the mode to Duet in the monitor node of your flow.
-
renamed the flow_cred.json to flow_cred.old.
stop service and start up again. then deleted all old flow and made new ones. it's weird, i can see the objective models in the debug (eg, it knows I have 2 tools configured) but it just doesn't do anything. it never updates (eg, T0 is set to "off" but it always shows "standby"). Also, the debug would just keep displaying new information even before I press the red deploy button
start log below:
pi@raspberrypi:~/.node-red $ node-red 20 Dec 21:33:24 - [info] Welcome to Node-RED =================== 20 Dec 21:33:24 - [info] Node-RED version: v2.1.4 20 Dec 21:33:24 - [info] Node.js version: v14.18.2 20 Dec 21:33:24 - [info] Linux 5.10.63-v7l+ arm LE 20 Dec 21:33:25 - [info] Loading palette nodes 20 Dec 21:33:27 - [info] Dashboard version 3.1.2 started at /ui 20 Dec 21:33:27 - [info] Settings file : /home/pi/.node-red/settings.js 20 Dec 21:33:27 - [info] Context store : 'storeInFile' [module=localfilesystem] 20 Dec 21:33:27 - [info] Context store : 'default' [module=memory] 20 Dec 21:33:27 - [info] User directory : /home/pi/.node-red 20 Dec 21:33:27 - [warn] Projects disabled : editorTheme.projects.enabled=false 20 Dec 21:33:27 - [info] Flows file : /home/pi/.node-red/flows.json 20 Dec 21:33:27 - [info] Creating new flow file 20 Dec 21:33:27 - [info] +----------------------------------------------------- 20 Dec 21:33:27 - [info] | uibuilder v4.1.4 initialised 20 Dec 21:33:27 - [info] | root folder: /home/pi/.node-red/uibuilder 20 Dec 21:33:27 - [info] | Using Node-RED's webserver at: 20 Dec 21:33:27 - [info] | http://127.0.1.1:1880/ or http://localhost:1880/ 20 Dec 21:33:27 - [info] | Installed packages: 20 Dec 21:33:27 - [info] | jquery, socket.io 20 Dec 21:33:27 - [info] +----------------------------------------------------- 20 Dec 21:33:27 - [info] Server now running at http://127.0.0.1:1880/ 20 Dec 21:33:27 - [info] Starting flows 20 Dec 21:33:27 - [info] Started flows 20 Dec 21:34:43 - [info] Stopping flows 20 Dec 21:34:43 - [info] Stopped flows 20 Dec 21:34:43 - [info] Starting flows 20 Dec 21:34:43 - [info] Started flows
-
@tekstyle The log shows node-red is working without any credential issues now.
I suggest you go into the monitor node and click the pencil edit button next to the ip address
then delete the config
repeat deletion for every item in the list
Then delete the flow and do a full deploy
Go to the connection test example flow from my repo here, then click copy raw contents
In a new flow click the menu and select import
paste the copied raw data into the box, select new flow, and click import
this will create a new "Connection Example" flow
Double click the monitor node (named Duet2 Board), and click the pencil button and set your duet board IP and mode to Duet
Click update, then done, and then do a full deploy.
Open the debug side window
The use the Start & Stop nodes to control the monitor, the output can be seen in the side debug window. It should look something like this:
-
i got that far. it seems like it is working. I was able to see target active temp change and updated .
when i do a M117 "hello" on my console in DWC. where do I see that in the debug window in node-red.
-
@tekstyle Great!
First check you are on the latest release (v1.1.4) through the palette manager, I found a bug whilst answering your query, so please make sure you are updated before going any further. (It can sometimes take a while before updates show in palette manager)
Then add an DSF Event node plus a debug node and configure it like this:
Deploy, start the monitor and send a M117 message in DWC and it should appear in the debug window (like the picture above). -
i finally got this to work. that last post was a great help! thank you! now on to setting up email notification.
-
@tekstyle Great! I'm glad you got it working. It's worthwhile spending some time learning node-red, it's really powerful and easy to use, and there are loads of nodes available for interfacing with other IOT stuff etc. I run all my lights, home automation, & printers with it.
-
@mintytrebor so i used an email node with app password to get it to work. i just want it to display a message with m117 right now. however, it sends me the whole payload of dsf model.
i copied the path "payload.fullModel.state.displayMessage" . i just copied and paste. but it still keeps sending me the whole thing. anyway to zero it down to just what i request of it on the debug node?
-
@tekstyle Using the same example as before:
The DSF Event node sends the value of the event to msg.dsf.eventValue
Look at the help for the DSF Event node and its fully described:
-
My DSF event node/model path = state.displayMessage
debug node/output = msg.dsf.eventValue
the debug window above looks like this:
1/9/2022, 9:07:14 PMnode: aebd8e98337002b3 dsfModel : msg.dsf.eventValue : string[4] "dfsf"
my email looks like this:
{"fullModel":{"boards":[{"axisMins":[-198.7,-244,0,0],"axisMaxes":[214,196,365,141],"accelerations":[900,900,100,800,500,500,500,500,1250,1250,600,1250],"currents":[1000,1000,1700,0,0,0,0,0,680,680,500,680],"firmwareElectronics":"Duet WiFi 1.02 or later + DueX5","firmwareName":"RepRapFirmware for Duet 2 WiFi/Ethernet","firmwareVersion":"3.3","dwsVersion":"1.26","firmwareDate":"2021-06-15","sysdir":"0:/sys/","idleCurrentFactor":30,"idleTimeout":30,"minFeedrates":[33.33,33.33,8.33,0.83,15,15,15,15,50,50,5,50],"maxFeedrates":[333.33,333.33,8.33,133.33,100,100,100,100,133.33,133.33,60,133.33],"mcuTemp":{"current":29.7},"vIn":{"current":24.1}}],"directories":{},"fans":[{"actualValue":0,"requestedValue":0,"rpm":-1},null,null,{"actualValue":0,"requestedValue":1,"rpm":-1},{"actualValue":1,"requestedValue":1,"rpm":-1},{"actualValue":1,"requestedValue":1,"rpm":-1},{"actualValue":0,"requestedValue":1,"rpm":-1},null,{"actualValue":0,"requestedValue":0,"rpm":-1},{"actualValue":0,"requestedValue":0,"rpm":-1}],"global":{"PTOOL":-1,"BH3":0,"BH2":0,"BH1":0,"BH0":0,"BED":0,"PCCFHOTENDR":160,"PCCFHOTENDS":265},"heat":{"heaters":[{"active":0,"current":18,"standby":0,"state":"off"},{"active":0,"current":18,"standby":0,"state":"off"},{"active":0,"current":-273.1,"standby":0,"state":"off"},{"active":0,"current":-273.1,"standby":0,"state":"off"},{"active":0,"current":18,"standby":0,"state":"off"},{"active":0,"current":18,"standby":0,"state":"off"},{"active":0,"current":18.3,"standby":0,"state":"off"},{"active":0,"current":20.3,"standby":0,"state":"off"}]},"inputs":[{"feedRate":50,"lineNumber":2,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},{"feedRate":50,"lineNumber":67965,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},null,{"feedRate":50,"lineNumber":0,"state":"idle"},null,{"feedRate":50,"lineNumber":0,"state":"idle"}],"job":{"build":null,"duration":null,"filePosition":0,"layer":null,"layerTime":null,"pauseDuration":null,"rawExtrusion":null,"timesLeft":{"filament":null,"file":null,"slicer":null},"warmUpDuration":null},"limits":{},"move":{"axes":[{"machinePosition":0,"userPosition":0},{"machinePosition":0,"userPosition":0},{"machinePosition":0,"userPosition":0},{"machinePosition":0,"userPosition":0}],"currentMove":{"acceleration":0,"deceleration":0,"laserPwm":null,"requestedSpeed":0,"topSpeed":0},"extruders":[{"position":0,"rawPosition":0},{"position":0,"rawPosition":0},{"position":0,"rawPosition":0},{"position":0,"rawPosition":0},{"position":0,"rawPosition":0}],"virtualEPos":0},"network":{},"scanner":{},"sensors":{"analog":[{"lastReading":18},{"lastReading":18},{"lastReading":18.3},{"lastReading":20.3},{"lastReading":18},{"lastReading":-273.1},{"lastReading":-273.1},{"lastReading":18}],"endstops":[{"triggered":false},{"triggered":false},null,{"triggered":true}],"filamentMonitors":[null,null,null,{"status":"ok"}],"gpIn":[],"probes":[{"value":[0]}]},"seqs":{"boards":0,"directories":0,"fans":14,"global":8,"heat":42,"inputs":11,"job":1,"move":48,"network":4467,"reply":2,"scanner":1,"sensors":12,"spindles":0,"state":3,"tools":22,"volChanges":[1,0],"volumes":120},"spindles":[{"current":0,"state":"unconfigured"},{"current":0,"state":"unconfigured"},{"current":0,"state":"unconfigured"},{"current":0,"state":"unconfigured"}],"state":{"messageBox":{"title":null,"message":null},"atxPower":null,"currentTool":-1,"gpOut":[],"laserPwm":null,"msUpTime":71,"nextTool":-1,"previousTool":-1,"status":"idle","time":"2022-01-09T20:57:15","upTime":11396,"displayMessage":"he"},"tools":[{"active":[],"standby":[],"state":"off"},{"active":[0],"standby":[0],"state":"off"},{"active":[0],"standby":[0],"state":"off"},{"active":[0],"standby":[0],"state":"off"},{"active":[0],"standby":[0],"state":"off"}],"volumes":[{},{}]},"patchModel":{"boards":{"0":{"vIn":{"current":24.1}}},"heat":{"heaters":{"0":{"current":18},"1":{"current":18},"4":{"current":18},"5":{"current":18},"6":{"current":18.3}}},"inputs":{"0":{"lineNumber":2}},"sensors":{"analog":{"0":{"lastReading":18},"1":{"lastReading":18},"2":{"lastReading":18.3},"4":{"lastReading":18},"7":{"lastReading":18}}},"seqs":{"reply":2,"state":3},"state":{"msUpTime":71,"time":"2022-01-09T20:57:15","upTime":11396,"displayMessage":"he"}},"prevModel":{"boards":[{"axisMins":[-198.7,-244,0,0],"axisMaxes":[214,196,365,141],"accelerations":[900,900,100,800,500,500,500,500,1250,1250,600,1250],"currents":[1000,1000,1700,0,0,0,0,0,680,680,500,680],"firmwareElectronics":"Duet WiFi 1.02 or later + DueX5","firmwareName":"RepRapFirmware for Duet 2 WiFi/Ethernet","firmwareVersion":"3.3","dwsVersion":"1.26","firmwareDate":"2021-06-15","sysdir":"0:/sys/","idleCurrentFactor":30,"idleTimeout":30,"minFeedrates":[33.33,33.33,8.33,0.83,15,15,15,15,50,50,5,50],"maxFeedrates":[333.33,333.33,8.33,133.33,100,100,100,100,133.33,133.33,60,133.33],"mcuTemp":{"current":29.7},"vIn":{"current":24.2}}],"directories":{},"fans":[{"actualValue":0,"requestedValue":0,"rpm":-1},null,null,{"actualValue":0,"requestedValue":1,"rpm":-1},{"actualValue":1,"requestedValue":1,"rpm":-1},{"actualValue":1,"requestedValue":1,"rpm":-1},{"actualValue":0,"requestedValue":1,"rpm":-1},null,{"actualValue":0,"requestedValue":0,"rpm":-1},{"actualValue":0,"requestedValue":0,"rpm":-1}],"global":{"PTOOL":-1,"BH3":0,"BH2":0,"BH1":0,"BH0":0,"BED":0,"PCCFHOTENDR":160,"PCCFHOTENDS":265},"heat":{"heaters":[{"active":0,"current":18.1,"standby":0,"state":"off"},{"active":0,"current":18.1,"standby":0,"state":"off"},{"active":0,"current":-273.1,"standby":0,"state":"off"},{"active":0,"current":-273.1,"standby":0,"state":"off"},{"active":0,"current":17.9,"standby":0,"state":"off"},{"active":0,"current":17.9,"standby":0,"state":"off"},{"active":0,"current":18.1,"standby":0,"state":"off"},{"active":0,"current":20.3,"standby":0,"state":"off"}]},"inputs":[{"feedRate":50,"lineNumber":1,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},{"feedRate":50,"lineNumber":67965,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},{"feedRate":50,"lineNumber":0,"state":"idle"},null,{"feedRate":50,"lineNumber":0,"state":"idle"},null,{"feedRate":50,"lineNumber":0,"state":"idle"}],"job":{"build":null,"duration":null,"filePosition":0,"layer":null,"layerTime":null,"pauseDuration":null,"rawExtrusion":null,"timesLeft":{"filament":null,"file":null,"slicer":null},"warmUpDuration":null},"limits":{},"move":{"axes":[{"machinePosition":0,"userPosition":0},{"machinePosition":0,"userPosition":0},{"machinePosition":0,"userPosition":0},{"machinePosition":0,"userPosition":0}],"currentMove":{"acceleration":0,"deceleration":0,"laserPwm":null,"requestedSpeed":0,"topSpeed":0},"extruders":[{"position":0,"rawPosition":0},{"position":0,"rawPosition":0},{"position":0,"rawPosition":0},{"position":0,"rawPosition":0},{"position":0,"rawPosition":0}],"virtualEPos":0},"network":{},"scanner":{},"sensors":{"analog":[{"lastReading":18.1},{"lastReading":17.9},{"lastReading":18.1},{"lastReading":20.3},{"lastReading":18.1},{"lastReading":-273.1},{"lastReading":-273.1},{"lastReading":17.9}],"endstops":[{"triggered":false},{"triggered":false},null,{"triggered":true}],"filamentMonitors":[null,null,null,{"status":"ok"}],"gpIn":[],"probes":[{"value":[0]}]},"seqs":{"boards":0,"directories":0,"fans":14,"global":8,"heat":42,"inputs":11,"job":1,"move":48,"network":4467,"reply":1,"scanner":1,"sensors":12,"spindles":0,"state":2,"tools":22,"volChanges":[1,0],"volumes":120},"spindles":[{"current":0,"state":"unconfigured"},{"current":0,"state":"unconfigured"},{"current":0,"state":"unconfigured"},{"current":0,"state":"unconfigured"}],"state":{"messageBox":{"title":null,"message":null},"atxPower":null,"currentTool":-1,"gpOut":[],"laserPwm":null,"msUpTime":838,"nextTool":-1,"previousTool":-1,"status":"idle","time":"2022-01-09T20:57:14","upTime":11395},"tools":[{"active":[],"standby":[],"state":"off"},{"active":[0],"standby":[0],"state":"off"},{"active":[0],"standby":[0],"state":"off"},{"active":[0],"standby":[0],"state":"off"},{"active":[0],"standby":[0],"state":"off"}],"volumes":[{},{}]}}
-
@tekstyle The help from the email node states:
So if you want the email to just be the M117 msg text you have to set msg.payload = msg.dsf.eventValue
you need to add a change node to make this change
-
@mintytrebor Thank you for the tip to check the email node's help. still learning how to use it.
I was able to just send the M117 message. now i am working on how i can send values from the object modelling to it. It will take some time to play around with.
Thanks for getting me started and helping me get a little familiar with how node-red works.
-
V1.1.5 Update - Improved communication in Duet mode which should resolve issue where board could crash or fail to respond, plus fixed node not stopping on deploy when active.
-
I am curious to understand how NodeDSF works. so even though I am just trying to monitor for changes in the display message when a M117 is entered, what I noticed is that when ANY thing gets posted in the console, it trigger a flow no matter if a new M117 command was evoked. I just want to make sure I got this correct.
Regarding your update, majority of my wifi issues came from having a node-red server running on the same network as my duet2wifi. I was getting frequent disconnects that was impossible to resolve. Your update seems to have fixed some of those issues but I still have to mess around with it some more to make sure that was the case.
Currently, I have a very interesting setup. I have 2 wifi adapters on my laptop. 1 integrated, and 1 via USB. i have my integrated connected to my home WIFI. i have the USB connected to the duet in access point mode. i have node-red installed on my windows 10 machine. I am able to access the internet and connect to both node-red and duet2 board with a working nodeDSF.