How to answer multiple nodes request with the same value

Hello everyone.

I have multiple nodes at home programed to request a numeric value from the controller by the time they bootup.
That numeric value is the same for all nodes, and it is a numeric item in OpenHAB configurable by a Setpoint in the sitemap.

What I need to know is how can I make a rule and define the items, to answer all these requests without having to create an item for every node, and link it with a channel.

The hard way, would be to create an numeric item for each node, and link it with the corresponding channel. Then create a rule for answering the request for each node.

Hope you can understand what i mean.
Thanks, regards!

Since you are talking about channels I’m assuming you are using OH 2.

Unfortunately I can’t answer for OH 2 but perhaps the OH 1 approach would be enlightening.

The first question is how do the nodes request the number from OH? That will largely dictate how you can approach the solution. For example, if your nodes send MQTT messages you can create one Item to receive the request, parse the message, and post the number to the appropriate destination. However, if the nodes communicate in such a way as to need a separate Item to communicate it becomes a little harder but not impossible to do from one rule. In OH 1 I would trigger the rule for any incoming messages from any node, figure out which Item triggered the rule by pulling it out of a Group based on lastUpdate, and respond.

Thanks for you answer Rich.
I’ve decided to simplify things and instead of the node requesting the value, I am sending the value to the node everytime the numeric item is changed.

The problem now is, how do I send that numeric value to multiple nodes without creating a numeric item for each node?

This is what I have now for only one node:

Dimmer Heart_Rate "Heart Rate (mins)"	<clock>	(MysqlPersisted) { channel="mysensors:dimmer:gateway:Heart_Rate:dimmer" }

I need to find the way to send the Dimmer value to all the nodes without having to make a Dimmer item for each node and also link it to that node channel.

Thanks

Again, I don’t know OH 2 so I don’t know how channels work.

In OH 1, unless all of your Nodes can receive a command or update from a single bound Item (e.g. send an MQTT message to a single topic all the Nodes subscribe to) I know of no way to communicate with all the Nodes without each having its own Item.

But in OH 1 if you put all your nodes into a Group:Dimmer:MAX then any change to that Group should be sent to all members of the Group. When you put that Group onto the sitemap it will look and behave as if it were a single Dimmer Item.

Perhaps someone who knows more about OH 2 can tell if channels provide some new feature that would allow this to happen.