This topic is related with the following topic I created earlier:
https://www.domoticz.com/forum/viewtopic.php?t=42104
I had to write 2 different dzVents scripts:
- one when ENTSOE returns a set of data containing a single Timeserie
- one when ENTSOE returns a set of data containing multiple Timeseries
Here is a link which shows a dataset with a single Timeseries
https://web-api.tp.entsoe.eu/api?securi ... 2404092300
And this is a link which shows a dataset with multiple Timeseries
https://web-api.tp.entsoe.eu/api?securi ... 2404092300
In both cases I retrieve the amount of MWH generated in France per hour and per "Generation Type" for a selected day (typically yesterday)
I use the following syntax to find the Timeseries in the received XML dataset:
Code: Select all
for key, value in pairs (item.xml.GL_MarketDocument.TimeSeries) do idx = idx + 1 end
However when there is only a single Timeserie, this do not return 1 as I would expect but the number of Tags in GL_MarketDocument (8 in this case)
While having 2 scripts is not really a problem, I just would like to know if there is a solution (PAIRS or something else) which allows to determine for both cases the number of Timeseries so that I can have a single script that handles both cases.
Thanks a lot in advance
Willy