core: Honeywell Total Connect Comfort (US) API Rate Limit Error / 401 Error

The problem

I have an automation that checks an MQTT sensor for its temperature. If it is below “x” then turn the heat up, if it is above “y”, turn the heat down on the Honeywell thermostat. After a couple of days I get rate limit errors. An HA restart fixes it immediately, so the rate limit error is not correct unless it is being throttled within HA.

Looks similar to https://github.com/home-assistant/core/issues/78531

What version of Home Assistant Core has the issue?

core-2022.11.1 then updated to 2023.11.2 with new errors

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Honeywell Total Comfort (US)

Link to integration documentation on our website

Link

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

`2023-11-20 04:30:00.317 ERROR (SyncWorker_7) [somecomfort] API Rate Limited.
2023-11-20 04:30:00.320 ERROR (MainThread) [homeassistant.components.automation.keep_eva_room_above_71] Keep Eva room above 71: Choose at step 1: default: Error executing script. Unexpected error for call_service at pos 1: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1744, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 208, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 943, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 613, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 471, in async_set_temperature
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 258, in set_temperature
    self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 251, in _set_temperature
    setattr(self._device, f"setpoint_{mode}", temperature)
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 212, in setpoint_heat
    self._client._set_thermostat_settings(self.deviceid,
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 492, in _set_thermostat_settings
    if result.get('success') != 1:
AttributeError: 'NoneType' object has no attribute 'get'
2023-11-20 04:30:00.326 ERROR (MainThread) [homeassistant.components.automation.keep_eva_room_above_71] Keep Eva room above 71: Error executing script. Unexpected error for choose at pos 1: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 904, in _async_choose_step
    await self._async_run_script(choose_data["default"])
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
    await self._async_run_long_action(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
    long_task.result()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1744, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 208, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 943, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 613, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 471, in async_set_temperature
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 258, in set_temperature
    self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 251, in _set_temperature
    setattr(self._device, f"setpoint_{mode}", temperature)
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 212, in setpoint_heat
    self._client._set_thermostat_settings(self.deviceid,
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 492, in _set_thermostat_settings
    if result.get('success') != 1:
AttributeError: 'NoneType' object has no attribute 'get'
2023-11-20 04:30:00.332 ERROR (MainThread) [homeassistant.components.automation.keep_eva_room_above_71] While executing automation automation.keep_eva_room_above_71
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 551, in async_trigger
    await self.action_script.async_run(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 904, in _async_choose_step
    await self._async_run_script(choose_data["default"])
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
    await self._async_run_long_action(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
    long_task.result()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1744, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 208, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 943, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 613, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 471, in async_set_temperature
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 258, in set_temperature
    self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 251, in _set_temperature
    setattr(self._device, f"setpoint_{mode}", temperature)
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 212, in setpoint_heat
    self._client._set_thermostat_settings(self.deviceid,
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 492, in _set_thermostat_settings
    if result.get('success') != 1:
AttributeError: 'NoneType' object has no attribute 'get'`



'2023-11-19 03:00:08.268 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.roak_home fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 429, in _resp_json
    return resp.json()
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 527, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 722, in async_device_update
    raise exc
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 357, in async_update
    await self._data.async_update()
  File "/usr/src/homeassistant/homeassistant/components/honeywell/__init__.py", line 183, in async_update
    await self._refresh_devices()
  File "/usr/src/homeassistant/homeassistant/components/honeywell/__init__.py", line 174, in _refresh_devices
    await self._hass.async_add_executor_job(device.refresh)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 89, in refresh
    data = self._client._get_thermostat_data(self.deviceid)
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 477, in _get_thermostat_data
    return self._get_json(url)
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 452, in _get_json
    return self._request_json('get', *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 443, in _request_json
    return self._resp_json(resp, req)
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 433, in _resp_json
    _LOG.exception("Failed to de-JSON %s %s" % req, resp)
TypeError: not enough arguments for format string
'

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 27 (11 by maintainers)

Most upvoted comments

@mkmer, Thanks for all the work you’ve put into this. I read the thread and still don’t quite understand how to replace my existing integration using somecomfort to your new aiosomecomfort. Would you outline the steps for me? (much appreciated!)

Just update the integration in the HACS panel, and it will pull the aiosomecomfort library automatically. The log, however, will continue to show events as ‘somecomfort’, so not to worry if you see that

There is a change to the HA code as well (not just the API) catching the error - errors will still occur, but the entity should not go unavailable until 3 in a row occur (assuming I did it “right”).