Hello, this is an embarrassingly silly question but I cannot figure out what I am supposed to put in the “Value” field of a math operation for processing an input before logging it.
I want to pass the input of a CT sensor through Absolute Value before logging it (the sensor is clipped the wrong way around and gives negative values and it’s awkward to flip it around so I am doing it in software).
When selecting the Absolute value operation, I am given a text field where I am supposed to enter something but I don’t have the faintest idea what that something is and the interface is not terribly helpful about what it expects me to enter. I have unsuccessfully tried various things like “emontx3cm15: P1” and similar as shown in the image below:
I’m afraid I don’t know the answer to your question offhand either so no need for embarrassment, even if it does turn out to be ridiculously obvious.
An alternative and far more common way to achieve what you want in software is to multiply by -1. That can be at emoncms as you are doing, or at the emonhub “scales” config for that node.
I don’t know what the plugs (and wall warts) are like in Sweden, but reversing the AC adapter if it’s a 2 pin plug will have the same effect as reversing all the ct’s, maybe the other ct’s are then easier to access and swap instead of the currently offending ct?
If you’re reversing the c.t’s output, you really want to multiply by -1. So from the list it is under Calibration, × and then -1.0 in the value field. Using Absolute value will mean that if you export energy, it will have the wrong sign.
I’ve run a very rapid test, and it appears that whatever you put in the ‘value’ field when converting to absolute value is ignored. You cannot leave it empty - you get an error - but 0 is valid.
@TrystanLea
This appears to be a problem - even though the field is not used, it fails (and locks - cannot recover without abandoning the edit completely) with “ERROR: Value must be a valid number” if empty.
Am I the only one who sees a pop-up indicating somebody else is answering? Nobody was when I started typing, then Paul nipped in under me, then you popped up as I was typing and checking how emonCMS actually behaved.
I think a fair comment is the answer was ridiculous - not ridiculously obvious. I don’t think anyone can blame Andreas for not being able to figure that one out.
Thanks for all the help guys, now I got it. Since we are in the editor for a particular input, the math operation operates on this input so we don’t need to supply a reference to itself, only the stuff that is being done to it. This makes sense for the addition and multiplication but the field is meaningless for absolute value where it is an artifact of a coding oversight.
I verified that absolute value works with (and ignores) some random numeric value and also changed to multiplication by -1 (which is the correct way of handling this case) and it works great. Thanks again for getting me unstuck.