I'm trialing a prototype heat measuring system, Basically, each user has two Pi3's, each with a temp sensor, one with a relay. I have 1 Node-red flow, that compares temps and turns on or off relay accordingly, also stores data to a MySql.
Now, If I had five users, could I use 1 node-red flow to do all the controlling. I am thinking only one flow to keep things tidy in-case it went to 50 users. Or am I making things very complicated for myself?
I don't think I can provide a definitive resolution for your case, but I want to say Yes. One Flow / One Raspberry Pi / One Node-Red Instance, I want to say: CAN control this easily.
You will need to setup a protocol between the lot, and I'd probably suggest maybe MQTT, or you can probably socket to or send HTTP requests even to the "Main Server" (Rarpberry Pi) address, and these endpoints can then by means of a Topic, can identify which endpoint these are coming from easily. Just tack on the ID / name or whatever to the topic when reporting to the "Main Server" ...
Depending on your polling rate from the endpoints to the server, and how big payloads are and network bandwidth factors etc, If it's basic stuff, you'd probably do just fine if it's just temperature data >50 users.
Now if you're asking to have unique access and authorization between each, I'd say its another ball game, but MQTT can provide some security.
Another issue, but not sure much of a concern in todays cheap storage, is durability on running many io rewrites on an SD card via Raspberry Pi... But thats another topic.
Currently using Secure Mqtt, Messages are very light, 3 values from each device reporting to virtual server. (Linode).
I like your idea on using a Topic for the endpoints, gathering all data as one string and processing then, using a MAC of the PI would make the DB easy query for a UI.
I like it thank you. Sometimes you cant see the wood from the trees when you go figuring things out!!
I am not sure if you are already doing this but I would run node-red on the Pis too, and do as much of the control down there as possible, then send the data via MQTT to the central machine.
I wouldn't use the MAC address as the ID as then if a Pi had to be replaced you would be in trouble as the data for a particular user or location would now be a different id in the database. So use user name or location or whatever is appropriate. If you include that as part of the MQTT topic heirarchy then the central node red will need to know very little about the individual systems, it can subscribe to topics using an mqtt wildcard so that it will pick up the data from all Pis and then extract the id from the topic to use for updating the database.