andreypopov / node-red-contrib-zigbee2mqtt

Zigbee2mqtt connectivity nodes for node-red
GNU General Public License v3.0
94 stars 24 forks source link

Add device name to msg.topic #88

Closed schasj closed 2 years ago

schasj commented 2 years ago

I have a use case where I feed a number of "in" nodes for devices of the same type to a subflow. The subflow makes use of msg.topic to learn which device sent the message. I could use a global variable to pass the device name but that is perilous because another instance of the subflow could be created by a different device while the first one is still in progress. Using msg.topic is safer, cleaner and may have uses in other nodes and use cases as well.

Thanks for considering this request.

schasj commented 2 years ago

I've had feedback on the request that suggests NOT using .topic for the device name, rather put the name in .device or .devicename

schasj commented 2 years ago

Never mind. Stupid mistake.