Skip to content

Provide "modern" API #3

@roeldev

Description

@roeldev

Provide "modern" intuitive API with filters (power, gas, pv generation etc) and different output options (json, xml?)

Current usage

/v1/current

Property Type Unit Description
date datetime - time of last entry
last_signal datetime - time of last signal from smart meter
last_update datetime - time of last measurement of smart meter
power_usage number watts current power usage
gas_usage number m^3 current gas usage
{
    time: '2019-05-10T14:48:23',
    last_signal: '2019-05-10T14:48:22',
    last_update: '2019-05-10T14:48:22',
    power_usage: -1000,
    gas_usage: 505,
    meter: {
        p1:
        p2:
        n1:
        n2
    }
}

Today's usage

/v1/today
day view

Yesterday's

/v1/yesterday
verbruik van gisteren, day view

Historic data

Of year

GET /v1/history/{year}
GET /v1/history/2018
result: year view of 2018

Of month

/v1/history/{year}/{month}
/v1/history/2019/01
result: month view of january 2019

Of week

/v1/history/{year}/week/{weekOfYear}
/v1/history/2019/week/1
result: week view of first week of 2019

Of day of month

/v1/history/{year}/{month}/{day}
/v1/history/2019/05/04
result: day view of may 4th 2019

Of hour of day

/v1/history/{year}/{month}/{day}/{hour}
/v1/history/2019/05/04/13
/v1/history/2019/05/04/13:01
/v1/history/2019/05/04/1pm
result: hour view of may 4th 2019 at 13:00
rules:

  • floor hour/mins to nearest hour
  • values without am/pm suffix are treated as 24 hour clock

Of day of year

/v1/history/{year}/day/{dayOfYear}
/v1/history/2019/day/33
result: day view of feb. 2nd 2019
rules:

  • 33rd day of 2019
  • same result as 'Of day of month'

Of date

/v1/history/{date}
/v1/history/2019-05-04
result: day view of may 4th 2019
rules:

  • YYYY-MM-DD format required
  • same results as 'Of day of month'

Of datetime

/v1/history/{datetime}
/v1/history/2019-05-04T10:01:55
result: mins view of may 4th 2019 @ 10:01
rules:

  • YYYY-MM-DDTHH:II:SS format required

Unix timestamp

/v1/history/{timestamp}
/v1/history/1557446405
result: mins view of may 10th 2019 @ 00:00
rules:

  • convert timestamp to date (may 10th 2019 @ 00:05)
  • floor date to nearest min (or 5mins group)

{
from: '2018-01-01T00:00:00'
to: '2018-12-31T23:59:59'
}

Historic data of range

first 3 months of 2019:
/v1/range/{from}/{to}/{category}
/v1/range/2019-01-01/2019-03-31
/v1/range/2019-01/2019-03
/v1/weeks/2018-51/2018-52 // last 2 weeks of 20

View Group Max. results
Year month* 12
Year week 52
Year day 365
Month week 5
Month day* 31
Month hour 744
Week day* 7
Week hour 168
Week 10mins 1.008
Week 5mins 2.016
Week min 10.080
Day hour* 24
Day 10mins 144
Day 5mins 288
Day min 1.440
  • timestamp:

    • of year (####), 2019
    • of month (######), 201905 (may 2019)
    • of day (########), 20190510 (may 10th 2019)
    • of hour (##########), 2019051012 (may 10th 2019 @ 12:00 (= noon, 24 hour clock))
  • group

    • per_month
    • per_week
    • per_day
    • per_hour
    • per_5mins
    • per_min
  • what:

    • total: totals of that period
    • pwr: only power
    • gas: only gas
    • pv: only pv generation

Per day

/v1/history/20191005/ >> all info of that day

{
total: {
},

per_hour: {
...
},

per_5mins: {
}

per_min: {
"12:01": {
date: "20191005120100"
pwr1: ##
pwr2: ##
gas: ##
},
...
}
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions