Closed colinl closed 1 year ago
I ran your flow here on an ESP8266. The LED flashes and, after updating the MQTT broker to test.mosquitto.org
, it relays messages received on test/mcu/pid/set
to test/mcu/pid/result
(confirmed using mosquitto_pub/sub).
Since both MQTT and Trigger are not working, it sounds like your flow just isn't running. A good way to check that is to look at the generated flows.js in the debugger. Since you are building for esp/nodemcu, that should be located at $MODDABLE/build/tmp/esp/nodemcu/debug/node-red-mcu/modules/flows.js. There you will see a build
function. Set a breakpoint there and you can step through the instantiation of each node. That's a good way to confirm that the expected nodes are present and that they have the expected configuration. You can also do things like break when the Inject node's timer triggers, to confirm that it is injecting messages as expected.
initialize: function () {
Timer.set(() => this.trigger(), 2000, 2000);
},
For completeness, here's the flows.js from my test run:
Thanks for coming back so quickly.
I see the problem, when I looked in that file I saw that it was instantiating only the broker node, and when I compared it with yours I saw that yours has entries for the flow tabs. I was exporting only the nodes rather than a complete tab. It does say in the docs to export flows, but I wonder whether a note in large letters warning that complete tabs must be exported would be a good idea. Then those of us that, foolishly, only skim the docs would be less likely to get it wrong. :) All working perfectly now, sorry about the noise.
Then those of us that, foolishly, only skim the docs would be less likely to get it wrong. :)
Yes, well. There's a related challenge with the UI nodes, where it is necessary to report all flows to have the dashboard configuration node included.
I'll update the docs with a bit more text. Maybe I can also update nodered2mcu
to issue a warning if there's a potentially missing node (e.g. no broker node for an MQTT Out). That could give a hint.
All working perfectly now, sorry about the noise.
No problem. I appreciate the clear report and your patience in working through issues.
This simple flow, with MQTT passthrough from MQTT In to MQTT Out, and an Inject and Trigger node driving a Wemos D1 Mini onboard LED is not functioning correctly.
In xsbug I see the wifi connecting, but the LED is not flashing and when I publish to the MQTT In topic, noting happens. A breakpoint on nodes/trigger/89-trigger.js line 32 (
RED.nodes.createNode(this,n);
) is never hit.The Instruments tab in xsbug shows it running something, but there is little happening after the first few seconds.
To run it I use the command
mcconfig -d -m -p esp/nodemcu ssid="**" password="**"
If I remove the MQTT nodes the LED flashes correctly.
Do I have to do something to enable MQTT?