Main Menu

Node Power Level

Started by Kilo95, December 19, 2017, 01:10:31 PM

Kilo95

is there a way to have the transmit power level of the nodes reported to the gateway? I've got one node ~175 feet from the house and it shows RSSI between -89 and -100. I have ATC enabled but would like to see what the output power is. It'd be fun if it showed up like the RSSI on the gateway page.

Felix

Sure, just send a new metric, and define it in metrics.js.
The transmit level is in RFM69_ATC._transmitLevel.
It was something I was thinking to add, so you can compare the transmit level vs RSSI.

Kilo95

if you were thinking of it adding it, i'll probably just wait til you get around to it.

Felix

Should be very simple:

TXLV : { name:'TXLV', regexp:/\bTXLV\:(-?\d+)\b/i, value:'', duplicateInterval:3600, unit:'', pin:0, graph:1, graphValSuffix:'TXLV', graphOptions:{ legendLbl:'TXLevel', lines: { lineWidth:1 } }},


Then just read the level and send it as a new token:

TXLVL:value (should be 0 to 31).

Kilo95

i will give that a try. thanks

Kilo95

so, would it be as simple as placing:
DEBUG("   [TXLVL:");DEBUG(RFM69_ATC._transmitLevel);DEBUG("]");


right after this:
DEBUG("   [RX_RSSI:");DEBUG(radio.RSSI);DEBUG("]");


??

Felix

DEBUG is for ... serial DEBUGging.
Your transmitting node needs to send that metric.
And all metrics (except the special RSSI) should be nam:value without [] or any other characters.

LukaQ

#7
Quote from: Felix on December 19, 2017, 03:27:26 PM
And all metrics (except the special RSSI) should be nam:value without [] or any other characters.
TXLVL:25

in weather node
sprintf(buffer, "BAT:%sv F:%s H:%s P:%s", BATstr, Fstr, Hstr, Pstr);

    sendLen = strlen(buffer);
    radio.sendWithRetry(GATEWAYID, buffer, sendLen, 1); //retry one time


in variable buffer you put BAT:5.02v F:53.2 H:72.4 P:28.5
then you calculate what is the length of buffer
then you send to gateway, BAT:5.02v F:53.2 H:72.4 P:28.5, and length of this buffer


On gateway itself (PI) you need to "teach it" to understand what to do with "TXLV" and you do this with

TXLV : { name:'TXLVL', regexp:/\bTXLVL\:(-?\d+)\b/i, value:'', duplicateInterval:3600, unit:'', pin:0, graph:1, graphValSuffix:'TXLV', graphOptions:{ legendLbl:'TXLevel', lines: { lineWidth:1 } }},

in userMetrics/_example.js


AND NOTE THIS: you need to send TXLV or TXLVL
It has to be one or the other (the same) on PI gateway and what is node sending

Kilo95

so all i need to change on the weathershield node is:
sprintf(buffer, "BAT:%sv F:%s H:%s P:%s", BATstr, Fstr, Hstr, Pstr);

    sendLen = strlen(buffer);
    radio.sendWithRetry(GATEWAYID, buffer, sendLen, 1); //retry one time


?? then change the metrics.js. I think I could have fumbled my way through the metrics.js work but the node would have given me trouble

Kilo95

or is this correct?
sprintf(buffer, "BAT:%sv F:%s H:%s P:%s TXLVL:%s", BATstr, Fstr, Hstr, Pstr, TXLVLstr);

    sendLen = strlen(buffer);
    radio.sendWithRetry(GATEWAYID, buffer, sendLen, 1); //retry one time

Felix

Kilo95, your last piece of code should work.
You can always try it right away too ;)

TomWS

You could do this...
    sendlen = sprintf(buffer, "BAT:%sv F:%s H:%s P:%s TXLVL:%s", BATstr, Fstr, Hstr, Pstr, TXLVLstr);
    radio.sendWithRetry(GATEWAYID, buffer, sendLen, 1); //retry one time


Tom

Kilo95

Quote from: Felix on December 20, 2017, 10:38:48 AM
Kilo95, your last piece of code should work.
You can always try it right away too ;)

lol. you are correct. i am at work though and won't be home until tomorrow. that's why i replied with what I hoped would work. i'll try it the next day or so. i can remote in and at least do the metrics.js file

thanks to tom too. gives me a couple of ideas to try out!

ssmall

Or this...
    sendlen = sprintf(buffer, "BAT:%sv F:%s H:%s P:%s TXLVL:%i", BATstr, Fstr, Hstr, Pstr, RFM69_ATC._transmitLevel);
    radio.sendWithRetry(GATEWAYID, buffer, sendLen, 1); //retry one time


Felix

On a second thought, keeping tokens as short as possible would be preferred.
So maybe a shorter metric name TXP:value rather than TXLVL? Could even be 1 letter or character (unque from other metrics) but that's less human readable.
Whatever works though..