Script to enter last read when the read is zero, or NAN
I am reading a KWH point from a power meter. I am reading this point every 1 minute with it logging every 5. Sometimes in my log, I am getting a NAN, or rather a #NAN. I want to make a script that when this happens as it is logging, it will put in the last good reading.
Ive tried this script but its not working. Any one else, have something to do this?
if ((!p367.value)) return my.ago(MINUTE,5);
else return p367.value;
you use the meta datasource or scripting datasource? if logging every 5 minute,and read this point every 1 minute, just wasting resource,the value don't change, you can change you reading period to 5 minute,then ,will be avoid nan.
@hussam I am using a metadatasource to grab the point from an original BACNET in order to make a clean timestamp at 5 minute intervals. It is on this metadatasource point that I am using this script..