grohe-ondus-api-java icon indicating copy to clipboard operation
grohe-ondus-api-java copied to clipboard

Get Measurements only from 2 o'clock and until 2 o'clock

Open Mimuni opened this issue 6 years ago • 3 comments

Hello Florian, First of all thank you for the great API. After the successful use I noticed a peculiarity and I'm not sure if this is a bug. When I use the method getApplianceData (appliance, from, to) of a "SenseGuardAppliance" and set "to" to today's date, I only get values until 2 o'clock from today. If I put it on tomorrow's date, I get all the values of today. I guess that it has a connection with the in the app set time zone (Germany), because for "from" I get synonymous only data from 2 clock. Is such a problem known or am I just using the API incorrectly?

Best regards Micha

Mimuni avatar Aug 29 '19 18:08 Mimuni

Hi Micha!

Thanks for opening the issue :) Let's dig a bit deeper into this :)

First of all, please also always provide a test code with which you could reproduce the problem, so I'm able to do it ony my side as well :)

First of all: The instants passed to the getApplianceData are directly converted to a Date string with UTC as the time zone, as this is what the Grohe API expects: https://github.com/FlorianSW/grohe-ondus-api-java/blob/master/src/main/java/org/grohe/ondus/api/actions/ApplianceAction.java#L102 One thing to note here is also: The instant itself can hold a time as well, however, the string we pass to the API contains the date only. So the date string may look like 2019-08-30.

Based on this I would say, that the API itself decides which data is provided to you, and therefore it's totally possible that the Grohe systems take the users timezone into account.

So, I tried to work around this by passing a time to the API as well, however, it seems that it does not recognize it at all, at least not in a format I know so far. I'll look a bit deeper in how we could achieve a real "day-to-day" or even better "day with time-to-day with time" range, but I would not promise too much here :(

FlorianSW avatar Aug 31 '19 16:08 FlorianSW

No chance... so far, no matter what I tried the data returned from the API is always +01:00 for me (the test account I'm using has the timezone "60" set in the account, which I'm, unfortunately can't change?).

Could you probably take a look into the value "timezone" in the response of an appliance request? You would need to manuall issue the reuest, as the java API does not expose this value at the moment. The API request to issue would be: GET https://idp2-apigw.cloud.grohe.com/v3/iot/locations/LOCATION_ID/rooms/ROOM_ID/appliances/APPLIANCE_ID

Please replace uppercase values with their respective values. Also, please include your access_token in the Authorization header with Bearer ACCESS_TOKEN.

Thanks for your help! :)

FlorianSW avatar Aug 31 '19 17:08 FlorianSW

Hello, Florian, Sorry for the late feedback. Unfortunately I didn't get back until today.

I also tried to transfer the time to the API in different formats. But it never had an influence. I also tested different time zones, whereby the value "timezone" always remained on 60. However, when the measured data is retrieved, the start time changes according to the time zone.

Interesting is perhaps the value "tdt" of the API, which probably supplies the time of the last measurement with time zone. For Germany it looks like this:

"tdt": "2019-09-06T08:30:35.000+02:00"

And for Iceland, for example. "tdt": "2019-09-06T06:30:35.000+00:00"

For me it is a workaround to put the country on Iceland in the AP, with the time zone UTC. Then I get data from 0:00 with this example format "2019-09-06T00:08:29.000+00:00". But that can't really be the solution.

Mimuni avatar Sep 06 '19 06:09 Mimuni