bartbutenaers / node-red-contrib-interval-length

A Node Red node to measure the interval length between successive messages
Apache License 2.0
5 stars 2 forks source link

copy old payload to new msg #1

Closed MatzeJoerling closed 6 years ago

MatzeJoerling commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

Hi,

sorry to hear! That change sounds very good, will check it as soon as possible.

regards Matze

2017-11-22 21:42 GMT+01:00 bartbutenaers notifications@github.com:

Hi Matze (@MatzeJoerling https://github.com/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: image] https://user-images.githubusercontent.com/14224149/33148569-a9fefc84-cfcc-11e7-92b9-ab98964246c2.png

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: image] https://user-images.githubusercontent.com/14224149/33148734-3a385804-cfcd-11e7-9238-1c62f5c016c8.png

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bartbutenaers/node-red-contrib-interval-length/issues/1#issuecomment-346467846, or mute the thread https://github.com/notifications/unsubscribe-auth/AYqoEMuGMNrIWAnbSKEozqhCJoPDh8oPks5s5IdMgaJpZM4QOIt_ .

MatzeJoerling commented 6 years ago

Hi,

checked. my Power Meters shows the same values as bevor , i guest it is working. The Rainmeter uses the same node, but it is not raining today.

regards M.

PS: Will put the next feature request on github

2017-11-23 20:50 GMT+01:00 Martin Hierling martin.hierling@gmail.com:

Hi,

sorry to hear! That change sounds very good, will check it as soon as possible.

regards Matze

2017-11-22 21:42 GMT+01:00 bartbutenaers notifications@github.com:

Hi Matze (@MatzeJoerling https://github.com/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: image] https://user-images.githubusercontent.com/14224149/33148569-a9fefc84-cfcc-11e7-92b9-ab98964246c2.png

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: image] https://user-images.githubusercontent.com/14224149/33148734-3a385804-cfcd-11e7-9238-1c62f5c016c8.png

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bartbutenaers/node-red-contrib-interval-length/issues/1#issuecomment-346467846, or mute the thread https://github.com/notifications/unsubscribe-auth/AYqoEMuGMNrIWAnbSKEozqhCJoPDh8oPks5s5IdMgaJpZM4QOIt_ .

bartbutenaers commented 6 years ago

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