Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy old payload to new msg #1

Closed
MatzeJoerling opened this issue Nov 1, 2017 · 6 comments
Closed

copy old payload to new msg #1

MatzeJoerling opened this issue Nov 1, 2017 · 6 comments
Assignees

Comments

@MatzeJoerling
Copy link

Hi,
i am using the interval-length to count my power consumption.

but i need the interval length and the old payload (thats how much Watt the device needs) to calculate the work (KW/h)
can you copy old payload to new message object with name old_payload or similar?

regards M.

@bartbutenaers
Copy link
Owner

Hi Matze (@MatzeJoerling),

That could be indeed very useful. I see in this discussion that there is no real guideline about this kind of issues. I will provide you a solution in a week or two. Just got out of the hospital, and I'm not developing at the moment ...

P.S. It would be nice if you could describe here how you use my node (for measuring power consumption based on intervals). It could be perhaps a good used case for the README.MD file for other users.

Will keep you updated!

Kind regards,
Bart

@MatzeJoerling
Copy link
Author

Hi,

your impulse length node is useful for all kinds of counter (water, power, gas) with S0 output where you get some X impulse per Volume, Work, Volume again. Im my case the Power meter outputs 2000 Imps per KW/h which i put into influx to sum up my consumption. but that is on a daily or hourly basis.
with your node i get the time between 2 impulses which i can calculate to what is going on now.
that is working right now. i will provide you with nodered flow that does that for me.

what i now want to acomplish is: i have some knx / eib actors that calculate the power on there own and sends that value to the bus. if the value changes i get a new message. to sum that up i need the power and how long that power time was to calc the work. that is not working because the power (in the msg) doesnt survive your node. ;-)

perhaps you should consider the option to leave the old msg object complete and only add your msg.interval data.
will wait for your answer, and meanwile get well.

regards M.

@bartbutenaers
Copy link
Owner

Hi Matze (@MatzeJoerling),

Sorry for the delay, but things are not going as planned ...

But anyway, this was a very small change so I managed to get it done. In version 0.0.2 you can specify the field name for the output message (where the interval length value will be stored):

image

This way your input message is extended with a new field.
Existing flows should be still working fine, since I have specified msg.payload as default value:

image

It would be nice if you could test this version, before I publish it on NPM:

  1. Install version 0.0.2 directly from Github : npm install bartbutenaers/node-red-contrib-interval-length
  2. For interval nodes that you have already used in your flow: if you don't open their config screen, these nodes should keep working as before (i.e. send interval value in the msg.payload field)

If it fits your needs, I will publish it on NPM.

Kind regards,
Bart

@MatzeJoerling
Copy link
Author

MatzeJoerling commented Nov 23, 2017 via email

@MatzeJoerling
Copy link
Author

MatzeJoerling commented Nov 26, 2017 via email

@bartbutenaers
Copy link
Owner

Hello Matze,
version 0.0.2 has been published on NPM.
Kind regards,
Bart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants