You are expecting up to 500 messages per second, so does "with identical msg.Time" require millisecond precision?
At what point in your flow do you assign a value to msg.Time?
msg.Time will have 10 second intervalls. So the supplied precision of the normal comparison should suffice.
msg.Time is set before the three source nodes.
You mean because I say "basic manner"? If so, I mean that you can only use one criteria for the wait. So as long as the msg.topic is identical, each new msg will be counted for the wait count even if two messages from the same node are received with different msg.Time values.
Highly unlikely case given the 10 second update interval, but that interval may change at some point and then become an issue.
I am curious for the solution, but if it is really complicated, then I do not want you all to spend too much time on it.
I am merging the three nodes right now to handle the issue within one function node.
But as I say, I would be curious how to solve this issue in the future
The thoughtful face is because it struck me that maybe, since you are seeking to do this project without standard Node-red nodes, you should consider doing all of your processing in an external program, C maybe, called via an exec node.
I would think the msg that is output from that node would contain a msg property called Power2Delta. But it does not.
It does, however, have the correct value for msg.payload.ENERGY['Power']
So both if statements are executed. But for some reason the change to the msg in the nested if statement (i.e. creation of property Power2Delta) is not transferred to the outer if expression, i.e. to the msg that is later being returned.
Is it possible to trigger an mqtt in node the way you trigger a function?
I have an mqtt in node that subscribes to a topic which is not regularly updated but has retained messages.
Whenever I deploy, the mqtt in reads the messages.
I would like to manually restart reading of those retained messages.
That is not really what MQTT is designed for. It is kinda possible by disconnecting/reconnecting but that is a nasty hack. Ultimately, MQTT is PUB/SUB by design.
You should store the retained message in your context and access that as and when required.
That is exactly what I am doing and exactly why I need to trigger manually: when I delete the flow contexts, the stored retained messages also get deleted.
Maybe I will turn them into global. Don't really need them as globals, but...well....I need a solution
Well, the problem is, that I want to wipe those also. I am playing with topics and I need to wipe all flow contexts but I want to refresh them after wiping, just like I re-set the local flow contexts.
Is it possible to simulate the deploy command? Deploy seems to automatically cause mqtt in to disconnect and reconnect.
I also would not mind a way of simply disconnecting and reconnecting on specific mqtt in node, if that were possible.
Read the built in help for the MQTT node. You can send it a msg with action of "disconnect" and "connect" - that will cause MQTT to send out its retained subs again.
PS, this is really the wrong approach! but hey ho.
That approach is not feasible because I set a lot of flow contexts from incoming messages. So I cannot "store" them in one place.
Maybe 20 are defined in a node locally, all others are created from message properties.
But simlply subscribing to the topic again whenever I manually delete seems to work nicely.