Code Monkey home page Code Monkey logo

Comments (11)

JonasPed avatar JonasPed commented on July 23, 2024 1

Version 0.4.0 just released containing year to date sensor.

from homeassistant-eloverblik.

Inrego avatar Inrego commented on July 23, 2024

I believe it's as simple as calling the get time series endpoint with the aggregation parameter set to Year and dateFrom set to {currentYear}-01-01 and dateTo set to {currentYear}-12-31.

from homeassistant-eloverblik.

runemoennike avatar runemoennike commented on July 23, 2024

I agree, would love to see this. Willing to help with a PR.

from homeassistant-eloverblik.

Inrego avatar Inrego commented on July 23, 2024

Python isn't my strongest suit. But instead of waiting around for this, I made it in Node-Red instead. It grabs the YTD value and sends it to a sensor in HA through the HA companion integration.

Here's my code in Node-Red, I figure it might be useful for implementing it in this extension.

Generate url, payload and headers for the request;

var token = msg.payload.result;
msg.headers = {'Authorization': 'Bearer ' + token};
var dt = new Date();
var from = dt.getFullYear() + '-01-01';
var to = dt.toISOString().substring(0, 10);
msg.url = `https://api.eloverblik.dk/customerapi/api/meterdata/gettimeseries/${from}/${to}/Year`;
msg.payload = {
  "meteringPoints": {
    "meteringPoint": [
      "XXXXXXXXXXXXXXXXX"
    ]
  }
};
return msg;

Getting the value out of the response:

if (msg.statusCode !== 200 || !msg.payload.result[0].success) {
    return null;
}
var amount = msg.payload.result[0].MyEnergyData_MarketDocument.TimeSeries[0].Period[0].Point[0]['out_Quantity.quantity'];
msg = {state: Number(amount)};
return msg;

from homeassistant-eloverblik.

runemoennike avatar runemoennike commented on July 23, 2024

This one can be closed now :)

from homeassistant-eloverblik.

Inrego avatar Inrego commented on July 23, 2024

Would like to see a new version release with this included.

from homeassistant-eloverblik.

runemoennike avatar runemoennike commented on July 23, 2024

It should be in 0.3.1 already :)

from homeassistant-eloverblik.

Inrego avatar Inrego commented on July 23, 2024

The commit to add a year to date sensor was made 27 days ago.
0.3.1 was released 5 months ago?

from homeassistant-eloverblik.

runemoennike avatar runemoennike commented on July 23, 2024

You're right, I confused it with another repository.

from homeassistant-eloverblik.

runemoennike avatar runemoennike commented on July 23, 2024

This one can also be closed, I think?

from homeassistant-eloverblik.

Inrego avatar Inrego commented on July 23, 2024

Yes I agree

from homeassistant-eloverblik.

Related Issues (20)

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.