modifiers for userReadings
git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2679 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -384,18 +384,30 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
|
||||
<a name="userReadings"></a>
|
||||
<li>userReadings<br>
|
||||
A comma-separated list of user-defined readings. Each definition has the form
|
||||
<code><reading> { <perl code> }</code>. After a single or bulk
|
||||
A comma-separated list of definitions of user-defined readings. Each definition has the form
|
||||
<code><reading> [<modifier>] { <perl code> }</code>. After a single or bulk
|
||||
readings update, the user-defined readings are set by evaluating the <a href="#perl">
|
||||
perl code</a>
|
||||
<code>{ <perl code> }</code> for all definitions and setting the value of
|
||||
the respective user-defined reading <code><reading></code> to the result.<br><br>
|
||||
Examples:<br>
|
||||
<code>attr myPowerMeter userReadings power { ReadingsVal("myPowerMeter","count.A",0)/1250.0;; }</code><br>
|
||||
<code>attr myMultiMeter userReadings power1 { ReadingsVal("myMultiMeter","count.A",0)/1250.0;; },
|
||||
power2 { ReadingsVal("myMultiMeter","count.B",0)/1250.0;; }</code>
|
||||
<code>attr myEnergyMeter userReadings energy { ReadingsVal("myEnergyMeter","counters.A",0)/1250.0;; }</code><br>
|
||||
<code>attr myMultiMeter userReadings energy1 { ReadingsVal("myMultiMeter","counters.A",0)/1250.0;; },
|
||||
energy2 { ReadingsVal("myMultiMeter","counters.B",0)/1250.0;; }</code>
|
||||
<br><br>
|
||||
<code><modifier></code> can take one of these values:
|
||||
<ul>
|
||||
<li>none: the same as it would not have been given at all.</li>
|
||||
<li>difference: the reading is set to the difference between the current and the previously evaluated value.</li>
|
||||
<li>differential: the reading is set to the difference between the current and the previously evaluated value divided
|
||||
by the time in seconds between the current and the previous evaluation. Granularity of time is one second. No
|
||||
value is calculated if the time past is below one second. Useful to calculate rates.</li>
|
||||
</ul><br>
|
||||
Example:<br>
|
||||
<code>attr myPowerMeter userReadings power differential { ReadingsVal("myPowerMeter","counters.A",0)/1250.0;; }</code><br><br>
|
||||
Note: user readings with modifiers difference and differential store the calculated values internally. The user reading is
|
||||
set earliest at the second evaluation. Beware of stale values when changing definitions!
|
||||
</li><br>
|
||||
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user