First, I'm new to Node-RED and trying to get into the right mindset. I am working with an older sensor device that I cannot modify. It sends Temp Readings in XML that look like this:
<?xml version="1.0"?>
<Message>
<Timestamp>2019-11-21 21:40:23</Timestamp>
<SensorReadings>
<Reading>
<ReadingTimestamp>2019-11-21 21:40:23</ReadingTimestamp>
<Type>Temperature</Type>
<Value>66.3</Value>
<Units>F</Units>
</Reading>
<Reading>
<ReadingTimestamp>2019-11-21 21:35:17</ReadingTimestamp>
<Type>Temperature</Type>
<Value>66.3</Value>
<Units>F</Units>
</Reading>
<Reading>
<ReadingTimestamp>2019-11-21 21:30:17</ReadingTimestamp>
<Type>Temperature</Type>
<Value>66.3</Value>
<Units>F</Units>
</Reading>
</SensorReadings>
</Message>
I used the Parser XML Node to turn that into an Object. Then I want to sort the Readings. The sensor sends newest reading first. So as you walk through the array or readings you are walking back in time. I am going to save this to InfluxDB and it likes things in chronological order oldest to newest. So I thought the Sequence Sort node should fix my problem, but it doesn't seem to do anything.
I set sort to: msg.payload.Message.SensorReadings[0].Reading and key to: msg.payload.Message.SensorReadings.Reading.ReadingTimestamp
Since I am new I probably have something basic messed up, but after reading the doc a few times and trying search I can't see it. Sure I could just write a function node to do this for me, but I'm really trying to get into the idea of using Nodes and adopt the Flow programming style.
I'd appreciate any advice, help or, tips anyone can give me.
Thank You,
Kevin Runde