Hello
I have been tinkering a little with this and it does actually work.
The only thing is that you must point the topic of the mqtt node directly to a child. Its not possible to just subscribe to topics higher in the hierarchy.

For example in MyMQTT app on Android i can just subscribe to topic MyMQTT and then i get messages from all nodes connected to the Gateway. This is not possible with the mqtt node in NodeRED. You must specifically point it.
below is and example of an mqtt node outputting to a debug node. My Gateway is at 192.168.1.201.

I am working on some code to push temperatures as an object trough a websocket for live viewing on a simple webpage.
It maybe sounds advanced, but it is actually very easy. In my opinion Node-RED is just as powerfull as OpenHAB and not particulary more advanced either. Will post a full working example when i have everything ready.

ok so here is a example.
please note, i am not a programmer so the code might not be the slickest, but it does its job.
What this on is doing is basically emulating 3 mqtt inputs, whit options to see 2 different temperatures.
Send it over via websocket and also use a http request node to serve a webpage straight from nodered, styled and everything, but without use for a server. Pretty nifty
So now i must just create 3 temperature sensors and add them instead of the input nodes.

Whenever the CO2 value changes it is forwarded to the local mosquitto broker via topic fehm/CO2
Now you any client in the world that has access to the raspberry my subscribe this topic. You simply have to
know the IP address of the MQTT broker.

install Node-Red on the raspberry

open the Node-Red window of the raspberry <IP>:1883

drag the MQTT input node to the sheet

configure the MQTT input node so that it uses the local broker and the topic from above

drag a debug output node to the sheet

connect both

Deploy

--> The CO2 values are printed in the debug window.

The same can be done from within bluemix with the difference that node-red runs in the cloud accessing your local broker in the raspberry.

@Heinz Thanks a lot for the details. Actually i am looking out for a confirmation and method/way of using the nodejs controller code in NodeRED somehow (looking out for direct porting or with minimal effort) so that all the functions of a MySensor controller may be made available under NodeRED and hence a NodeRED Controller for MySensor...

This way we may port many other functionalities available as nodejs scripts into NodeRED controller...

I also use node-red with a serial gateway attached. I created a flow that converts the serial payload to a mqtt type payload and it is picked up by openHAB. This also works the other way around. openHAB sents everything out via mqtt and node-red picks it up and parses it back into a serial formated payload which is picked up by the serial gateway. I also use node-red's Owntracks node to monitor my proximity and send updates to openHAB as an mqtt message and I also have a flow that monitors my phone and my wifes phone, if we are both home the outside lights get turned off at 22:00. node-red also sends twitter messages to me when my doors and windows are opened and no one is home.

I only use mqtt with with a combiniation if nfr radios via the serial gateway, like I mentioned above, and I also use ESP8266 modules running lua. So as not to send the wrong payload to the serial gateway, all topics that come from openHAB that are destined for the serial gateway start with RF24SN/out/... and on node-red I subscribe the RF24SN/out/#. This will capture all those message and they will get parsed to the serial format (Nodeid;clientid;message;...etc).

Everything that happens in node-red is passed to openHAB. I have a couple of relays and leds I control from openHAB. The leds use the MySensor LEDDimmer. Basically node-red acts as the middle man between the serial gateway and openHAB/mqtt.

The only thing is that you must point the topic of the mqtt node directly to a child. Its not possible to just subscribe to topics higher in the hierarchy.

For example in MyMQTT app on Android i can just subscribe to topic MyMQTT and then i get messages from all nodes connected to the Gateway. This is not possible with the mqtt node in NodeRED. You must specifically point it.

You can capture all higher level topics by using the # symbal. As I mention above, my openHAB sents RF24SN/out/.... and on node-red I have an mqtt node that listens for RF24SN/out/#.

All glued together with node-red: the OpenHab Items have no mqtt binding, all messages are exchanged via the OpenHab internal bus.

Messages from any sensors are transformed in node-red to the destination (topic and payload)

The advantage of this setup is:

OpenHab is only the GUI and doesn't need to know anything about the sensors

I can exchange any sensor/actuator without any change in OpenHab. I can even change from a netatmo device to a mysensor device or vice versa.

I was thinking about replacing the MyMQTT Client Gateway with a Serial Gateway and node-red, but the gateway is stable since weeks.... never touch a running system. This would solve my biggest concern with the MyMQTT Client Gateway: it doesn't support encryption....

The following node-red sample illustrates how the data sent by the serial gateway can be analysed.
The upper lane receives the data from COM-Port, splits the incomming message into single tokens and feeds the result into
a switch block.
The lower lane implements a http request which displays data for message type "set".
The result of this simple sniffer looks like:

On the top right I added a debug node to visualize the incomming data:

This should be a minimalistic sample to get a feeling for how much work it would take to implement a fully functional controller.
If the "presentation" messages would be fed into some no-sql database like mongoose, answering nodeid-requests shouldn't be a challenging task. In the end I think this could be done in 1-2 days.

where are you storing the sensor data for presentation , stream. let me know which database you are using here? you can have another flows for sending the the request to sensor node via serial port. I tried it same some time back . may be i can share it here.

where are you storing the sensor data for presentation , stream. let me know which database you are using here? you can have another flows for sending the the request to sensor node via serial port. I tried it same some time back . may be i can share it here.

I've used NodeRED for various tasks over the years and it still remains my favorite IOT interface. All the while I've tried at least 5 of the officially supported MS controllers out there and nothing has come close! At present I'm trying Home Assistant but am almost ready to give up and set up my own workflow with NodeRED. There's a blog post at https://crankylinuxuser.net/2015/10/01/idiot-crazy-ways-to-make-iot-simple-and-cheap/ that includes a great example of a MySensors+NodeRED flow along with a spot-on critique of mainstream automation services being marketed at present.

The only reason I havent just used NodeRED in the past is it would still require other components to truly make a unified home automation service. An ideal scenario IMHO would be something that uses NodeRED as a front-end with something more unified running it.

Hello! I've not had a chance to update my blog with new updates. I'm busy with converting over my site to a pure node-red backend and being able to push updates via NR on my laptop via clone-flow. But that aside....

There's currently a regression in the newest serial port node in NR.

Arduino Nano->SerialGateway->NR->MySensors works with receiving data. However
Data->MySensors encoder->Serial is currently not working. It's NOT MySensors' fault. If I open up console on Serial gateway and an actuator, I can manually send commands and show that radio does in fact work.

Where I am at now, is trying to figure out where the node-red-node-serial is in error. I know the recent node.js has caused havoc in the node-red ecosystem, mainly with hardware-to-node modules.

But I'm glad people are referencing my work thus far

The CrankyLinuxUser (whois for email/phone) if you have any further questions.

Ok. I think I finally got to the root of the issue. It's a mixture of "Inject" and mysdecenc errors. Inject mangles "\n" on the string inject node, and mysdecenc doesn't add the proper ending of the payload "\n" to complete the transmission from the gateway to the node.

I have a flow, and inside it is 2 duplicate paths of the same data. The upper one is a manual MySensors node-red node done with functions, and the lower is using the node-red-contri-mysensors nodes.

@cranky
Yep - you are right
Does anybody had a problem with retained messages from mqtt broker?
Seems to me I am receiving only some retained messages from mosquitto - not all of them Looks like it's a bug in nodered mqtt or mosquitto.

Node-red is great. I'd be interested in entire flows, entire integrations for home automation purposes (ofc with credentials data taken out). So if anyone has something interesting to show please share thanks

Ack from node to gateway are AFAIK handled by the gateway. So this is not your recquirement.

Then you are maybe looking to send messages from node-red to some nodes with the ack flag set and if you don't get the message back within xx seconds you want to have transmitted it again up to n times.

Yes my requierement is to send ACK from node-red controller, wait 1s for the message back from the node and send it 5 times. If it's not ok I let the swtich (only example, it can be another actuator) in the last state. For only one message it's quite easy but when you want to handle multiple message (and sometimes the same command), it's more difficult to handle the queue correctly.

I have a multi-protocol setup and use sensors from zwave, homegear, netatmo, mysensors, sonoff, mystrom... All the messages are standardised and everything can talk to everything (in theory, wired via node-red). This setup is quite complex but very flexible. If you want to control mysensors-devices only, this may be to complicated.

Warning: following code was not intended for general usage by anyone else but me.

@FotoFieber
I like your approach to a Node Red implementation of a home automation controller for MySensors. I understand that the code has grown to the point where it will no longer fit in a post. Could you please upload your code to your GitHub so that the whole program is visible?
I understand that your code may not be up to date for the latest version but what I've seen of your code has already helped to improve my MySensors 2.3.0 compatible version.

A little clean up in notepad++ and I have a working flow!
I made some modifcations (of course) for my setup. The main one is the ability to get the sensor value type. Initially the code in the Parse node did:

@chisight I had done the raw file import. Issue I was facing was with the single/double quotes being interchanged. Easy fix. I am not sure if my "fix" for the VString was necessary. I just wanted to see what each sensor value was going to return. I need to get my DB setup a little better (using SQL Server as I cant stand the rigidness of time-series DBs like Influx).

@wergeld Odd, I went to the raw file, hit select all in Firefox and right click copy, then went to Node Red and did the import from clipboard, no edits. Maybe it's something related to Windows, I did mine through Debian.
Still, good to know that some paths need the single/double quotes repaired so thank you.