Node Red integration

I have created a Vellbus integration with Node Red, a visual tool for wiring the Internet of Things and connecting hundreds of IOT devices.

You can find my project called node-red-contrib-velbus here or simply install it in your Node-red setup by searching for ‘Velbus’ in the “Manage Pallete”
install section.

It’t still early days, but the most important nodes are working.

Now I can finally talk to my Velbus modules using Google Home (using Nora, the wonderfull integration by Andrei Tatar!
I can also switch on/off my Hue lights using existing Velbus Buttons, which is really convenient.

For now, I only have support for VMB4PB and VMB8PB (button modules), but that should be easily extended to other modules.

To send basic comands to (unexisting) modules, I also made a “Raw Bytes” node. Here you can send whatever raw Velbus packet. I’m using it to synchronise the time to all modules any week.

A few rough edges still need to be smoothed, so I hope to do quite a few updates in the next weeks and months.

Please tell me about your findings, request and issues. Happy to help!

Enjoy,
Gert

2 Likes

Hey Gert,

is there a reason why you want to communicate directly to velbus instead of using for ex openhab to do the trick?

Hi Gert,

the NodeRed project seems very intuitive and permits lot of interaction. I’m trying to use Raspberry PI to convert my old solution (under WinXP) to a new solution, able to evolve.
I was thinking about Java, Python, C++… never think NodeJS was available to do that… and more, NodeRed.

Could you give me some advertisement to do this conversion ?

  • did you create a server mode ?
  • is the service online or local ?
  • etc. (too much questions in fact)…

Thanks a lot,
Golfy

@jeroends I feel openhab is too much linked with a cloud service to create architecture, maybe Gert is (as me) wanting a completly controlled solution ?

Hi

FYI

The connection to a cloud for openHAB2 is completely voluntary, just to enable remote access.

The actual openHAB2 instance is run locally :slight_smile:

Sometimes I tunnel in via a SSH session instead.

It’s also interesting to know that if it connect via the cloud service, you can’t delete anything. (This confused me for a while)

I’m really curious to see what can be done purely with Node-Red.

Hi @MDAR :slight_smile:
I’m very interested by NodeRed, but that’s mainly because I’ve learned NodeJS programing !
The other goal is vocal commands, Gert seems to have solved it…

But like you, I’m very curious about NodeRed and it graphical interface for programing IoT (and then Velbus too). :slight_smile:

1 Like

@Golfy when you want to use voice controlled commands like for example google home, there is also a cloud connection needed. You can’t use google home without using the web. That why I was wondering if using node red (which is also included in openhab to create coplex functions) isn’t it making it to complex while controlling velbus with google home can be very (very!) simple.
For example, when creating scenes it is nice to adjust them dynamicly. example: https://www.youtube.com/watch?v=UJoxcxXC8qQ .
For myself I’ve used a nodered and velbus combination to control wireless somfy screens while emulating vmb2ble, not perfect yet, but working ok.

1 Like

4 reasons:
1- I wanted this to be as reliable as possible
2- I wanted to use as less possible platforms/environments/… as possible
3- I’m a JS developer and using other languages would violate reason 3
4- I was too lazy :wink:

But I agree using an in between proxy server also has its advantages…

Node-red has quite some advantages:

  • runs on nodejs - a fast and easy to learn platform for web developers like me.
  • easy to set up on a Raspberry Pi
  • npm plugin based: very handy to share code and learn from others code
  • most important: plugins for all major (and small) IoT devices are available due to the large community
  • I needed simple connection between my Hue lamps & my Google Home. With the few lines of code that I wrote, I can ask my Google home to switch on my mood lights that consists both of Velbus dimmers and Hue lights. How cool is that :wink:
  • runs locally on own hardware - no third party involved (but possible if needed)

Disadvantages:

  • documentation can be better
  • relatively new and thus still under construction

To answer your questions though:

  • What do you mean with “a server mode”?
  • The service is totally offline: direct communication with the Velbus USB module. Of course, if you want to connect to Google Home or Philips Hue, you have to use a connector that goes online to connect to the online REST APIs, but that’s due to the setup of those IoT platforms. But that does not mean that your Pi is open to the internet: as far as I know it’s quite well sandboxed.

The GUI of Node-Red is good for several reasons. It’s a nice and easy way to connect IoT platforms without having to know the inner workings.

But if you want to dig a little deeper it is still not overwhelming because each IoT connector is just a well structured npm package, ready to be explored/cloned/forked/…

Here is a demo Node Red Flow to connect Google home to Velbus.


The above Flow switches on the mood lights (sfeer) when I say “Hey Google, switch on the mood lights” and turn them all lights off when I say “Hey Google, switch off the mood lights”.
The left node picks up a Google home command, the switch divides between “on” and “off” and 2 the “press” nodes convert the “on” or “off” payload to a “press” payload to pass through the Velbus nodes on the right.
I only had to program the Velbus part, of course.

Here’s a flow to switch off my Philips Hue lights when the Velbus buttons “All off” are pressed.


Velbus takes care of all my Velbus-connected dimmers/relays, but using this flow I could also connect the few Hue lights I have.
The “Turn off” node converts the payload to expected format for the splendid HueMagic connector.

Here’s another one:

It looks daunting at first sight, but is not :wink:

This Flow controls a relay that feeds all the electric gear I have behind my TV drawer. It powers a tv, chromecast, audio receiver, DVD, small clock, game console, …)
These small consumers take quite some power even when not in use, so I wanted a ‘smart’ way to switch them off entirely when not needed.

