GithubHelp home page GithubHelp logo

zoilomora / iberdrola Goto Github PK

View Code? Open in Web Editor NEW
16.0 7.0 3.0 13 KB

Integration with Iberdrola API

Home Page: https://packagist.org/packages/zoilomora/iberdrola

License: MIT License

PHP 100.00%
iberdrola api icp automatic electricity reading

iberdrola's Introduction

Iberdrola

This library aims to help make integrations with the Iberdrola API.

Installation

  1. Install via composer
composer require zoilomora/iberdrola

Example

<?php
use ZoiloMora\Iberdrola\Iberdrola;

$limit = 3.4; // Hired potency (kW)

$iberdrola = new Iberdrola('[email protected]', '123456');
$reading = $iberdrola->getReading();
$floatValue = floatval($reading->valMagnitud);

if (($floatValue/1000) >= $limit) {
    // Send notification
}

You can see more in the examples folder.

License

Licensed under the MIT license

Read LICENSE for more information

iberdrola's People

Contributors

alvaro-octal avatar zoilomora avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

iberdrola's Issues

Gestión del DST

Buenas, y enhorabuena por la librería,

Hay un error al operar con días con el cambio de hora:

Para el día 2013-10-28 (Último domingo de Octubre, a las 3 son las 2), hay 25 mediciones, y al ejecutar _normalizeMeasurements(), al iterar sumando una hora no se tiene en cuenta, por lo que salta de día.

[
    {
        "date": "2013-10-27 00:00:00",
        "value": 119
    },
    {
        "date": "2013-10-27 01:00:00",
        "value": 281
    },
    {
        "date": "2013-10-27 02:00:00",
        "value": 149
    },
    {
        "date": "2013-10-27 03:00:00",
        "value": 149
    },
    {
        "date": "2013-10-27 04:00:00",
        "value": 148
    },
    {
        "date": "2013-10-27 05:00:00",
        "value": 156
    },
    {
        "date": "2013-10-27 06:00:00",
        "value": 150
    },
    {
        "date": "2013-10-27 07:00:00",
        "value": 146
    },
    {
        "date": "2013-10-27 08:00:00",
        "value": 147
    },
    {
        "date": "2013-10-27 09:00:00",
        "value": 161
    },
    {
        "date": "2013-10-27 10:00:00",
        "value": 196
    },
    {
        "date": "2013-10-27 11:00:00",
        "value": 114
    },
    {
        "date": "2013-10-27 12:00:00",
        "value": 132
    },
    {
        "date": "2013-10-27 13:00:00",
        "value": 112
    },
    {
        "date": "2013-10-27 14:00:00",
        "value": 119
    },
    {
        "date": "2013-10-27 15:00:00",
        "value": 129
    },
    {
        "date": "2013-10-27 16:00:00",
        "value": 114
    },
    {
        "date": "2013-10-27 17:00:00",
        "value": 126
    },
    {
        "date": "2013-10-27 18:00:00",
        "value": 120
    },
    {
        "date": "2013-10-27 19:00:00",
        "value": 120
    },
    {
        "date": "2013-10-27 20:00:00",
        "value": 364
    },
    {
        "date": "2013-10-27 21:00:00",
        "value": 297
    },
    {
        "date": "2013-10-27 22:00:00",
        "value": 115
    },
    {
        "date": "2013-10-27 23:00:00",
        "value": 127
    },
    {
        "date": "2013-10-28 00:00:00",
        "value": 447
    }
]

Y al obtener los consumos del día siguiente 2013-10-28 se devuelve:

[
    {
        "date": "2013-10-28 00:00:00",
        "value": 473
    },
    ...
]

Digamos, "duplicando" el registro de 2013-10-28 00:00:00, aunque en realidad se refieren a horas distintas.

De igual modo, para el 2018-03-25 (Último domingo de Marzo, a las 2 son las 3), se tienen únicamente 23 mediciones, pero tampoco corresponderían con la hora real.

[
    ...
    {
        "date": "2018-03-25 21:00:00",
        "value": 202
    },
    {
        "date": "2018-03-25 22:00:00",
        "value": 644
    }
]

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.