Closed rei-vilo closed 1 month ago
Any errors in the console or on the Node-RED side?
I am seeing the same thing with node-red running on a Pi, but with NR running on a PC it is OK. Both the latest versions of NR and D2. The failing system LED does not show up when viewed from a PC or my phone, but on a 7" tablet it does show up as a tiny dot a few pixels across, unless I switch off frame and glow in which case it disappears from there too. Some sort of scaling issue possibly. No errors in NR log or browser console.
Do you see the label? Or is the whole thing invisible?
Having now provided a label, the label text does appear, just not the LED itself.
This is what it looks like on the tablet
but on the phone or PC the red/green dot is not visible at all.
I think we have a couple of different issues going on:
CSS related issue, which is preventing the LED from showing properly (possibly linked to older browser that don't support aspect-ratio
There is a build issue whereby widget.src
is not being set on the third-party widgets:
if (packageJson && packageJson.dependencies) {
Object.entries(packageJson.dependencies)?.filter(([packageName, _packageVersion]) => {
return packageName.includes('node-red-dashboard-2-')
}).map(([packageName, _packageVersion]) => {
const modulePath = path.join(RED.settings.userDir, 'node_modules', packageName)
const packagePath = path.join(modulePath, 'package.json')
// get third party package.json
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'))
if (packageJson?.['node-red-dashboard-2']) {
// loop over object of widgets
Object.entries(packageJson['node-red-dashboard-2'].widgets).forEach(([widgetName, widgetConfig]) => {
uiShared.contribs[widgetName] = {
package: packageName,
name: widgetName,
src: widgetConfig.output,
component: widgetConfig.component
}
})
}
return packageJson
})
}
This logic runs through the dependencies of Node-RED and checks for any third-party widgets. it then stores those widgets into a contrib
object, including a value for src
. Then
widget = {
id: widgetConfig.id,
type: widgetConfig.type,
props: widgetConfig,
layout: {
width: widgetConfig.width || 3,
height: widgetConfig.height || 1,
order: widgetConfig.order || 0
},
state: statestore.getAll(widgetConfig.id),
hooks: widgetEvents,
src: uiShared.contribs[widgetConfig.type]
}
Builds the full widget
object and sends it to the client, but in the case of the third-party widgets, src
is missing.
This is important client-side in the logic that the Vue app uses to render out a component:
if (widgetComponents[widget.type]) {
// Core Widgets
// allow for types not defined in code Dashboard, but assume they're utilising ui-template foundations as recommended
widget.component = markRaw(widgetComponents[widget.type])
} else if (widget.src) {
// Third Party Widgets
const resource = `${widget.src.package}/${widget.src.src}`
widget.component = markRaw(importExternalComponent(resource, widget.src.name, widget.src.component))
} else {
// Old Third Party Widgets
widget.component = markRaw(widgetComponents['ui-template'])
}
Note that because widget.src
isn't being set (not sure why yet), Vue app is falling back to assuming it's a core component, or old third-party widget, which doesn't then exist, so it renders nothing.
In my case, the group was entirely empty, and I had to update node-red to get it working. I did a dist upgrade and node-red update with the doc's here: https://nodered.org/docs/getting-started/raspberrypi#installing-node-red from NRv3.1.3 to 3.1.5. Now I see the LED's and labels.
Restart of Node-RED after installing the third-party widget does seem to be resolving the problem
For me a restart does not make the LED appear.
For me a restart does not make the LED appear.
hmmm... well that's very odd then. How do you have your Node-RED installed? Are you able to share your Node-RED's package.json
please?
Should be available at:
~/.node-red/package.json
Also, please look in ~/.node-red/.config.nodes.json
and find the entry for @flowfuse/node-red-dashboard-2-ui-led
including the full path of where it was loaded from. That will help us understand how/where/if the runtime is finding the node - and (if it is being found) why dashboard isn't including it.
Also, please look in ~/.node-red/.config.nodes.json and find the entry for @flowfuse/node-red-dashboard-2-ui-led including the full path of where it was loaded from. That will help us understand how/where/if the runtime is finding the node - and (if it is being found) why dashboard isn't including it.
Would this be a more reliable check for me in https://github.com/FlowFuse/node-red-dashboard/blob/b515138220e56773288c40037514555014363244/nodes/config/ui_base.js#L90-L111?
The failing install is on a Pi running bullseye, with node red installed using the recommended bash <(curl script
The working one is on a PC running Ubuntu 20.04 using the same install technique.
To double check, on the pi, I removed the led node instance from the dashboard, uninstalled the node and restarted node red and checked all is well. Then I installed the led node and restarted node-red, then added an led instance and restarted again, and checked it was still not visible when viewed from PC browser or Phone, but does show a small dot when viewed on the tablet.
Using the developer tools when I inspect the element I see this popup It is showing size 0x0.
When I do the same with the PC install it shows
Presumably viewing it on the tablet it would show a small size, but I don't know how to do that on a tablet.
.config.nodes.json has this entry
"@flowfuse/node-red-dashboard-2-ui-led": {
"name": "@flowfuse/node-red-dashboard-2-ui-led",
"version": "1.0.0",
"local": true,
"user": true,
"nodes": {
"ui-led": {
"name": "ui-led",
"types": [
"ui-led"
],
"enabled": true,
"local": true,
"user": false,
"module": "@flowfuse/node-red-dashboard-2-ui-led",
"file": "/home/colinl/.node-red/node_modules/@flowfuse/node-red-dashboard-2-ui-led/nodes/ui-led.js"
}
}
}
I do see the label for the led so I presume that means that it is loading it ok. package.json has
{
"name": "owl flows",
"description": "A Node-RED Project",
"version": "0.0.1",
"private": true,
"dependencies": {
"@flowfuse/node-red-dashboard": "~1.1.0",
"@flowfuse/node-red-dashboard-2-ui-led": "~1.0.0",
"@node-red-contrib-themes/theme-collection": "^3.0.6",
"node-red-contrib-cron-plus": "~2.1.0",
"node-red-contrib-fs-ops": "~1.6.0",
"node-red-contrib-influxdb-backup": "~0.1.0",
"node-red-node-email": "~2.1.0"
}
}
All nodes are at the latest versions. The working version on the pi also has all those nodes at the same versions so that suggests that it is not an interaction with one of those.
I have found it, I have a CSS(All Pages) template specifying a class for the groups to reduce the wasted space. I got this from a suggestion on the forum. If I disable the template then the led works correctly. It contains
.condensed-layout{
--layout-gap:0px;
--widget-row-height:24px;
}
.condensed-layout .v-card-text .nrdb-ui-widget{
padding-inline:.5em;
align-items: center;
}
.condensed-layout .v-btn.v-btn--density-default{
height: fit-content;
}
.condensed-layout .v-input--density-default {
--v-input-control-height: 26px;
--v-input-padding-top: 8px;
}
Unfortunately then my dashboard does not display nicely on my small display. I will experiment to find exactly what is causing the problem, unless someone can immediately tell me.
Removing align-items: center
from
.condensed-layout .v-card-text .nrdb-ui-widget{
padding-inline:.5em;
align-items: center;
}
fixes the problem with the LED.
The issue with rendering third party widgets, without the need for a restart of the Dashboard was resolved in 1.16.0
, so this should now be resolved too
Restart of Node-RED after installing the third-party widget does seem to be resolving the problem
Agreed - and this is one of the nodes i tested Joe.
closing for the time being.
Current Behavior
The LED does not show up on the dashboard.
However, it does shop up on MacBook / Dashboard-2.0 1.1.0 / Node-RED 3.1.3 / macOS 14.3.1 (23D60) / Safari 17.3.1 (19617.2.4.11.12) / Node v18.17.1 /
Expected Behavior
The LED shows up on the dashboard.
Steps To Reproduce
Minimal code
Environment
Have you provided an initial effort estimate for this issue?
I am no FlowFuse team member