This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

API esios ree
#8
(15.05.2020, 12:45)esteve.budia Wrote: Original script was designed by me....

I did it for share of course
-- =======================================================================================
-- =======================================================================================
-- =======================================================================================
-- =======================================================================================
-- ====  ejemplo 20.3      Término de facturación de energía activa del PVPC    =========
-- =======================================================================================
-- =======================================================================================
-- =======================================================================================
-- ===============================SCHNEIDER=ELECTRIC=esteve=budia=2018====================
Hi Esteve

There is one thing that I do not understand about your script, it is assumed that what is downloaded from ESIOS is a json, so it should be converted to a lua table with json.decode (value), where value would be response_body, but you have it from another shape.
In the log that is obtained, put:

Code:
Event for OFF TOTAL (0/0/1) 02.09.2020 19:22:10
* arg: 1
  * number: 200
* arg: 2
  * table:
   [1]
    * string: {"indicator":{"name":"Término de facturación de energía activa del PVPC peaje por defecto suma componentes","short_name":"PVPC T. Defecto","id":10229,"composited":true,"step_type":"linear","disaggregated":false,"magnitud":[{"name":"Precio","id":23}],"tiempo":[{"name":"Hora","id":4}],"geos":[{"geo_id":3,"geo_name":"España"}],"values_updated_at":"2020-09-01T20:25:03.000+02:00","values":[{"value":102.04,"datetime":"2020-09-02T00:00:00.000+02:00","datetime_utc":"2020-09-01T22:00:00Z","tz_time":"2020-09-01T22:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":98.29,"datetime":"2020-09-02T01:00:00.000+02:00","datetime_utc":"2020-09-01T23:00:00Z","tz_time":"2020-09-01T23:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":96.52,"datetime":"2020-09-02T02:00:00.000+02:00","datetime_utc":"2020-09-02T00:00:00Z","tz_time":"2020-09-02T00:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":95.27,"datetime":"2020-09-02T03:00:00.000+02:00","datetime_utc":"2020-09-02T01:00:00Z","tz_time":"2020-09-02T01:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":96.4,"datetime":"2020-09-02T04:00:00.000+02:00","datetime_utc":"2020-09-02T02:00:00Z","tz_time":"2020-09-02T02:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":99.22,"datetime":"2020-09-02T05:00:00.000+02:00","datetime_utc":"2020-09-02T03:00:00Z","tz_time":"2020-09-02T03:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":104.97,"datetime":"2020-09-02T06:00:00.000+02:00","datetime_utc":"2020-09-02T04:00:00Z","tz_time":"2020-09-02T04:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":104.29,"datetime":"2020-09-02T07:00:00.000+02:00","datetime_utc":"2020-09-02T05:00:00Z","tz_time":"2020-09-02T05:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":104.63,"datetime":"2020-09-02T08:00:00.000+02:00","datetime_utc":"2020-09-02T06:00:00Z","tz_time":"2020-09-02T06:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":104.91,"datetime":"2020-09-02T09:00:00.000+02:00","datetime_utc":"2020-09-02T07:00:00Z","tz_time":"2020-09-02T07:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":102.06,"datetime":"2020-09-02T10:00:00.000+02:00","datetime_utc":"2020-09-02T08:00:00Z","tz_time":"2020-09-02T08:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":102.28,"datetime":"2020-09-02T11:00:00.000+02:00","datetime_utc":"2020-09-02T09:00:00Z","tz_time":"2020-09-02T09:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":103.16,"datetime":"2020-09-02T12:00:00.000+02:00","datetime_utc":"2020-09-02T10:00:00Z","tz_time":"2020-09-02T10:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":101.96,"datetime":"2020-09-02T13:00:00.000+02:00","datetime_utc":"2020-09-02T11:00:00Z","tz_time":"2020-09-02T11:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":102.02,"datetime":"2020-09-02T14:00:00.000+02:00","datetime_utc":"2020-09-02T12:00:00Z","tz_time":"2020-09-02T12:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":102.52,"datetime":"2020-09-02T15:00:00.000+02:00","datetime_utc":"2020-09-02T13:00:00Z","tz_time":"2020-09-02T13:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":105.05,"datetime":"2020-09-02T16:00:00.000+02:00","datetime_utc":"2020-09-02T14:00:00Z","tz_time":"2020-09-02T14:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":106.52,"datetime":"2020-09-02T17:00:00.000+02:00","datetime_utc":"2020-09-02T15:00:00Z","tz_time":"2020-09-02T15:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":106.65,"datetime":"2020-09-02T18:00:00.000+02:00","datetime_utc":"2020-09-02T16:00:00Z","tz_time":"2020-09-02T16:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":108.91,"datetime":"2020-09-02T19:00:00.000+02:00","datetime_utc":"2020-09-02T17:00:00Z","tz_time":"2020-09-02T17:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":110.41,"datetime":"2020-09-02T20:00:00.000+02:00","datetime_utc":"2020-09-02T18:00:00Z","tz_time":"2020-09-02T18:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":111.91,"datetime":"2020-09-02T21:00:00.000+02:00","datetime_utc":"2020-09-02T19:00:00Z","tz_time":"2020-09-02T19:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":109.16,"datetime":"2020-09-02T22:00:00.000+02:00","datetime_utc":"2020-09-02T20:00:00Z","tz_time":"2020-09-02T20:00:00.000Z","geo_id":3,"geo_name":"España"},{"value":104.25,"datetime":"2020-09-02T23:00:00.000+02:00","datetime_utc":"2020-09-02T21:00:00Z","tz_time":"2020-09-02T21:00:00.000Z","geo_id":3,"geo_name":"España"}]}}

