zwave-js / node-red-contrib-zwave-js

The most powerful, high performing and highly polished Z-Wave node for Node-RED based on Z-Wave JS. If you want a fully featured Z-Wave framework in your Node-RED instance, you have found it.
MIT License
47 stars 6 forks source link

Enhancement : Use config nodes #32

Closed 0rsa closed 3 years ago

0rsa commented 3 years ago

Plugin Version What version of the node-red plugin are you using. 3.0.0 Platform Debian Buster

I cannot add more than one node in Node Red because each node try to bind zwave device ("Error: Error Resource temporarily unavailable Cannot lock port") This is a real issue for complex systems: you don't have the choice to create multiple flows to get a readable setup, I cannot manage my domoticz using a single flow.

marcus-j-davies commented 3 years ago

This won't ever work. A serial port can only be used, by one zwave driver (serial ports in general shouldn't be used by multiple process's)

If you need to create different flows, using the one zwave driver. Split the message, by node ID say - and pump them out to different flows using the link nodes

image

To have flows send to the zwave node, do the same with link nodes.

0rsa commented 3 years ago

I'll take a look.. Thank you I was using node-red-contrib-openzwave and there was no problem using multiple node because this plugin has a global config node. I think this is the way you have to use.

0rsa commented 3 years ago

https://nodered.org/docs/creating-nodes/config-nodes

marcus-j-davies commented 3 years ago

Yup,

I have this enhancement in the back of my mind (but the project was originally a private one, so i was a little bias 😄).

Will tag the issue as an enhancement for a future release. using link nodes, will give you the same affect for the time being.

0rsa commented 3 years ago

Noted. I agree about enhancement tag, better than "bug". Thank you!

marcus-j-davies commented 3 years ago

@hufftheweevil,

Fancy working on this? if not, I can start to explore soon, but not sure how the UI will need to be realigned with the main module.

EDIT: If this materialises, each 'client' node can be filtered to only output from a specific zwave node, and when sending commands, the node property can be omitted.

Will require some structural changes for sure. Have been needing to do this for sometime, this will warrant a major version change 🙄 .

I can start to explore, if your tied up

marcus-j-davies commented 3 years ago

Ok,

My mind is racing now, we could just introduce a new node i.e ZWave-JS Filtered to run along side the current. giving the ability to use either (but not both) - the new node will obviously use the driver instance from a config node., and multiples of this node can be used.

This will stop any breaking changes from happening, and feels like it can be a quick win.

marcus-j-davies commented 3 years ago

@0rsa,

First of all - I don't waste time 😄 Second, I have now made it possible to use multiple nodes (each representing a specific node ID)

1 copy of the Controller node is required in any of your flows, but you can now have any number of 'filter nodes' across different flows. The filter nodes only want 1 piece of information - the Node ID (multiple listener nodes, for the same ID can exist)

image

image

I am not using a config node here, as the main controller node will take care of all Controller based interaction. the controller does not need to be connected to anything , if you only deal with the nodes them self.

Doing it this way, gives you masses of flexibility.

You can omit the node property for messages going to filter nodes, but you MUST specify the node, if the message is going directly to the controller node.

I Have tested it my end, and it work well, I would be grateful, if you can see how you get along with it? we will make this available in 3.1 - if proves to be worthy.

Its available in our dev branch

0rsa commented 3 years ago

Considering my current flows, I really prefer the workaround you provided in your first post. Migrating from node red openzwave to node red zwave js, the logic remains the same (a single entry point where you specify a node id at entry).

I don't waste time 😄

We agree. Using zwave filter SINGLE node, I have to change all my flows to add specific nodes, it is less flexible than a single node imho.

I did not know the links between flows. I find this to be a good workaround, you just need to know it.

Below a printscreen of my flow which manage my lights (all lights are controlled by motion detectors and the brightness adapts according to two exterior light sensors), which gives a crazy flow... You can see that I integrated the link node which works wonderfully as expected:

flow

flow2

Maybe you can close the ticket, there is no need for improvement through node links if it costs too much time.

marcus-j-davies commented 3 years ago

Will keep it open, as this was an enhancement I wanted anyway.

Oh, and that is some serious flow work.

marcus-j-davies commented 3 years ago

Version 3.1.0 Released

hufftheweevil commented 3 years ago

@0rsa like Marcus said - those are some serious flows. Check out my node-red-contrib-things to see if would help you reduce some of your logic to more manageable segments.