Incrementing feeds - daily, monthly, yearly values?

There’s something I really want on my dashboards… That is, how many kWh I’ve consumed today (and possibly this month and this year) so far. Currently that’s not possible with the incrementing kWh feeds.

I had a thought that it might be nice to add today, start of month and start of year values to the feed object returned from the feed list API.

For example, this is how a feed might look:

{
  "id":"2",
  "name":"use",
  "userid":"1",
  "tag":"Node 5",
  "datatype":"1",
  "public":"0",
  "size":"154624",
  "engine":"5",
  "time":"1473198594",
  "value":"343",
  "daystartvalue":"340",
  "monthstartvalue":"320",
  "yearstartvalue":"200",
  "processList":null
}

We could then create options on feedvalue to show today, this month and this year values. Essentially those would be value - daystartvalue, etc.

Thoughts? Has someone attempted this before?

1 Like

I think someone once asked for a similar thing but from a specific day in the month, so as to coincide with their supplier’s billing date.

Matt - I’d like this! And I’d like to add a request: Consumed per season. For the meteorological seasons:

  • Spring - March 1 to May 31
  • Summer - June 1 to August 31
  • Fall - September 1 to November 30
  • Winter - December 1 to February 28 (or 29)

The above is for the northern hemisphere.

I’ve been trying to figure out the above with feeds but resorted to excel worksheets.

The biggest question is should this be on the list endpoint or a separate endpoint? I’m sort of veering towards a separate endpoint to keep it clean. But it would mean another call per feed, or one batched up one if we did that.

I’m not quite sure on the style of how the API is structured just yet, so looking for opinions.

I’ve put up an RFC pull request here:

And I’ve also got a commit over on my emoncms dashboard repo which you can apply if you want to see this in action for yourself.

@mattjgalloway

I too would like the functionality you suggest to provide daily, weekly to date, month to date and year to date values.

I also have a need to provide “since a set point” urls, This was mentioned in the “Emoncms daily, weekly, monthly kWh and averaging” thread on the old forum It’s no longer essential but I would still find it handy.

I now wonder if it would be possible to use default values to extend the existing feed api urls to handle more scenarios by including or omitting the start time and/or the end time. eg

if the end time is excluded then “now” is used, this allows for incrementing totals from any fixed point in time eg since PV installed etc.

if the start time is excluded then “beginning of this period” is used and “this period” is defined by the daily/weekly/monthly/yearly setting. Unless a “period=7days” was used in which case you would get the full “rolling” 7 days up to “now” instead of the total since the beginning of this week which maybe only a day or 2.

The use of negative periods eg “period=-7days” (an alternative to mode=weekly?) could also allow both a “previous week” and a “current week”, either as rolling intervals (last 7days and previous 7 days) or as fixed periods (this week to date and last weeks total).

That’s a nice approach. I think the end time omission would be useful in any case. A lot of requests will simply have “now” as the end time, and so a nice optimisation is not having to send this.

What API are you thinking of this on, data.json? The thing there is that you need to specify an interval, or a mode.

I’m actually wondering if things are at crossed wires right now. I have a feeling I might be misunderstanding now I come to think about it! With that in mind, how about this as a proposal:

  • New endpoint called delta.json.
  • Takes the following parameters:
    • One of the following is required:
      • id - The ID of the feed to request the data for.
      • ids - A comma separated list of the IDs of the feeds to request the data for.
    • One of the following is required:
      • start - A timestamp of when you want to calculate from.
      • startoffset - Either day for start of today, month for start of the current month, year for start of the current year.
    • end - (optional) A timestamp of when you want to calculate to. If omitted, latest feed value is assumed.
  • Returns timestamp of the start time (incase you used startoffset and want to know when the data is actually for) and the difference of the value between that time and end.

I also would be interested in units used this week and total units used last week and the same for month data.
That way it can be easier to identify trends on energy usage.

Regards
Dave

Hi Matt
Have you had an development on this?

Regards
Dave

Sadly not. I have some commits on the dashboard and the emoncms forks of mine that enable the behaviour. But it’s not really the right way of doing it for pushing upstream.

Hi everyone. I was looking for this option today and was just wondering if there was any development since. Thank you.