Open spillz-dxb opened 5 months ago
This is most likely what is preventing your flow from running:
C:\Users\sande\Downloads\node-red-mcu-main\node-red-mcu-main\nodered.js (86) # Break: util.getSetting: cannot coerce undefined to object!
When that happens, xsbug should break so you can inspect the state. It would be helpful to see the JavaScript stack trace at that point.
Also, if you are able to share the JSON for a simple flow that reproduces this problem, it may help sort this out more quickly. Thank you.
hi peter, when i proceed i get this XS abort: unhandled exception C:\Users\sande\Projects\moddable\xs\platforms\esp\xsPlatform.c (279) # Break: C: xsDebugger!
And the same happens for all the flows i created and the ones in your repo examples too .The same happens when i bypass the plugin and use mcconfig on my esp-idf teminal . the flows work in my node-red enviroment.
Regards,
Spillz
when i proceed i get this
XS abort: unhandled exception
Sure, that's expected when there is an unexpected exception. I didn't suggest you proceed from the breakpoint, but that you share the JavaScript stack trace from that point.
And the same happens for all the flows i created and the ones in your repo examples too
To be certain we are looking at the same thing, it would be very helpful if you would share the JSON for a simple flow that shows the problem or, at least, reference one simple flow in the repo examples that is not working for you. Thank you.
here is the flow
[
{
"id": "9c48a93517202288",
"type": "tab",
"label": "weather map",
"disabled": false,
"info": "",
"env": [],
"_mcu": {
"mcu": true
}
},
{
"id": "3403a3249a2ab867",
"type": "openweathermap",
"z": "9c48a93517202288",
"name": "",
"wtype": "current",
"lon": "",
"lat": "",
"city": "",
"country": "",
"language": "en",
"_mcu": {
"mcu": true
},
"x": 130,
"y": 260,
"wires": [
[
"2aeef9be9b69b20f",
"b6b5811bd41331b5",
"d7eca73d6cf9f2e8"
]
]
},
{
"id": "98669820fb07f988",
"type": "ui_text",
"z": "9c48a93517202288",
"group": "f7e0493752f832d2",
"order": 1,
"width": "6",
"height": "1",
"name": "City",
"label": "",
"format": "{{msg.payload}}",
"layout": "row-center",
"className": "piu-text-city",
"style": false,
"font": "",
"fontSize": "",
"color": "#000000",
"_mcu": {
"mcu": true
},
"x": 530,
"y": 60,
"wires": []
},
{
"id": "b6b5811bd41331b5",
"type": "ui_text",
"z": "9c48a93517202288",
"group": "f7e0493752f832d2",
"order": 4,
"width": "6",
"height": "1",
"name": "Name",
"label": "",
"format": "{{msg.payload.weather}}",
"layout": "row-center",
"className": "piu-text-weather",
"_mcu": {
"mcu": true
},
"x": 530,
"y": 360,
"wires": []
},
{
"id": "1854be2db7779ebb",
"type": "ui_text",
"z": "9c48a93517202288",
"group": "f7e0493752f832d2",
"order": 2,
"width": "6",
"height": "2",
"name": "Temperature",
"label": "",
"format": "{{msg.payload.tempc}}°C",
"layout": "row-center",
"className": "piu-text-temperature",
"_mcu": {
"mcu": true
},
"x": 550,
"y": 160,
"wires": []
},
{
"id": "2aeef9be9b69b20f",
"type": "function",
"z": "9c48a93517202288",
"name": "prepare",
"func": "msg.payload = \"wi-owm-\" + msg.payload.icon;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"_mcu": {
"mcu": true
},
"x": 360,
"y": 260,
"wires": [
[
"b26bc0251e20efef"
]
]
},
{
"id": "9002c3190e74cc27",
"type": "function",
"z": "9c48a93517202288",
"name": "select",
"func": "let locations = [\n { city: \"Brussels\", country: \"Belgium\" },\n { city: \"New York\", country: \"New York\" },\n { city: \"Paris\", country: \"France\" },\n { city: \"San Francisco\", country: \"California\" },\n { city: \"Tokyo\", country: \"Japan\" },\n];\nlet index = globalThis.weatherIndex;\nif ((index == undefined) || (index == (locations.length - 1)))\n index = 0;\nelse\n index++;\nglobalThis.weatherIndex = index;\nmsg.location = locations[index];\nmsg.payload = msg.location.city;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"_mcu": {
"mcu": true
},
"x": 110,
"y": 160,
"wires": [
[
"3403a3249a2ab867",
"98669820fb07f988"
]
]
},
{
"id": "fdd6a5e06db1efa1",
"type": "inject",
"z": "9c48a93517202288",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "5",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"_mcu": {
"mcu": true
},
"x": 130,
"y": 60,
"wires": [
[
"9002c3190e74cc27"
]
]
},
{
"id": "b26bc0251e20efef",
"type": "ui_template",
"z": "9c48a93517202288",
"group": "f7e0493752f832d2",
"name": "Icon",
"order": 3,
"width": "6",
"height": "4",
"format": "<div style=\"display: flex;height: 100%;justify-content: center;align-items: center;\">\n <i class=\"fa-4x wi {{msg.payload}}\"></i>\n</div>",
"storeOutMessages": false,
"fwdInMessages": false,
"resendOnRefresh": true,
"templateScope": "local",
"className": "piu-template-weather",
"_mcu": {
"mcu": true
},
"x": 530,
"y": 260,
"wires": [
[]
]
},
{
"id": "d7eca73d6cf9f2e8",
"type": "function",
"z": "9c48a93517202288",
"name": "function 1",
"func": "msg.payload.tempc = Math.round(msg.payload.tempc);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"_mcu": {
"mcu": true
},
"x": 360,
"y": 160,
"wires": [
[
"1854be2db7779ebb"
]
]
},
{
"id": "f7e0493752f832d2",
"type": "ui_group",
"name": "Weather",
"tab": "0c757ed72ea6be1c",
"order": 1,
"disp": false,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "0c757ed72ea6be1c",
"type": "ui_tab",
"name": "Weather",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]
for this , apologize im not a developer , you will have to guide me in this.
you share the JavaScript stack trace from that point.
Regards, spillz
Another point off topic , i used these nodes and doesnt work . https://github.com/bartbutenaers/node-red-contrib-blockly This will come in handy when we can reuse blockly codes. Also MQTT works but debug give and unknown error for mqtt client . not critical , maybe we can treat it as a separate case. Regards, spillz
As a rule, third party nodes are not supported. In any case, please do not mix issues together. It creates confusion.
I just ran the weather example from the Node-RED MCU repository. It works just fine on ESP32. Here's what I did:
cd $NODEREDMCU/examples/dashboard/weather
mcconfig -d -m -p esp32/m5stack_fire ssid="my wifi" password="my wifi password"
In comparing the $NODEREDMCU/examples/dashboard/weather/flows.json
and the flow you shared above (thank you!), there is an important difference: your flow does not contain a ui_base
node. That node is required for all flows that use the dashboard to configure fonts, themes, etc. It is automatically created by the Node-RED editor when you use the dashboard.
If you are using the Node-RED MCU Plug-in to build and deploy your flow, the plug-in should automatically ensure that the ui_base
node is present. If you are manually exporting the node from the Node-RED editor, you need to export all nodes, not just the node with your flow, to have the ui_base
included.
Another point off topic , i used these nodes and doesnt work . https://github.com/bartbutenaers/node-red-contrib-blockly This will come in handy when we can reuse blockly codes.
Still off topic: Behind the scene, the Blockly
node is "just" a fancy function
node. Different UI, same runtime. I'll spend some time to check the effort of making it usable in node-red-mcu
.
(To avoid going further off topic, I've opened a Discussion for Blockly on the Node-RED MCU repository. Please continue this there.)
Hi @phoddie ,
My mistake , had deleled previously used , and now unused config files and since the flow checked as mcu doesnt run , the ui_base was showing as unused .
Since the other day of our conversation , noticed you were using linux , so set up a linux environment and the same error occurs for node-red-mcu plugin , moddable with weather example $NODEREDMCU/examples/dashboard/weather/flows.json .
as per your advice. Dont see a moddable sdk problem as the $MODDABLE\examples\piu\balls
examples work .
18 Apr 14:19:25 - [info] Node-RED version: v3.1.9
18 Apr 14:19:25 - [info] Node.js version: v20.12.2
18 Apr 14:19:25 - [info] Linux 6.5.0-27-generic x64 LE
18 Apr 14:19:26 - [info] Loading palette nodes
18 Apr 14:19:26 - [info] Node-RED MCU Edition Runtime Version: #a02cd43
18 Apr 14:19:26 - [info] Node-RED MCU Edition Plugin Version: v1.5.1
18 Apr 14:19:26 - [info] Moddable SDK Version: v4.6.0-6-g3d6d0f8
18 Apr 14:19:26 - [info] Dashboard version 3.6.5 started at /ui
18 Apr 14:19:27 - [info] Settings file : /home/<userName>/.node-red/settings.js
18 Apr 14:19:27 - [info] Context store : 'default' [module=memory]
18 Apr 14:19:27 - [info] User directory : /home/<userName>/.node-red
18 Apr 14:19:27 - [warn] Projects disabled : editorTheme.projects.enabled=false
18 Apr 14:19:27 - [info] Flows file : /home/<userName>/.node-red/flows.json
18 Apr 14:19:27 - [info] Server now running at http://127.0.0.1:1880/
Let me ask you what version of Node.js ,Node-red ,Node-red-dashboard , Node-red-mcu Plugin, Moddable SDK and ESP-IDF you are using , so that i can replicate the same and try out . Although initially this looked like a windows linux problem, since the issue was consistent, ruling out the same.
The errors from linux.
/home/<userName>/Projects/moddable/modules/drivers/mpu6050/mpu6050.js (62) # Break: bad WHO_AM_I ID for MPU-6050.!
Error initializing: bad WHO_AM_I ID for MPU-6050.
Wi-Fi connected to "GNXS-288A78"
IP address 192.168.0.100
/home/<userName>/.node-red/node_modules/@ralphwetzel/node-red-mcu-plugin/node-red-mcu/nodered.js (86) # Break: util.getSetting: cannot coerce undefined to object!
To stay in line , this time used the m5stack fire . It gives another error , guess its was discussed in some other threads, beleive its a non-issue for this case.
Next step is to downgrade the node-red-dashboard, node-red-mcu plugin to earlier versions and test as the problems comes up with UI nodes only .
Meantime any help is welcome .
Regards, Spillz
noticed you were using linux
macOS, actually. But, the OS where Node-RED runs probably doesn't make a difference here.
From your notes, the steps you are taking to build, deploy, and run the Dashboard flows are not clear. Without that, neither @ralphwetzel nor I can reproduce the problem and so are limited in our ability to help resolve this issue. Would you share step-by-step instructions that we can follow to reproduce the issue? Thank you.
Happy to provide what i did.
Hardware Devices : M5stack Core2 , M5stack Fire , M5Atom This is just for POC as we need a bigger screen. Node-RED version: v3.1.9 Node.js version: v20.12.2 Node-RED MCU Edition Runtime Version: #a02cd43 Node-RED MCU Edition Plugin Version: v1.5.1 Moddable SDK Version: v4.6.0-6-g3d6d0f8 Dashboard version 3.6.5
Flows: https://github.com/phoddie/node-red-mcu/blob/main/examples/dashboard/weather/flows.json
Followed the documentation at moddable for installing on esp32 devices and individually tested , esp-idf ($idf_path\examples\get-started\hello_world) , moddable sdk ($moddable\examples\piu\balls) ,nod-red-mcu plugin through the node-red plugin and using mconfig in the plugin cache folder. Tried in WIndows and then switched to Linux , Downgraded node.js to V14.7 and node-red-dashboard. All compilations had no error , but the runtime threw this.
/home/User/.node-red/node_modules/@ralphwetzel/node-red-mcu-plugin/node-red-mcu/nodered.js (86) # Break: util.getSetting: cannot coerce undefined to object!
Finally ended up looking into node-red-mcu and found out nodes/dashboard/ui_templates.js calling the fonts
const FONT = config.DASHBOARD_FONT ?? RED.util.getSetting(node,'DASHBOARD_FONT') ?? "Roboto" ;
Deleted the call and the runtime and it works . Right now im playing with the resolution and screen sizing.
Appreciate @phoddie for willing to help out , but it seems not to be a plugin error , would you recommend shifting this to node-red-mcu repo?.
Thanks for the additional info. I was eventually able to reproduce the problem. Simple fix. That's now committed. You just need to update/ireinstall the Node-RED MCU Plugin and you should be set.
Hi,
Been playing with this great piece of work, however ran into a small problem. While the flows work perfectly , except for some errors in xsbug, the dashboard dont appear on my m5stack fire and m5stack core2.
i do see these as undefined , however my esp-idf doesnt throw it when i do an mconfig on the mcu-plugin-cache with my esp-idf terminal
and
Also another point to highlight is
May not be an issue though.
With this resolution im hoping to continue my tinkering!
Thanks, spillz