openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[linky] Full history of data returned by the requests #17070

Open lolodomo opened 2 months ago

lolodomo commented 2 months ago

Start and end dates in the console command are ignored. Even default dates are ignored. Looks like around 3 years of data are systematically returned. Maybe something has changed in the API with the handling of dates ? If only thie "report" console command is affected, that is not dramatic. In case all daily requests are affected, that would be more annoying. I will investigate. @clinique for information

lolodomo commented 2 months ago

Just by enabling DEBUG logs, I can unfortunately confirm that even daily requests are impacted, that means each request returns a full history. I guess the dates we provide are probably wrong, maybe the format has changed ?

lolodomo commented 2 months ago

Here is the date format used when building the GET URL: https://github.com/openhab/openhab-addons/blob/main/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/api/EnedisHttpApi.java#L56

And here is the URL used with parameters dateDebut and dateFin: https://github.com/openhab/openhab-addons/blob/main/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/api/EnedisHttpApi.java#L66

@clinique: could you please check if parameters are still dateDebut and dateFin and that the used format is still valid ?

lolodomo commented 1 month ago

@clinique : any chance you take a look ? Such a fix could be a candidate for 4.2.x.

clinique commented 1 month ago

Morning @lolodomo . I've made the check in the browser. The URL parameters do not seem to have changed: image

...just they seem to be completely ignored by the server : image

lolodomo commented 1 month ago

What do you suggest to do ?

clinique commented 1 month ago

I don't know what I can do. The API does not take care of date filtering

lsiepel commented 1 month ago

Is there official documentation for this api? I found https://data.enedis.fr/api/v1/console/datasets/1.0/search/ but that might be totally unrelated. If it is the same api, there is also a v2 and newer api. Those might not be affected (long shot)

clinique commented 1 month ago

No, it has be retro-engineered from the website. Final solution should come from https://github.com/openhab/openhab-addons/pull/16355