I want to setup the 15 minutes profile for KWH in meta data. I write the script "return p78.value - p78.ago(MINUTE,15) ;" It works but it also end up some issues.
- The first value of the meta data equals to the value of the KWH.
- When there are power outage or other problem to make the KWH data not available in a period of time. When the KWH resumes to have data. The first resumed meta value is not correct. In my case, I got an interruption of the KWH so I missed some data in a few days, the last value read of the KWH is 317.58. After the interruption, the data read for the calculation is 389.66. The meta data becomes 72.08 (= 389.66 - 317.58) but 317.58 is few days ago. It mislead that there is a jump in the 15 minute.
Another issue is the "logging type" of the meta data. If I use "when point value changes", whenever the result of the calculation is the same value as the last value. The value does not record in the database. It looks like there is an interruption in that period. If I put "All data", the data missing in the interruption becomes "0". It means no consumption in that period of time. I just want to have "null" or no data means interruption and "0" means no change of the KWH.
I try another script to make the first value becomes 0
if (p78.ago(MINUTE,15) != 0)
return p78.value - p78.ago(MINUTE,15) ;
return 0 ;
I will be grateful if you can have a script to solve my issues.
Thanks ! :)