first, i am new to Node Red and therefore not an expert in this field.
I am currently trying to get a "Sensor Health" Segment for my Dashboard.
I am using the different Sensor-Values to display the health of the Sensor. For example the battery-life and signal strength.
My problem is in the Signal Strenght value (rssi). Because the rssi-Value is stored as an object in the msg.payload.rssi i cannot build an if-function which compares it to another int/float value.
For the battery health it is no problem because msg.payload.decoded.vdd returns me an integer value.
Is there a solution to get an integer value for the stored msg.payload.rssi ?
For information:When i am using the artless gauges it is no problem to show the rssi value simply by passing the object to the gauge.
But when i want a custom LED to show either red, green or orange for different rssi values it is not possible because as i said above, it comes as an object and not as a string.
I dont know if i just cant use javascript properly because i am new to this or the workauround is somewhere else. Hope someone can help me out.
You need to use a debug node to understand what data you are actually getting - then you can share that with us so that we can help. Generally an RSSI will be a number. But maybe it is a string containing a number?
These are the debug data's i am getting.
The vdd value i cant use and compare to other integer values and it works perfectly fine.
But the rssi value i am getting is stored in an object and i dont know what kind of object this is.
this is the function, i am just using this for an example so the final code will be different.
For BattVal i am getting the "2" as an output, but for the rssi this does not work.