The flow posted sets msg.reset to 1. Which also is not correct.
I set it to 1 as an example only.
Haha, I certainly will when Iām back home Wednesday
@Colin you're right, the if statement needs to be
if( msg.hasOwnProperty("reset") && typeof msg.reset === "number" ) {
@Stefanie - use this code instead
Sorry, I had no access to the NR for the last 2 days. Back home now and modified to the code you suggested.
That did the trick. Works perfect now, resets to the number I want
Next problem already knocking on my door: the sense hat matrix display stops working after a couple of hours. Until then it displays nicely red and/or green just like AIS message flow coming in. When the output stops, there is no way with NR to get it back to work...unless I reboot the machine.
The sense hat itself seems to be still responsive. I can read the sensors and even get output to the LED matrix using a python script. That make me guessing something wrong with the Pi Sense HAT output node or memory usage.
Wow. Just wow. I cant believe how close our Node-RED projects are.....
What I am doing is;
- Listen to a UDP stream that is a flow of ADSB aircraft messages.
- Split it up for the different frequencies in use.
- Display them on a Node-RED dashboard.
- Count the total number of messages per day.
- Show the message rate in msg per minute and per hour.
The most complicated part for me is 3. I do a lot of word filtering to display only 'interesting' messages.
- I think you have this going. Just a UDP node and a CSV to JSON node to split the messages into their parts.
- Extract from the JSON the parts that are interesting like the frequencies and message parts.
- Standard template nodes to display table data.
- I use a third party software app to count because I could not yet figure out a way to maintain the count between deploys.
- I use the 'speed' node. https://flows.nodered.org/node/node-red-contrib-msg-speed It makes it super easy to count the messages per minute or hour.
You really don't want my flow, it is super huge, super customized, super super messy and just mega ugly... But I am happy to try and help if I can.
Not a lot of help I know, but just wanted to encourage you to stick with it, my system is working great and a lot of people use it every day.... I get around 30,000 messages per day.
My idea behind this was dissatisfaction with the MarineTraffic dashboard, which is really basic.
I'm running a AIS Landstation (with average VHF conditions I receive up to 500 messages per minute) and wanted to see if and how it's possible to run my own API. And with the help of these nice guys here in the NR forum it works great.
I'm not splitting the messages, just listening for a two specific strings, which then triggers the whole chain.
Next step could be to extract each single message and display them on a world map (well, more or less a map from the area where I live), showing all necessary navigational data like ship name, MMSI, COG, SOG, ROT etc etc. But again, this is only for learning java script and node-red. Those applications already exist and there is no real value coding the whole thing again and again
Thanks for the speed node. That one looks interesting too. Another option to count messages.
Well I can help with the backend map bit...
http://redmap2.eu-gb.mybluemix.net/worldmap/
@Stefanie Yes. The map is a work in progress for me as well. I am using @dceejays world map to plot the aircraft on. I like it because you can click on the aircraft and pull up data on them and because of the heatmap function. You can see the most traveled paths clearly.
I am struggling a bit getting the data on the aircraft on the map, but its only a matter of time till we learn how to do that.
what's the problem?... happy to help
var thing = {
layer:"VDL",
name:"VDL Aircraft",
lat:msg.lat,
lon:msg.lon,
icon:"plane",
iconColor:"blue",
label:"VDL Aircraft",
// extrainfo:msg.data
extrainfo:'<a href="'+msg.link+'" target="_blank">"'+msg.link+'"</a>'
};
msg.payload = thing;
return msg;
Trying to include two lots of 'extrainfo'. One is a link to the aircraft, thats working, the other is the last ACARS message from the aircraft, I have it in msg.data, but cant seem to have two lots of data?
just don't call it the same property name.
...,
ACARS:msg.data,
extrainfo:'<a href="'+msg.link+'" target="_blank">"'+msg.link+'"</a>'
};
Ooooo, I thought the property 'extrainfo' was the key.
Sweet. Thanks. Will test that out soon.
any payload properties not used by the node will just end up in the popup by default so you can add anything you like - unless you override it all with msg.payload.popup
(which can be any html you want to show instead)
That's the one I'm already working on. Found a good example with the USGS Quake monitor. Thanks, DCJ