Open thohoj opened 2 years ago
Please provide a debug log (set instance of node-red to debug loglevel) of that above and tell exactly what you expect to be changed. From your words I'm (as the "not using node-red nor MQTT-in-node-red" developer) have no real idea what your issue exactly is :-) Give me more details (like your speak to a node-red/mqtt dau) ;-)
First of all: the in node seems to work with MQTT formatted topics.
topic: 'shelly/0/SHBDUO-1#483FDA928A8B#1/lights/Switch'
topic format: MQTT (with '/') (the default!)
This worked afer reloading the node-red page. Apparrently my browser dropped some of the logs.
-- The issue with the out node left. I have reduced this to a simple flow:
If the switched was pressed on the brightness should be changed. Here is the code of the function node:
if (msg.payload === false) return null;
const path = msg.topic.split('/');
msg.topic = path.pop();
path.push('brightness');
msg.topic = path.join('/');
msg.payload = 30;
return msg;
Here is the debug log after switching off:
The catch apparently did not work, but from the ioBroker log:
7b5e078317b38286: Automatic objects creation is not enabled. You can enable it in the node configuration
7b5e078317b38286: "ioBroker out" Cannot set state of non-existing object "node-red.0.shelly.0.SHBDUO-1#483FDA928A8B#1.lights.brightness".
Thank you, that helped, will look into it soon
Seems the problem is, that the "ioBroker out node" replaces '/' with '.' after checking the adapter prefix of the ID on node input. So the node does not recognize an adapter namespace and prefixes it with 'node-red.0.'.
I have done some changes in my forked repo and would test these in my ioBroker instance. But I dont' know how. Is there a tutorial / documentation / howto?
I have done some changes in my forked repo and would test these in my ioBroker instance. But I dont' know how. Is there a tutorial / documentation / howto?
In fact change the same files the same way locally in /opt/iobroekr/node_modules/iobroker.node-red ... and restart the adapter ... should have immediate effect. Thats easiest to test for you I think
I created an ioBroker in node with
But the node never outputs a message. This is confusing.
If I change
The node outputs messages and re-formats the messages topic to MQTT (with '/'). Now it makes sense.
Later on such a MQTT-topic-formatted messages arrives at an ioBroker out node and an error message is shown:
Seems that the ioBroker out node tries to reformat the MQTT style topic into an ioBroker style topic but prefixes it with the node-red instance name.
As a node-red user I want to work with a consistent style of topic without converting it every time from one format into another. This keeps my flows clean and reduces bolierplate code. The step to MQTT topics was good, but all ioBroker nodes should be able to handle it uniformly.