setting the start value for a meter using "editrealtime"

I would like to create a feed that mimics my electricity/gas/solar panel meter at home. This work well with the power to Kwh processor, but I cannot set the 'initial' value. I tried updating the most recent (or the two most recent) data point using the editrealtime function on emoncms.org, but in some cases this stops the feed from updating. Eg when updating the feed value to 8000, the feed value keeps on increasing, but when I set the value to 10000, the feed value remains fixed. 

Any idea what I may be doing wrong ?

Regards,

Roel

boelle's picture

Re: setting the start value for a meter using "editrealtime"

Hi... i had the same problem with my water meter...

 

on the input page i simply start the list of processing with + "whatsneedtobeadded" and then log to feed.

 

how to do it? clik on input.. find the right node and clik the tool icon next to right input... rest should explain itself

gloorung's picture

Re: setting the start value for a meter using "editrealtime"

Hi Boelle,

Thanks for the reply. I tried your suggestion but it does not solve my problem. I guess the solution you propose works in case the kwh is logged (ie sent by the emontx) and therefor in your input list, ie for water and gas consumption. 

In my case, I log the power from my solar panels and compute the kwh from the 'power to kwh' processor. Adding the  + "whatsneedtobeadded" before this processor would add it to the power so that doesn't make sense; adding it after makes that the value is not included. 

correct or am I still seeing it the wrong way ?

Roel

ngbod's picture

Re: setting the start value for a meter using "editrealtime"

I'm having the same problem and like you can't find a way round it. I add my current meter reading to my PV KW to KWh feed in the Vis page. The 'tab' key needs to be pressed on mine to reveal the save button. Pressing this saves the addition to the feed but from then on the feed stops incrementing and remains static at whatever value the addition was. 

Seems like it's a bug in the code unless editrealtime is not meant for this.

ngbod's picture

Re: setting the start value for a meter using "editrealtime"

I seem to have got this to work with the editrealtime Vis at least for cumulative KWh figures that I need to match my PV export meter, grid import meter and cumulative PV diverted to immersion KWh feeds on my system.

It seems to me like the only way it would accept the offset to the feed and carry on counting up was if I quickly clicked on the latest time on the editrealtime vis graph and very quickly enter the new offset value and save before the next feed value arrives from the sensor. Each feed I updated took a few attempts to get the offset to stick.

It's been working all morning now and the values seem to be tracking the meter readings so far.

gloorung's picture

Re: setting the start value for a meter using "editrealtime"

Earlier this week I have debugged the power_to_kwh process and found that the problem is not the code but rather the mysql database.

The problem I had was that whenever my incremental kwh counter would exceed 10000 kwh, it would stop incrementing. This is caused by the float datatype that is used in the feeds table and that of the feed storing the kwh values. An entry value of 10000.1003 is stored as 10000.1 in the database. As the kwh increments are usualy fairly small, the kwh counter never increases in case a value of 6 digits is reached. 

I was able to solve this by changing the datatype of both the value column in the feeds table as well as the data column in the feed table from float to double using:

alter table feeds modify value double;

As the precision increases (and database size), the value is now stored correctly in the database and the kwh counter keeps on working. What I'm not sure of though is if double is the correct datatype to use. I briefly experimented with the decimal type but could not get a working result yet. 

Regards,
Roel

ngbod's picture

Re: setting the start value for a meter using "editrealtime"

I thought my system was incrementing correctly after using editrealtime but now a week on I can see it's not.

I have three feeds that I adjusted with editrealtime a week ago:  f1 is 58.5 KWh at the moment and incrementing correctly. F2 is 4252 KWh and is incrementing unreliably at about half of actual production. F3 is 46647 KWh and has effectively stopped incrementing.

Roel, where would I find the database you mentioned and how would I change the data type like you did? I'm using Raspberry pi as base.

gloorung's picture

Re: setting the start value for a meter using "editrealtime"

Hi,

Assuming you have logged on to the raspberry, you can enter the following command:

mysql -u root -p emoncms   (The default password is 'raspberry')

In mysql, you can:

mysql> describe feeds;

The Type of Field value should be float; to alter it to a double datatype, enter:

alter table feeds modify value double;

You can do the same for the feeds table that stores the counter data i.e. instead of table 'feeds' use 'feed_xx';  I'm not yet 100% sure this needs to be done. 

For you information: I altered my table earlier this week, the counter value was then 10500 kWh and it has been incrementing correctly since then.

 

ngbod's picture

Re: setting the start value for a meter using "editrealtime"

Thanks for the guidance Roel.

I've applied the changes to my db and hopefully this will cure the problem.

I'm not sure but I think loading of some of the vis graphs like realtime and editrealtime has slowed down since applying the changes.

ngbod's picture

Re: setting the start value for a meter using "editrealtime"

Changing the datatypes hasn't worked on my setup. I carried out all the mods Roel described but still the total cumulative figures are not incrementing correctly. PV is currently about 4237 and the daily addition is varying around 70 - 80% of the KWhd figure. The grid import total cumulative figure has been stuck at about 46693 for a few days now despite 5 - 7 KWhd usage being measured.

ngbod's picture

Re: setting the start value for a meter using "editrealtime"

I figured out why the table mods didn't work on my setup. I updated the database after doing the mods with Admin updater in emoncms and it altered the feeds table back to float data type without me noticing.

When I went through it again today I noticed it change it back this time. The answer is to edit /var/emoncms/Modules/feed/feed_schema.php and change the feed data type from 'float' to 'double' . This stops the database updater reverting the first change Roel described.

ngbod's picture

Re: setting the start value for a meter using "editrealtime"

The local version of my database is now working very well with the double data type but the web version of my database is still using the float data type.

Can anyone tell me which files I need to alter to make the web version the same as my local database instance, assuming it is possible. 

Comment viewing options

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