Top right of the image: a node “TV Kast” that controls a flashed Sonoff relay:

  • runs over Wifi using a MMQT server on my PI
  • very cheap: only 4.17 EUR! That’s right.
  • runs offline, so no spyware possible: no internet connection required due to a custom open source firmware called ESPurna.
  • reliable: works very snappy without any issues for 7 months now!
  • of course MQTT and Sonoff connectors are available for Node-Red.

Top left of the image: turn off at 00h15 and turn on again at 6h15, each day.

All the red nodes are my Velbus switches that overrule the default daily on/off sequence. You get the point.
Still not very smart, but that’s the beauty of Node-Red: you can tinker with the user friendly user interface if you have some spare time. You don’t have to dig deep into code to finetune some logic: all is possible by dragging some nodes around :wink: So I will finetune this flow for the days to come.

I used OpenHAB for some months, but I had a hard time to understand what’s going on under the hood.
The combination of using PaperUI and config files makes it very confusing for beginners.
Solving configuration issues was no fun, although I must say the Velbus connector from Cedric is really good and MDAR did help me a lot. (tx guys!)
Last but not least: I’m not a fan of java/python, but that’s personal preference.

So that’s why I decided to switch to Node-red. I’m a web developer, so having to deal with javascript was like coming home! :stuck_out_tongue:

It’s a pity that NodeRed does still work with jQuery instead of Vue/React/Angular, but hey…

1 Like

Hi Jeroen,
As a matter of fact, it would be quite handy to be able to connect to Velbus over tcp/ip :wink:
If it runs stable and without issues, what usb 2 tcp/ip tool for Velbus can you suggest to run on a Pi?

I’m a novice Pi/Linux user, so any link to a tutorial on how to set it up as an auto-restarting service would help me a lot!

Gert

Have you seen this?

https://forum.velbus.eu/t/how-to-install-and-run-velserv-a-velbus-tcp-gateway/15422/21

Exactly what I need, thanks!

1 Like

Exactly what I suggest :slight_smile: . Runs stable since 2007-2008 (somewhere over there).
It just had a minor update, it appeared I forgot for years to set the RTS and clear the DTR lines. Never had a problem with it but when using a serial cable it could give a problemn.

2 Likes

Hello Gert ,

can you give the node-red code of this example?

greetings

I’m on holiday this week, so I’m not able to access my node red in the next 8 days, but I’ll do thereafter.