Antenna metrics

Started by sparky, March 03, 2025, 11:59:46 AM

sparky

I'm building a new project and can't seem to get past creating the antenna.js  :P

The issue I'm having is that only the first metric listed in my JavaScript file is updating in the dashboard.  I've attached my antenna.js file and in it you will see that ROT_STATUS is listed first.  Also attached is a screenshot of my dashboard showing only the ROT_STATUS is being updated.

I've also attached a screenshot of the data coming from the RotorMote in the gateway terminal. 

I've also attached my sketch but I don't see how that could be the issue when the data is being sent to the gateway.

Appreciate any help you can provide!





Felix

You will first need to use spaces as separators (instead of commas) in your radio packet, between the different metric:value tokens.
Otherwise I can only see a slight issue with the regular expressions where you have a \s* and that should not be there (it works simply because you don't have spaces in your value part of the tokens). This is because the gateway splits the message tokens by space!

/ROT_STATUS\:\s*([\w-]+)/i
              ^^
              why is this \s* here?


And another tip. Currently your metric would also match ROT_STATUS:THEREareONLYtwoGENDERS
This could be rewritten to this for more clarity and filtering of only the good/wanted messages:

ROT_STATUS\:(N|NE|E|SE|S|SW|W|NW)\b/i


Note the \b which enforces a word boundary, otherwise it would math a bad token like ROT_STATUS:NEabcdefg

Play with this expression futher here:  regexr.com/8ctrb

I haven't gone through your code line by line but at a quick glance it looks good. Try the above and let me know if it gets you closer.

sparky

Felix,

Your fix worked perfectly as usual!  I really appreciate that.

I tried;
/ROT_STATUS\:\s*([\w-]+)/i
              ^^
              why is this \s* here?


thinking my issue might be with whitespace characters and I just forgot to take it out.  I have a lot more to learn lol.   

I will definitely visit regex.com more and practice.  Thanks for the tips, suggestions, and most of all, your time!

I will be ordering a couple more Moteino's in about a week