hi guys
i am not so good in NodeJs,
please how can i filter the the messages so that i will only debug few of the messages
the messages are {"timestamp":"2021-11-22T22:40:00","load_state":"ON","load_w":148.946,"output_wh_total":4003,"output_wh_delta":49,"solar_w":0,"solar_v":3.832,"input_wh_total":0,"bat_v":25.258,"state_of_charge":100,"full_charges_count":1,"deep_discharges_count":0,"bat_chg_total_wh":0,"bat_dis_total_wh":4003,"bat_usable_ah":0,"bat_temp":36.148,"restart_detected":false,"signal_strength":-59,"error_flag":0}
Please try to not tag individual users in posts - particular when bumping a post that hasn't been replied to as quickly as you'd like.
Given your previous question about parsing the JSON to a JavaScript object, are you sure you're passing the parsed object into this function node?
Add a debug node next to the function node so you can check exactly what the message looks like that is being passed into the Function - is msg.payload an object or string?
You have shown a screenshot of the Debug sidebar for the message coming out the Function node - that doesn't help us. You've already told us it isn't what you want.
What we need to see is the message you are passing in to the Function node. That's the only way we can help you get the Function code right.
There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.
Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.
You have posted two things there, the first is a copy/paste of a javascript object containing the data, the second is a screenshot supposedly of that same data. However the screenshot shows that the data is in the first element of an array in msg.payload. The copy/paste object is not in an array. You need to decide which one of those is the real data.