Calculating difference to old value

Forum about Domotiga Open Source Home Automation for Linux.

Moderator: RDNZL

Post Reply
pietervanharen
Starting Member
Starting Member
Posts: 27
Joined: Tue Dec 29, 2009 11:56 am
Contact:

Calculating difference to old value

Post by pietervanharen »

I'm currently using Domatiga to read the values from my smart meter through the P1 gate. From the energy meter I get an update every 10 seconds about the current load. The gas meter does an update to the energy meter every hour. In Domotiga I only have the total usage since the meter was placed.

I wondered if it is possible to extract the last known total from the current total and doing so calculate the usage in the last hour. Is there a Value - OldValue type of calibration possible?
running Domoticz
User avatar
sj3fk3
Member
Member
Posts: 119
Joined: Mon Apr 23, 2012 8:33 am
Location: Abcoude

Re: Calculating difference to old value

Post by sj3fk3 »

pietervanharen wrote:I'm currently using Domatiga to read the values from my smart meter through the P1 gate. From the energy meter I get an update every 10 seconds about the current load. The gas meter does an update to the energy meter every hour. In Domotiga I only have the total usage since the meter was placed.

I wondered if it is possible to extract the last known total from the current total and doing so calculate the usage in the last hour. Is there a Value - OldValue type of calibration possible?
I have the exact same problem. I've been talking to Ron about it as well.. Best solution would be to make the RDD poller only poll every hour.. It's on his todo list AFAIK, but if you (or anyone else here) can come up with a working solution in the mean while I would be glad to hear it..
Kind Regards,
Greg.
pietervanharen
Starting Member
Starting Member
Posts: 27
Joined: Tue Dec 29, 2009 11:56 am
Contact:

Re: Calculating difference to old value

Post by pietervanharen »

Would be great if this could be solved directly in DomotiGa. Since I don't use the RDD charts very much, but post all values to cosm (pachube) I can work around it for now by polling the datafeed with the gas total and comparing it with the most recent value that was less than the current and post the difference in an other datafeed. But it's wat we call in Dutch very "houtje touwtje" :-)
running Domoticz
User avatar
sj3fk3
Member
Member
Posts: 119
Joined: Mon Apr 23, 2012 8:33 am
Location: Abcoude

Re: Calculating difference to old value

Post by sj3fk3 »

pietervanharen wrote:Would be great if this could be solved directly in DomotiGa. Since I don't use the RDD charts very much, but post all values to cosm (pachube) I can work around it for now by polling the datafeed with the gas total and comparing it with the most recent value that was less than the current and post the difference in an other datafeed. But it's wat we call in Dutch very "houtje touwtje" :-)
Can you explain how you do this "houtje touwtje" trick? I would like to use it as well.. Tried cosm in it's pachube era once but did not fall in love right away :)
Kind Regards,
Greg.
daferra
Starting Member
Starting Member
Posts: 42
Joined: Wed Jul 15, 2009 10:42 am
Location: Netherlands

Re: Calculating difference to old value

Post by daferra »

Would be great if we where able to calculate total usage of devices that we want, put it in domotiga database and ouput to json

Create a module whereby we can copy/past specific values on a specific time to the database. The database will be a collection of different value that we can create by our self.

example:
write value off P1 on 00:01 to database table "total usage" completed with date, time, value, deviceID
write value off P1 on 00:01, each next hour to database table "total usage" completed with date, time, value, deviceID
write value off DeviceID 43, 56, 23 ,46 on 00:01 to database table "living room" completed with date, time, value, deviceID

Create a module where we can do some mathematics on the created value's, so that we have calculations per hour, day, week, month, year. also put into a database table

json output. so that we can use these value's or calculation in cosm or other iot
power usage monday 24-12-2012 = 5 kWh
power usage tuesday 25-12-2012 = 4,3 kWh
pietervanharen
Starting Member
Starting Member
Posts: 27
Joined: Tue Dec 29, 2009 11:56 am
Contact:

Re: Calculating difference to old value

Post by pietervanharen »

sj3fk3 wrote:Can you explain how you do this "houtje touwtje" trick? I would like to use it as well.. Tried cosm in it's pachube era once but did not fall in love right away :)
I've made a trigger on each new value of the stream with the gas total. That trigger calls a php script that checks the most recent value of the gas value via json (api documentation) and compares is with the second most recent value. If the most recent value is the same or lower then the second most recent, I post a zero to the datastream which shows the gas usage per hour, otherwise I post the difference to the same datastream.

After that I set the poll time of domotiga to cosm for the gas total to once an hour.

Please be ware of the time zones of your server and those of cosm. You can set a timezone in the call to the API.
running Domoticz
Post Reply

Return to “DomotiGa Forum”