EmonCMS - Absolute?

Hello,

I don't see a way to do an absolute value on EmonCMS?

I tried "Signed to unsigned" but it seems to give me some really funky values.

Thanks

M

Robert Wall's picture

Re: EmonCMS - Absolute?

Try:
Allow negative
× -2
+ input [the same one]

... [any other processing]

Log to Feed

madas's picture

Re: EmonCMS - Absolute?

I have positive and negative values - this will only fix the negative values?

Robert Wall's picture

Re: EmonCMS - Absolute?

Are you sure?

madas's picture

Re: EmonCMS - Absolute?

Do I need to log to the feed prior to the "allow negatives" in order to get the positives in the feed?

Robert Wall's picture

Re: EmonCMS - Absolute?

No. Why should you? What would that put into the feed?

madas's picture

Re: EmonCMS - Absolute?

Ah - i understand it now.  Thanks for the help

Robert Wall's picture

Re: EmonCMS - Absolute?

In case anyone reading this thread later does not understand, this is what happens:

Say the input value is +123:

Allow negative
    the value is not allowed, so zero is passed forwards.

× -2
    zero × -2 = zero is passed forwards.

+ input [the same one]
    0 + +123 = 123 is passed forwards.

... [any other processing]

Log to Feed
    123 is sent to the feed.

Now say the input value is -321:

Allow negative
    the value is allowed, so -321 is passed forwards.

× -2
    -321 × -2 = +642 is passed forwards.

+ input [the same one]
    +642 + -321 = 321 is passed forwards.

... [any other processing]

Log to Feed
    321 is sent to the feed.

Had the input been logged to feed immediately, before 'allow negative', then two values would have been sent to the feed in succession, first the original value and then the absolute value.

amgican's picture

Re: EmonCMS - Absolute?

This was super helpful, Robert. Thanks.

Would you happen to know of a location where all of the feed options are explained in detail? With examples, perhaps?

Robert Wall's picture

Re: EmonCMS - Absolute?

Unfortunately, I don't believe it exists. I have said for some while that the documentation for emonCMS needs improvement. All I can suggest is that you either take the code apart to see what it does, or test various commands and observe the result. 

In general,  each function accepts a value, operates on it and passes a changed value forward to the next. But there are exceptions.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.