Giter VIP home page Giter VIP logo

energy-prices-api's Introduction

Energy Price API

Simple API that returns the price for gas and electricity.

Currently only supports Belgium 🇧🇪 but I'm open to pull requests!.

Usage

Get gas prices:

GET https://energy-prices.savjee.workers.dev/be/gas

Response:

{
    "price":2.3989239371241693,
    "unit":"m3"
}

Get electricity price:

GET https://energy-prices.savjee.workers.dev/be/electricity

Response:

{
    "avg":0.3301816666666666,
    "median":0.30147
}

The API is a Cloudflare Worker that makes requests to the datasources (PowerNext and Elia) and caches the results for 1 hour.

Integration with Home Assistant

Want to use this API in your Home Assistant instance? Simply include these RESTful sensors:

- platform: rest
  resource: https://energy-prices.savjee.workers.dev/be/gas
  method: GET
  name: Gas wholesale price
  value_template: {{ value_json.price | round(2) }}
  device_class: monetary
  state_class: measurement
  unit_of_measurement: "€/m³"
  scan_interval: 3600  # 1 hour

- platform: rest
  resource: https://energy-prices.savjee.workers.dev/be/electricity
  method: GET
  name: Electricity wholesale price
  value_template: {{ value_json.avg | round(2) }}
  device_class: monetary
  state_class: measurement
  unit_of_measurement: "€/kWh"
  scan_interval: 3600  # 1 hour

Wishlist

  • Support more countries
  • Version the API to prevent breaking changes in the future
  • Have a uniform response format and document the units we're using

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.