Node Red integration

Been playing with node-red but stuck now as I have hit a bug / unsupported feature scenario. I have filed an issue on GitHub.

What I am trying to do is get one button on my VMBGP4PIR to cycle through turning on/off 3 lights in my lounge, like so:

L1 -> L2 -> L1&2 -> L3 -> L1&3 -> L2&3 -> L1&2&3 -> all off

I would then want to add in a long press to switch on/off all 3 lights together, so as perhaps the last 2 steps can be offloaded to a long press, a short press will only need to cycle through the first 6.

Rather than begin at L1 every time, I would like to query the status of the 3 light relays and move on to the next step, and this is where I have hit a brick wall. I am using the relay nodes, as is, with velserv, address and channel configured. The odd thing is that for all my relay modules, a relay node pointing to Channel 1 works fine - the status changes to true/false depending on whether it is closed or not. For the other 3 channels, the status does not change. So, I am not sure if the relay node could (or meant to) be used this way? I could perhaps start by ensuring that all lights are off, and save the (expected) state as a variable for use later. Just concerned that it could go out of sync and mess things up though.

Another issue is that the relay nodes “toggle” works from off -> on with all the channel I tested, but not on -> off.

Oops - had forgotten to test the toggle with Channel 1 relays. Channel 1’s toggle correctly.

I see

So you are Mr BlendedAlmostCheese :wink:

I still think what you’re trying to achieve would be easier with openHAB2 items, as you can then easily query the state of OH Items to condition your logic by using an openhab_get node.

I’ve done this for a client already, I’ll send you the Flow I created so you can see what I did.

I think the problem is on line 58 in node-red/velbus-relay.js
I have changed the line “this.isOn = Utils.bitAtGivenPosSetOrUnset(packet.getDataByte(3),channel);”
to “this.isOn = packet.getDataByte(3);”

I am now getting status for all channels and all channels toggle too. I have update the issue on GitHub.

1 Like

Playing with another kind of home automation for the last months :wink: I just made it public here and I will probably add some more photos. So my Node-RED projects are on the back burner right now…

I think that’s indeed all to be done.
I will try to add this later next week, together with the update/fix for the Relay node. :wink:

Thanks for helping out finding the issue, @rrajagopal! I replied on Github with some more details.

1 Like

I try to read the payload coming from the “receive raw bytes”, but in the debug window the message doesnt appear, ik get “msg.string : undefined”
Any idea how I can parse it, so it could be readbale, I want to detect in which mode a thermostate is set.

Hi, I guess your debug node is not set up right: there is no “msg.string”, so that will not work. Can you verify that the debug node has its output property set to “msg.payload”? “Complete msg object” should also work.
Please let me know if that helps or if other issues pop up.
Gert

I see a lot of data in my debugger now, but I can’t isolate the comfort/da/night/safe mode.
Can you check my flow below ?

[{“id”:“3145e484.407b3c”,“type”:“velbus-send-raw-bytes”,“z”:“be2aa24d.ddc6e”,“name”:“status request 24”,“connector”:“a5de91c.f7bb47”,“commandName”:“temperature sensor request settings “,“dataBytes”:2,“dataBytesType”:“234”,“address”:0,“addressType”:“36”,“priority”:248,“rtr”:0,“x”:1010,“y”:280,“wires”:[]},{“id”:“a5de91c.f7bb47”,“type”:“velbus-connector”,“z”:””,“ip”:“10.0.0.240”,“port”:“6000”}]

I think he may be referring to the channel which is always undefined.

I’ve noticed this even that there’s actually an error in the documentation regarding channels of the set-relay-on command. Not sure if it’s related. (Anyway, created a ticket)

It has been some time since I played with Node-RED and Velbus and I found that I was still having some issues…

  1. Quite often, the relay nodes will come up as “Velbus Ready” and not actually show its status until it was toggled.
  2. I could not get the status to show for any channel apart from Channel 1. This was because the protocol is different for the VMB4RY which you have and the VMB4RYLD, VMB4RYNO and VMB4RYS that I have.

I have put in a pull request at Added module name and type to relays to determine the correct channel and status bits by smoothquark · Pull Request #8 · gertst/node-red-contrib-velbus · GitHub

1 Like

Do you fancy taking a look at the VMB4DC & VMB4AN 10V (dimmer) outputs too?

Dimmer works in Node-Red for VMBDMI-R & VMB4DC, but only for Channel 1

To use other channels, I have to use the the raw packet and define the command.

(Not a problem, it’s easy enough, it would just be nice if the dimmer node did the magic)

FYI

I think it would almost certainly be the same code. I don’t have either VMBDMI-R or VMB4DC though. Shall see if I can try and conjure up something in the next few days and send you a patch to try.

1 Like

That’s very kind of you.

You do have a VMB4AN you could try it with.

You’re welcome to remotely connect to a demo rig here if you really to experiment with anything.