Coder Social home page Coder Social logo

fortumapi's People

Contributors

ikeros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

webosa

fortumapi's Issues

Question regarding API

Hi,

I was looking into how to get my current consumption and found your library. I noticed that web.fortum.fi uses a bit different API to retrieve data. For example for consumption it uses https://web.fortum.fi/api/consumption?customerId={customer-id}&resolution=day&from=2019-11-01&to=2019-11-30&meteringPointNo={metering-point-no}&isDirectHeat=false endpoint and response looks like this:

{
    "error": false,
    "unit": "kWh",
    "consumption": [
        {
            "fromTime": "2019-11-01 00:00",
            "value": 3.24
        },
        {
            "fromTime": "2019-11-02 00:00",
            "value": 3.63
        },
        {
            "fromTime": "2019-11-03 00:00",
            "value": 4.91
        },
        {
            "fromTime": "2019-11-04 00:00",
            "value": 3.45
        },
        {
            "fromTime": "2019-11-05 00:00",
            "value": 3.74
        },
        {
            "fromTime": "2019-11-06 00:00",
            "value": 4.72
        },
        {
            "fromTime": "2019-11-07 00:00",
            "value": 6.85
        },
        {
            "fromTime": "2019-11-08 00:00",
            "value": 2.73
        },
        {
            "fromTime": "2019-11-09 00:00",
            "value": 2.31
        },
        {
            "fromTime": "2019-11-10 00:00",
            "value": 6.37
        },
        {
            "fromTime": "2019-11-11 00:00",
            "value": 3.58
        },
        {
            "fromTime": "2019-11-12 00:00",
            "value": 6.23
        },
        {
            "fromTime": "2019-11-13 00:00",
            "value": 3.38
        },
        {
            "fromTime": "2019-11-14 00:00",
            "value": 7.58
        },
        {
            "fromTime": "2019-11-15 00:00",
            "value": 3.66
        },
        {
            "fromTime": "2019-11-16 00:00",
            "value": 2.61
        },
        {
            "fromTime": "2019-11-17 00:00",
            "value": 6.87
        },
        {
            "fromTime": "2019-11-18 00:00",
            "value": 3.7
        },
        {
            "fromTime": "2019-11-19 00:00",
            "value": 3
        },
        {
            "fromTime": "2019-11-20 00:00",
            "value": 4.18
        },
        {
            "fromTime": "2019-11-21 00:00",
            "value": 4.98
        },
        {
            "fromTime": "2019-11-22 00:00",
            "value": 3.56
        },
        {
            "fromTime": "2019-11-23 00:00",
            "value": 3.03
        },
        {
            "fromTime": "2019-11-24 00:00",
            "value": 0
        },
        {
            "fromTime": "2019-11-25 00:00",
            "value": 0
        },
        {
            "fromTime": "2019-11-26 00:00",
            "value": 0
        },
        {
            "fromTime": "2019-11-27 00:00",
            "value": 0
        },
        {
            "fromTime": "2019-11-28 00:00",
            "value": 0
        },
        {
            "fromTime": "2019-11-29 00:00",
            "value": 0
        },
        {
            "fromTime": "2019-11-30 00:00",
            "value": 0
        }
    ],
    "totalConsumption": 98.31000000000002,
    "avgDailyConsumption": 4.274347826086958
}

Do you know if there's any difference from the Fortum Valpas API that you use? The requests and response from consumption API seem much more simple than when using Valpas API.

moment error

Hi,

Thanks for making this.

I tried installing and running, but get the following error.

fortum.getConsumption('my details', moment().startOf('day').subtract(1, 'days'), moment().endOf('day').subtract(1, 'days'), (err, json) => {
^

ReferenceError: moment is not defined
at fortum.login (/fortumAPI-master/main.js:8:12)
at Request.request.get [as _callback] (/fortumAPI-master/fortum.api.js:188:8)
at Request.self.callback (/fortumAPI-master/node_modules/request/request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request. (/fortumAPI-master/node_modules/request/request.js:1161:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage. (/fortumAPI-master/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:313:30)

Any suggestions very much appreciated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.