It is supposed to be a table, but it only has one field [1] and what it contains is a string with all the result? How do I keep for example the short name of PVPC to assign it, for example to a virtual object? Or prices, which is the important thing of course.
Should it be string manipulation functions? Some example?

Thank you
Reply


Messages In This Thread
API esios ree - by JoseJimenez94 - 02.03.2020, 10:00
RE: API esios ree - by admin - 02.03.2020, 10:03
RE: API esios ree - by JoseJimenez94 - 02.03.2020, 11:06
RE: API esios ree - by admin - 02.03.2020, 11:13
RE: API esios ree - by admin - 02.03.2020, 13:54
RE: API esios ree - by JoseJimenez94 - 02.03.2020, 15:47
RE: API esios ree - by esteve.budia - 15.05.2020, 12:45
RE: API esios ree - by JRP - 02.09.2020, 17:24
RE: API esios ree - by admin - 03.09.2020, 06:29
RE: API esios ree - by JRP - 03.09.2020, 08:08
RE: API esios ree - by admin - 03.09.2020, 08:25
RE: API esios ree - by JRP - 03.09.2020, 08:34
RE: API esios ree - by admin - 03.09.2020, 08:36
RE: API esios ree - by JRP - 03.09.2020, 08:40
RE: API esios ree - by JRP - 10.09.2020, 10:44
RE: API esios ree - by JRP - 16.06.2021, 16:52
RE: API esios ree - by JRP - 16.06.2021, 19:01
RE: API esios ree - by admin - 18.06.2021, 05:27
RE: API esios ree - by JRP - 21.06.2021, 14:50
RE: API esios ree - by JRP - 23.06.2021, 09:20
RE: API esios ree - by admin - 23.06.2021, 09:21
RE: API esios ree - by JRP - 23.06.2021, 10:59
RE: API esios ree - by jose_dli - 16.02.2023, 08:01
RE: API esios ree - by admin - 16.02.2023, 12:54
RE: API esios ree - by jose_dli - 16.02.2023, 14:33
RE: API esios ree - by admin - 16.02.2023, 14:37
RE: API esios ree - by admin - 17.02.2023, 09:25
RE: API esios ree - by jose_dli - 17.02.2023, 11:57
RE: API esios ree - by jose_dli - 21.02.2023, 13:10

Forum Jump: