New Item From MQTT String

#1

Hi,

How can i import new interface item from mqtt in. Is there any way? I tried with this;

MQTT in Message is (Just Button):

[{"id":"c4accaa0.f051c8","type":"ui_button","z":"dee1786a.e72988","name":"","group":"adaa1f33.f289d","order":0,"width":0,"height":0,"passthru":false,"label":"button","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":810,"y":240,"wires":[[]]},{"id":"adaa1f33.f289d","type":"ui_group","z":"","name":"Zamanlama","tab":"fabad21f.962f4","order":4,"disp":true,"width":"3","collapse":false},{"id":"fabad21f.962f4","type":"ui_tab","z":"","name":"Icerenkoy","icon":"dashboard","order":1}]

0 Likes

#2

Can you explain a bit more what you are trying to do?

It looks like you have published a ui_button node config over mqtt. And you want to dynamically add that to your dashboard? If that is the case, then there is no practical way of doing that. You can only add/remove nodes by deployed them to the runtime. At a stretch, you could create a flow that uses the Node-RED http admin API to get your current flows, merge in the new node(s) into the flow JSON and then post it back to the runtime to deploy it. But that's really quite an involved process.

It may be easier to hear what your actual user need is, and we may be able to suggest more practical ways of satisfying it.

0 Likes

#3

If you were happy to not have the convenience of Dashboard, this is possible with node-red-contrib-uibuilder which allows you to dynamically pass html and javascript from Node-RED to the front-end.

Currently, though, you would have to build your own widgets as that is a project that I've not yet had time to start. I do want to create a widget library for uibuilder that allows dynamic addition of widgets but I just don't have the time to start such a project right now.

0 Likes