16 February 2023 08:41
I am not a programmer, but i like to tinker with home assistant and electronics. I work in the HVAC and i installed a ventilation system.
I am controlling the following:
Fan speed 0-10V
Zone valve for bedroom
Zone valve for living room
Everything is connected to home assistant and for automations i am using a node red integration.
I have 2 flows:
1 for the speeds and zones (this is full of booleans)
1 for the actual logic based on CO2 (unstable)
My program is working (it took me a long time to get it this far) but sometimes it becomes unstable. The cause is that the CO2 values fluctuate too fast for the controle system.
One annoying bug in the dimmer is that if i go from 100% to 80% it turns off. If i turn it to 78% first and then back up to 80% it works. Thats why the flows in the speed and zones are so large.
What i am trying to do is use the smooth function to get the average of the previous 3 values. Every 5 minutes i retrieve the CO2 value, and this starts the logic.
My problem is that my CO2 value is in an object. And even though i have the smooth function and set to number, the original value of the CO2 is sent to the next node.
What i think is the solution:
-Change the object to a number
Run number through the smooth node
Change back to object ( because all logic is looking to the specific entity payload)
So the question is how?
Any help is appreciated.
16 February 2023 08:57
Some extra info to visualize
Hello and welcome to the Node-RED forum.
That's quite a comprehensive flow you have built. To me it seems full of HA nodes - I can't see any Node-RED nodes. Not many people on this forum use HA, so you may get a better response from the HA forum.
So the question is how?
One potential way - assuming there's more in the payload object than just the co2 value & you want to preserve the rest:
Run the msg through the
Reassemble things again via a
How have you configured the smooth node ? Did you configure it to operate on msg.payload.co2 (or whatever the property path to the co2 value is ?)
16 February 2023 18:54
Thanks for the tip, i didn't know there were HA nodes
Maybe i'm lucky here and otherwise i will try my luck at the HA forum
16 February 2023 18:58
Thank you for your message. I tried it, but no luck. See image for config and input/output. The debug at the end does not show up, but somehow the original CO2 value still reaches the end.
16 February 2023 19:00
Hello deceejay. In my reply above is the config. To me it seems to be under payload?
Well. Of course it doesn't & does. As I had no idea how your data object looks like, I tried to make a guess. At least you should have adapted this guess to your real situation.
Based on what I see here, there's even no need to shuffle things around with the
msg.payload already seems to hold the co2 value. What do you expect to get at the end of this flow?
17 February 2023 07:14
Thanks for your reply. With the smooth node i would like to get the average of the 4 latest values. So if someone walks by the co2 sensor sometimes you see a spike.
So to slow down the reaction time of the system
According to the
picture you provided, this flow should do exactly what you expect.
If it doesn't you needed to share the flow source to allow a deeper view into the details.
Please substitute the first HA node then with an inject node that send representative data.