jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
196 stars 48 forks source link

Running Core 2021.8.7 #140

Open JDogg016 opened 3 years ago

JDogg016 commented 3 years ago

Over the past few days the HE integration on HA slows to a crawl each evening with responses taking several minutes (yes minutes). I check into the logs shows the following which may assist me/you in deciphering what is going on.

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/hubitat/hub.py:381 
Integration: Home Assistant WebSocket API (documentation, issues) 
First occurred: August 15, 2021, 9:49:54 PM (972 occurrences) 
Last logged: 7:23:12 AM

[139744180086912] 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('http://192.168.7.57/apps/api/7048/devices/67/off?access_token=28df4a30-39a2-4f3c-a44c-fe414ca4e2ee')
[139744180086912] 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('http://192.168.7.57/apps/api/7048/devices/260/off?access_token=28df4a30-39a2-4f3c-a44c-fe414ca4e2ee')
[139744180086912] 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('http://192.168.7.57/apps/api/7048/devices/75/off?access_token=28df4a30-39a2-4f3c-a44c-fe414ca4e2ee')
[139744180086912] 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('http://192.168.7.57/apps/api/7048/devices/78/off?access_token=28df4a30-39a2-4f3c-a44c-fe414ca4e2ee')
[139744180086912] 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('http://192.168.7.57/apps/api/7048/devices/48/off?access_token=28df4a30-39a2-4f3c-a44c-fe414ca4e2ee')
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 856, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 456, in async_handle_light_on_service
    await async_handle_light_off_service(light, call)
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 467, in async_handle_light_off_service
    await light.async_turn_off(**filter_turn_off_params(light, params))
  File "/config/custom_components/hubitat/light.py", line 243, in async_turn_off
    await self.send_command("off")
  File "/config/custom_components/hubitat/device.py", line 156, in send_command
    await self._hub.send_command(self.device_id, command, arg)
  File "/config/custom_components/hubitat/hub.py", line 381, in send_command
    await self._hub.send_command(device_id, command, arg)
  File "/usr/local/lib/python3.9/site-packages/hubitatmaker/hub.py", line 219, in send_command
    return await self._api_request(path)
  File "/usr/local/lib/python3.9/site-packages/hubitatmaker/hub.py", line 380, in _api_request
    json = await resp.json()
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1097, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('http://192.168.7.57/apps/api/7048/devices/75/off?access_token=28df4a30-39a2-4f3c-a44c-fe414ca4e2ee')

and

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/hubitat/hub.py:381 
Integration: Hubitat (documentation, issues) 
First occurred: August 15, 2021, 9:52:52 PM (4239 occurrences) 
Last logged: 7:14:31 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 856, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 456, in async_handle_light_on_service
    await async_handle_light_off_service(light, call)
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 467, in async_handle_light_off_service
    await light.async_turn_off(**filter_turn_off_params(light, params))
  File "/config/custom_components/hubitat/light.py", line 243, in async_turn_off
    await self.send_command("off")
  File "/config/custom_components/hubitat/device.py", line 156, in send_command
    await self._hub.send_command(self.device_id, command, arg)
  File "/config/custom_components/hubitat/hub.py", line 381, in send_command
    await self._hub.send_command(device_id, command, arg)
  File "/usr/local/lib/python3.9/site-packages/hubitatmaker/hub.py", line 219, in send_command
    return await self._api_request(path)
  File "/usr/local/lib/python3.9/site-packages/hubitatmaker/hub.py", line 380, in _api_request
    json = await resp.json()
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1097, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('http://192.168.7.57/apps/api/7048/devices/260/off?access_token=28df4a30-39a2-4f3c-a44c-fe414ca4e2ee')
jason0x43 commented 3 years ago

The "Attempt to decode JSON" means that the hub has returned an HTML page rather than a JSON response. That usually means the hub is showing an error page.

What happens if you try to manually run a failing command?

> curl 'http://192.168.7.57/apps/api/7048/devices/260/off?access_token=28df4a30-39a2-4f3c-a44c-fe414ca4e2ee'
jason0x43 commented 3 years ago

Is this still happening?