Flo-Schilli / homeassistant-grohe_sense

Grohe Sense integration for Home Assistant
Other
6 stars 2 forks source link

Log Errors during using Integration #12

Closed patricknitsch closed 1 week ago

patricknitsch commented 2 weeks ago

Hey,

at first, thank you. Your integration works good!

In my logfile I get the following errors:

Logger: homeassistant.helpers.entity Quelle: helpers/entity.py:942 Erstmals aufgetreten: 27. August 2024 um 22:12:31 (7 Vorkommnisse) Zuletzt protokolliert: 08:18:35

Update for valve.grohe_sense_guard_valve fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1300, in async_device_update
    await self.async_update()
  File "/config/custom_components/grohe_sense/entities/grohe_sense_guard_valve.py", line 53, in async_update
    command_response = await self._auth_session.get_appliance_command(self._device.location_id,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/grohe_sense/api/ondus_api.py", line 394, in get_appliance_command
    return ApplianceCommand.from_dict(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dataclasses_json/api.py", line 70, in from_dict
    return _decode_dataclass(cls, kvs, infer_missing)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dataclasses_json/core.py", line 163, in _decode_dataclass
    kvs = {decode_names.get(k, k): v for k, v in kvs.items()}
                                                 ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'items'
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: homeassistant
Quelle: custom_components/grohe_sense/entities/grohe_sensor.py:52
Integration: Grohe Sense (Dokumentation, Probleme)
Erstmals aufgetreten: 00:05:38 (51 Vorkommnisse)
Zuletzt protokolliert: 04:15:43

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 453, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/grohe_sense/entities/grohe_sensor.py", line 52, in _handle_coordinator_update
    if self._coordinator.data.measurement is not None:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'measurement'
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.grohe_sense.entities.grohe_sense_update_coordinator
Quelle: custom_components/grohe_sense/entities/grohe_sense_update_coordinator.py:90
Integration: Grohe Sense (Dokumentation, Probleme)
Erstmals aufgetreten: 00:05:38 (51 Vorkommnisse)
Zuletzt protokolliert: 04:15:43

Error updating Grohe Sense data: list index out of range
Error updating Grohe Sense data: 'NoneType' object has no attribute 'items'

As you see, the errors comes multiple times.

Maybe you now, what the problem is, and can help?

Flo-Schilli commented 2 weeks ago

Hi,

it seems to me like these errors are coming from errors on Grohe Side whiche are not handled correctly within the integration. I've added some more error handling and a warning log if there is a status returned from GroheAPI but it shouldn't lead to any other errors/tracebacks in the log. Can you please give the new version a try. I also installed it on my end and will monitor also.

patricknitsch commented 2 weeks ago

Hi,

thanks for your fast feedback. I installed it. I will check it the next days and give feedback. Thank you!

Flo-Schilli commented 2 weeks ago

I just found two more issues with invalid data:

Those two should be fixed now in develop - branch and I'm going to merge them soon to the main branch.

Flo-Schilli commented 2 weeks ago

I just pushed the changes already to main, so you should be able to test with the main branch.

patricknitsch commented 2 weeks ago

Found these errors in logfile...

Logger: homeassistant.helpers.entity
Quelle: helpers/entity.py:942
Erstmals aufgetreten: 16:53:57 (1 Vorkommnisse)
Zuletzt protokolliert: 16:53:57

Update for valve.grohe_sense_guard_valve fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1300, in async_device_update
    await self.async_update()
  File "/config/custom_components/grohe_sense/entities/grohe_sense_guard_valve.py", line 57, in async_update
    if command_response.command.valve_open is not None:
       ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'command'

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: custom_components.grohe_sense.api.ondus_api
Quelle: custom_components/grohe_sense/api/ondus_api.py:204
Integration: Grohe Sense (Dokumentation, Probleme)
Erstmals aufgetreten: 16:53:57 (3 Vorkommnisse)
Zuletzt protokolliert: 17:53:58

URL https://idp2-apigw.cloud.grohe.com/v3/iot/locations/7180867/rooms/6361131/appliances/da9f8903-18a9-4e8c-bc95-d3da3266b7ad/command returned status code 401
URL https://idp2-apigw.cloud.grohe.com/v3/iot/locations/7180867/rooms/6398557/appliances/8f273505-6abd-41e7-b9fb-d35f206fd41f/data/aggregated?from=2024-08-30 returned status code 401
URL https://idp2-apigw.cloud.grohe.com/v3/iot/locations/7180867/rooms/6398557/appliances/8f273505-6abd-41e7-b9fb-d35f206fd41f/notifications returned status code 401
Flo-Schilli commented 1 week ago

Hey, I also saw them within the logs. Im gonna commit a fix next week, as soon as I'm on my PC again.

patricknitsch commented 1 week ago

Hi, no problem. That were the last issues in the log I saw the last days :)

Flo-Schilli commented 1 week ago

@patricknitsch now all the warnings and errors should be fixed. Can you verify this.

patricknitsch commented 1 week ago

Looks good until now. Now warnings or errors.

Flo-Schilli commented 1 week ago

I'm gonna close the ticket then. If you find some other issues just create a new issue 😊

patricknitsch commented 1 week ago

I will do. Thank you for your support.