homeassistant-grohe_sense icon indicating copy to clipboard operation
homeassistant-grohe_sense copied to clipboard

Fixed new api

Open weissm opened this issue 1 year ago • 8 comments

Appearently Grohe has changed its Api. Took the changes discussed here as basis: https://github.com/FlorianSW/grohe-ondus-api-java/issues/14

weissm avatar Sep 23 '23 10:09 weissm

I made all the changes to files, but I still can't get any values to HA. HA Log shows:

Logger: homeassistant.helpers.entity
Source: custom_components/grohe_sense/sensor.py:128
Integration: Grohe Sense ([documentation](https://github.com/gkreitz/homeassistant-grohe_sense))
First occurred: October 4, 2023 at 19:49:30 (1 occurrences)
Last logged: October 4, 2023 at 19:49:30

Update for sensor.minun_guard_flowrate fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 683, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 936, in async_device_update
    await self.async_update()
  File "/config/custom_components/grohe_sense/sensor.py", line 249, in async_update
    await self._reader.async_update()
  File "/config/custom_components/grohe_sense/sensor.py", line 128, in async_update
    w['starttime'] = parse_time(w['starttime'])

What might be the problem?

svalavuo avatar Oct 05 '23 12:10 svalavuo

I made all the changes to files, but I still can't get any values to HA. HA Log shows:

Logger: homeassistant.helpers.entity
Source: custom_components/grohe_sense/sensor.py:128
Integration: Grohe Sense ([documentation](https://github.com/gkreitz/homeassistant-grohe_sense))
First occurred: October 4, 2023 at 19:49:30 (1 occurrences)
Last logged: October 4, 2023 at 19:49:30

Update for sensor.minun_guard_flowrate fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 683, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 936, in async_device_update
    await self.async_update()
  File "/config/custom_components/grohe_sense/sensor.py", line 249, in async_update
    await self._reader.async_update()
  File "/config/custom_components/grohe_sense/sensor.py", line 128, in async_update
    w['starttime'] = parse_time(w['starttime'])

What might be the problem?

From my understanding, 'starttime' is not provided anymore via the new API. Hence, the associated checking code seems to be void. You may either check for the existance of 'starttime' or remove this if section. Hope, this helps.

weissm avatar Oct 06 '23 05:10 weissm

  File "/config/custom_components/grohe_sense/sensor.py", line 128, in async_update
    w['starttime'] = parse_time(w['starttime'])

What might be the problem?

From my understanding, 'starttime' is not provided anymore via the new API. Hence, the associated checking code seems to be void. You may either check for the existance of 'starttime' or remove this if section. Hope, this helps.

So I should remove everything from line 124 to line 137. Quite big chunk of code...

svalavuo avatar Oct 06 '23 09:10 svalavuo

Now it seems to get some data from Grohe. I set HA loglevel to debug, booted my host, and now I can see following in container log: [custom_components.grohe_sense.sensor] Data read: {'group_by': 'day', 'measurement': [{'date': '2023-10-08', 'flowrate': 0.2, 'pressure': 5.22, 'temperature_guard': 14.62}, ..., 'withdrawals': [{'date': '2023-10-08', 'waterconsumption': 91.3, 'hotwater_share': 9.4, 'water_cost': 0.4, 'energy_cost': 0.04}, ...]} Should HA (grohe integration) understand that directly? If so, how should those sensors show up in HA? Sorry to flood this, but I'd like to have that integration working. Thanks for the fix to API! This should be merged to main asap.

svalavuo avatar Oct 08 '23 16:10 svalavuo

This should indeed show up as sensor entity. The name should start with the one you provided in the Grohe App. All data you show are refering to GROHE_SENSE_GUARD_TYPE.

weissm avatar Oct 09 '23 05:10 weissm

Nice job! I had it fully working a few days :) Suddenly all sensors from the grohe sense guard unit is gone. pressure, flowrate, temperature, 1 day and 7 day. The main valve button is still there and working. Has anything changed or is this a problem on my end?

I am getting a lot of these messages in the logs: WARNING (MainThread) [homeassistant.components.sensor] Updating grohe_sense sensor took longer than the scheduled update interval 0:00:30

The flood sensors updates humidity and temperatures once every 24 hours.

Another question. I get the notifications in HA for flooding, but no notifications when the flooding is fixed. Is this correct? I was hoping to make these into binary sensors, but with no reset that's probably no good.

areeeee avatar Oct 10 '23 23:10 areeeee

Please note that the update changed proposed above by FlorianSW is now utilizing a daily update. Hence, at least the 24h update frequency could be understood. Everything else sounds akward, while the warning itself is standard for the sensor having problems starting up. Hope you can fix it.

weissm avatar Oct 11 '23 04:10 weissm

This should indeed show up as sensor entity. The name should start with the one you provided in the Grohe App. All data you show are refering to GROHE_SENSE_GUARD_TYPE.

For some reason my integration doesn't bring any sensors or entities. :-( Integration doesn't give errors on start, so it should be ok. I'm quite confused.

svalavuo avatar Oct 21 '23 08:10 svalavuo