home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74k stars 31.05k forks source link

Honeywell TCC error when adjusting settings #78531

Closed JCrankWV closed 1 year ago

JCrankWV commented 2 years ago

The problem

When I attempt to change a temperature set point the attache error occurs, and the set point is not change. I have deleted and reinstalled the integration, but still getting the same error.

Thank you for any assistance.

What version of Home Assistant Core has the issue?

2022.08.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

honeywell total comfort

Link to integration documentation on our website

https://www.home-assistant.io/integrations/honeywell

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.websocket_api.http.connection
Source: components/honeywell/climate.py:265 
Integration: Home Assistant WebSocket API (documentation, issues) 
First occurred: 7:52:36 AM (5 occurrences) 
Last logged: 7:56:53 AM

[547765684256] not enough arguments for format string
[547765689968] not enough arguments for format string
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/components/websocket_api/commands.py", line 200, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 588, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 446, 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 265, in set_temperature
    self._device.setpoint_heat = 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 491, in _set_thermostat_settings
    result = self._post_json(url, data=data)
  File "/usr/local/lib/python3.10/site-packages/somecomfort/client.py", line 455, in _post_json
    return self._request_json('post', *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

mkmer commented 1 year ago

This "fix" will only stop the returned page from crashing the integration (handling a non JSON response)- it doesn't address why the website is rejecting the control message. If you could put the logger on debug for Honeywell: AIOSomecomfort: debug homeassistant.components.honeywell: debug

if you happen to move to 0.0.6, aiosomecomfort: debug

Maybe we can get a bit more info to see what is malformed.

I'm still suspicious that the automation is trying to set the setpoint before the integration has finished logging in - the bump may allow for it to "recover" if that's the case.

ShortPutt commented 1 year ago

I’ll set the debug levels and try it.

ShortPutt commented 1 year ago

Ok, now I’m confused. I updated the debug levels and restarted HA and the last two calls successfully changed the temp - once on each thermostat. I don’t want to run it to frequently or I’ll bump into the API limit. Each thermostat is updated twice an hour. I’ll report back tomorrow on how it does overnight.

Btw, I tested the service calls before I updated the debug levels and they worked fine - I updated the target temp on each thermostat.

mkmer commented 1 year ago

I get it... this is a bit difficult to test! BTW: You shouldn't hit the API limit anymore, The limit was on refreshing the web page, NOT reading values and setting values - if you do hit it, I'd like to know that too.
Maybe when you start up, it hits the API limit reading the first pages - I'll dig into how that works with multiple stats.

I had my local version updating at 5 seconds for 2 weeks with no API limit, just to prove I could do it. That's a bit fast, so we're at 30 seconds for production - should be fast enough to catch the on/off cycles.

ShortPutt commented 1 year ago

Good news on the API Limit.

So far it has succeeded 4 times and failed 6. I started adding some debug statements to dump info to the logs, but I haven't found anything suspicious yet.

I'm not sure how to bump AIOSomecomfort to 0.0.6. I'll look into how to do it but if you can send some instructions, that'll probably be faster.

Here's a recent log. My statements say AndyLog. You can see two runs - first one successful, second fails.

2023-02-02 18:00:00.063 DEBUG (MainThread) [somecomfort] AndyLog: data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': None, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7061292}.
2023-02-02 18:00:00.337 DEBUG (MainThread) [somecomfort] AndyLog: set_setpoint_cool: lower: 60.0.  upper: 99.0.  temp: 72.0.
2023-02-02 18:00:00.338 DEBUG (MainThread) [somecomfort] AndyLog: data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': None, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7061292}.
2023-02-02 18:00:04.379 WARNING (MainThread) [HVAC] HA HVAC 24A Set Temp Successful
Date / Time               2023/02/02 06:00:00
Thermostat Temp          71.0
ESP Temp                 69.8
Target Temp              71.0
Temp Adjustment           -1
New Thermostat Temp      72
Thermostat set to        72
2023-02-02 18:15:00.478 DEBUG (MainThread) [somecomfort] AndyLog: data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': None, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7039159}.
2023-02-02 18:15:01.344 DEBUG (MainThread) [somecomfort] AndyLog: set_setpoint_cool: lower: 60.0.  upper: 99.0.  temp: 70.0.
2023-02-02 18:15:01.344 DEBUG (MainThread) [somecomfort] AndyLog: data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': None, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7039159}.
2023-02-02 18:15:01.565 ERROR (MainThread) [somecomfort] Failed to de-JSON /portal/Device/SubmitControlScreenChanges <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:46df4fc6-fed1-483f-a7be-22dea0fe3af4', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:15', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Thu, 02 Feb 2023 23:15:00 GMT', 'Content-Length': '3448', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0445525d5f4f58455e445a4a42378b;expires=Thu, 02-Feb-2023 23:12:43 GMT;path=/;secure;httponly')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 101, in _resp_json
    return await resp.json()
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 52, in json
    return await super().json(*args, loads=loads, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges')
2023-02-02 18:15:01.571 ERROR (MainThread) [homeassistant.components.automation.hvac_set_24b_temp_new] HVAC 24B Set Temp: Choose at step 1: choice 1: 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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/device.py", line 150, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 175, in _set_thermostat_settings
    if result.get("success") != 1:
AttributeError: 'NoneType' object has no attribute 'get'
2023-02-02 18:15:01.580 ERROR (MainThread) [homeassistant.components.automation.hvac_set_24b_temp_new] HVAC 24B Set Temp: 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 896, in _async_choose_step
    await self._async_run_script(script)
  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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/device.py", line 150, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 175, in _set_thermostat_settings
    if result.get("success") != 1:
AttributeError: 'NoneType' object has no attribute 'get'
2023-02-02 18:15:01.585 ERROR (MainThread) [homeassistant.components.automation.hvac_set_24b_temp_new] While executing automation automation.hvac_set_24b_temp_new
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 546, 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 896, in _async_choose_step
    await self._async_run_script(script)
  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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/device.py", line 150, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 175, in _set_thermostat_settings
    if result.get("success") != 1:
AttributeError: 'NoneType' object has no attribute 'get'
mkmer commented 1 year ago

Nice work. I don't like the data log with everything "none" - maybe you need to move the log to after line 164 so we can see what we sent?

https://github.com/mkmer/AIOSomecomfort/blob/c1b6c18a5346ccdb7b7e6a4eebb1430aecc6d65e/aiosomecomfort/__init__.py#L155-L165

0.0.6 is in the 2023.2.1 release, but before moving there, see if we can get the full "data" message captured.

One more thought: on the successful actions, were they for different T-stats, or the same one? Maybe it doesn't like the page we are on when we send controls...

ShortPutt commented 1 year ago

Over night we had 25 failures and 12 successes - 11 success for thermostat in 24A and 1 success for thermostat in 24B. Even though its skewed, I think it exnorates the 24B automation.

I added another log message in the automation before the service call to change the thermostat target temp - just to confirm its not the automation sending garbage. Its not. You can see it in the logs below.

I didn't like the data w/ the "none"s either, but the successful calls had the same data, didn't consider that an issue.

2023-02-02 15:15:00.486 DEBUG (MainThread) [somecomfort] AndyLog: set_setpoint_cool: lower: 60.0.  upper: 99.0.  temp: 74.0.
2023-02-02 15:15:00.489 DEBUG (MainThread) [somecomfort] AndyLog: data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': None, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7039159}.
2023-02-02 15:15:02.627 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp Successful

I also added another log message in '__init__.py' after line 164 as you suggested - shows data.update is putting the target temp in the message before its sent.

Here's the log for the last two runs - one for each thermostat. I've staggered the runs so one thermostat runs on the 1/2 hour and the other runs on the quarter hour just to be sure its not some weird race condition from running them at the same time.

2023-02-03 09:30:00.283 WARNING (MainThread) [HVAC] HA HVAC 24A Set Temp Data - Before Setting Temp
Date / Time              2023/02/03 09:30:00
Thermostat Temp          70.0
ESP Temp                 71.42
Target Temp              70.0
Temp Adjustment           1
New Thermostat Temp      68
2023-02-03 09:30:00.300 DEBUG (MainThread) [somecomfort] AndyLog: set_setpoint_cool: lower: 60.0.  upper: 99.0.  temp: 68.0.
2023-02-03 09:30:00.301 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: Before data.update: data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': None, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7061292}.
2023-02-03 09:30:00.301 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: After data.update: data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 68.0, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7061292}.
2023-02-03 09:30:00.552 ERROR (MainThread) [somecomfort] Failed to de-JSON /portal/Device/SubmitControlScreenChanges <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:aa24809b-1965-4d4a-9d01-5216ca8ee935', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:15', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 14:30:00 GMT', 'Content-Length': '3448', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0745525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 14:27:42 GMT;path=/;secure;httponly')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 101, in _resp_json
    return await resp.json()
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 52, in json
    return await super().json(*args, loads=loads, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges')
2023-02-03 09:30:00.558 ERROR (MainThread) [homeassistant.components.automation.new_automation] HVAC 24A Set Temp: Choose at step 1: choice 1: Error executing script. Unexpected error for call_service at pos 2: '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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/device.py", line 150, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 178, in _set_thermostat_settings
    if result.get("success") != 1:
AttributeError: 'NoneType' object has no attribute 'get'
2023-02-03 09:30:00.567 ERROR (MainThread) [homeassistant.components.automation.new_automation] HVAC 24A Set Temp: 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 896, in _async_choose_step
    await self._async_run_script(script)
  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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/device.py", line 150, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 178, in _set_thermostat_settings
    if result.get("success") != 1:
AttributeError: 'NoneType' object has no attribute 'get'
2023-02-03 09:30:00.578 ERROR (MainThread) [homeassistant.components.automation.new_automation] While executing automation automation.new_automation
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 546, 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 896, in _async_choose_step
    await self._async_run_script(script)
  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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/device.py", line 150, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 178, in _set_thermostat_settings
    if result.get("success") != 1:
AttributeError: 'NoneType' object has no attribute 'get'
2023-02-03 09:45:00.495 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp Data - Before Setting Temp
Date / Time              2023/02/03 09:45:00
Thermostat Temp          72.0
ESP Temp                 73.22
Target Temp              72.0
Temp Adjustment           1
New Thermostat Temp      70
2023-02-03 09:45:00.512 DEBUG (MainThread) [somecomfort] AndyLog: set_setpoint_cool: lower: 60.0.  upper: 99.0.  temp: 70.0.
2023-02-03 09:45:00.512 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: Before data.update: data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': None, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7039159}.
2023-02-03 09:45:00.512 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: After data.update: data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 70.0, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7039159}.
2023-02-03 09:45:00.776 ERROR (MainThread) [somecomfort] Failed to de-JSON /portal/Device/SubmitControlScreenChanges <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:da60c9f1-171e-46dd-9af0-fa45b7f4c86b', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:15', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 14:45:00 GMT', 'Content-Length': '3448', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0245525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 14:42:42 GMT;path=/;secure;httponly')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 101, in _resp_json
    return await resp.json()
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 52, in json
    return await super().json(*args, loads=loads, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges')
2023-02-03 09:45:00.780 ERROR (MainThread) [homeassistant.components.automation.hvac_set_24b_temp_new] HVAC 24B Set Temp: Choose at step 1: choice 1: Error executing script. Unexpected error for call_service at pos 2: '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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/device.py", line 150, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 178, in _set_thermostat_settings
    if result.get("success") != 1:
AttributeError: 'NoneType' object has no attribute 'get'
2023-02-03 09:45:00.784 ERROR (MainThread) [homeassistant.components.automation.hvac_set_24b_temp_new] HVAC 24B Set Temp: 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 896, in _async_choose_step
    await self._async_run_script(script)
  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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/device.py", line 150, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 178, in _set_thermostat_settings
    if result.get("success") != 1:
AttributeError: 'NoneType' object has no attribute 'get'
2023-02-03 09:45:00.791 ERROR (MainThread) [homeassistant.components.automation.hvac_set_24b_temp_new] While executing automation automation.hvac_set_24b_temp_new
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 546, 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 896, in _async_choose_step
    await self._async_run_script(script)
  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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/device.py", line 150, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/AIOSomecomfort/__init__.py", line 178, in _set_thermostat_settings
    if result.get("success") != 1:
AttributeError: 'NoneType' object has no attribute 'get'
mkmer commented 1 year ago

It doesn't like something about that control message - One thing I noticed is the web site only sends int() values for temperature settings. It appears to be working (for me) with 70.0 rather than 70, but who knows what they are doing. Moving to 0.0.6 should remove the uncaught error - still will log something

Try adding a couple of log messages around the post that dumps the headers and data for the response and sent messages - maybe we can figure out something there. Maybe the session keys are expired or missing.

ShortPutt commented 1 year ago

Updated to 2023.2.1. First run failed. Here's the log

raise SomeComfortError("API returned %s, %s" % resp.status, req) should be raise SomeComfortError("API returned %s, %s" %(resp.status, req)) I'll fix it and run again

Also removed trailing comma from

   async def _set_thermostat_settings(self, thermostat_id, settings):                
        data = {                                                                      
            "SystemSwitch": None,                                                     
            "HeatSetpoint": None,                                                     
            "CoolSetpoint": None,                                                     
            "HeatNextPeriod": None,                                                
            "CoolNextPeriod": None,                                            
            "StatusHeat": None,                                                
            "DeviceID": thermostat_id,                                         
        }     
2023-02-03 10:30:00.294 WARNING (MainThread) [HVAC] HA HVAC 24A Set Temp Data - Before Setting Temp
Date / Time              2023/02/03 10:30:00
Thermostat Temp          70.0
ESP Temp                 71.6
Target Temp              70.0
Temp Adjustment           2
New Thermostat Temp      68
2023-02-03 10:30:00.875 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-03 10:30:00.883 ERROR (MainThread) [homeassistant.components.automation.new_automation] HVAC 24A Set Temp: Choose at step 1: choice 1: Error executing script. Unexpected error for call_service at pos 2: not enough arguments for format string
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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/device.py", line 147, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/__init__.py", line 166, in _set_thermostat_settings
    result = await self._post_json(url, data=data)
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/__init__.py", line 134, in _post_json
    return await self._request_json("post", *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/__init__.py", line 128, in _request_json
    raise SomeComfortError("API returned %s, %s" % resp.status, req)
TypeError: not enough arguments for format string
2023-02-03 10:30:00.893 ERROR (MainThread) [homeassistant.components.automation.new_automation] HVAC 24A Set Temp: Error executing script. Unexpected error for choose at pos 1: not enough arguments for format string
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 896, in _async_choose_step
    await self._async_run_script(script)
  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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/device.py", line 147, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/__init__.py", line 166, in _set_thermostat_settings
    result = await self._post_json(url, data=data)
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/__init__.py", line 134, in _post_json
    return await self._request_json("post", *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/__init__.py", line 128, in _request_json
    raise SomeComfortError("API returned %s, %s" % resp.status, req)
TypeError: not enough arguments for format string
2023-02-03 10:30:00.904 ERROR (MainThread) [homeassistant.components.automation.new_automation] While executing automation automation.new_automation
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 546, 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 896, in _async_choose_step
    await self._async_run_script(script)
  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 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 681, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 721, 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/honeywell/climate.py", line 304, in async_set_temperature
    await self._set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/honeywell/climate.py", line 294, in _set_temperature
    await self._device.set_setpoint_cool(temperature)
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/device.py", line 147, in set_setpoint_cool
    await self._client._set_thermostat_settings(
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/__init__.py", line 166, in _set_thermostat_settings
    result = await self._post_json(url, data=data)
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/__init__.py", line 134, in _post_json
    return await self._request_json("post", *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiosomecomfort/__init__.py", line 128, in _request_json
    raise SomeComfortError("API returned %s, %s" % resp.status, req)
TypeError: not enough arguments for format string
ShortPutt commented 1 year ago

The automation ran and I also ran service call - here's the log. The automation ran at 10:45, the service call ran at 10:46. At least we're failing gracefully....

2023-02-03 10:45:00.404 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp Data - Before Setting Temp
Date / Time              2023/02/03 10:45:00
Thermostat Temp          72.0
ESP Temp                 73.4
Target Temp              72.0
Temp Adjustment           1
New Thermostat Temp      70
2023-02-03 10:45:00.783 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-03 10:45:00.786 ERROR (MainThread) [homeassistant.components.honeywell.const] Invalid temperature 70.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-03 10:45:02.004 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp FAILED
Date / Time              2023/02/03 10:45:00
Thermostat Temp          72.0
ESP Temp                 73.4
Target Temp              72.0
Temp Adjustment           1
New Thermostat Temp      70
Thermostat set to        72
2023-02-03 10:46:08.972 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-03 10:46:08.975 ERROR (MainThread) [homeassistant.components.honeywell.const] Invalid temperature 69.0: API returned 200, /portal/Device/SubmitControlScreenChanges
mkmer commented 1 year ago

OK - Thanks for finding my amateur error :( Maybe try somthing like this in the log :
_LOG.error( "API returned %s from %s request %s : %s", resp.status, req, resp.headers, await resp.text(), ) May not hurt to spit out the message we are sending too. Looks like that's in the kwargs. Maybe the headers or wonky. This must be related to multiple stats, I can't get mine to fail but only have one stat.

mkmer commented 1 year ago

What mode are you in? Hold, temporary hold, away... If it's temporary hold, maybe it's related to sending the hold time then temp quickly....

ShortPutt commented 1 year ago

The thermostat has a schedule but when its set w/ the automation it puts it in temporary hold. So sometimes it will be running according to the schedule and sometimes temporary hold.

Where's the best place to put the _Log line? I put it in _request_json after req=args[0]..., but got output even when automation was not running.

Here's the _Log line I put in _LOG.error ("AndyLog: _request_json: API returned %s from %s request %s : %s" % (resp.status, req, resp.headers, resp.text))

I ran a service call to set the temp to 70 - its the last few rows in the log

2023-02-03 11:49:27.693 DEBUG (MainThread) [somecomfort] AndyLog: _request_json: API returned 200 from /portal/Device/CheckDataSession/5300019 request <CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:bb43ca2e-bf2f-4513-91cb-e718766a3207', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:112', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 16:49:27 GMT', 'Content-Length': '1696', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1a45525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 16:47:09 GMT;path=/;secure;httponly')> : <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/CheckDataSession/5300019) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:bb43ca2e-bf2f-4513-91cb-e718766a3207', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:112', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 16:49:27 GMT', 'Content-Length': '1696', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1a45525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 16:47:09 GMT;path=/;secure;httponly')>
>
2023-02-03 11:49:36.317 DEBUG (MainThread) [somecomfort] AndyLog: _request_json: API returned 200 from /portal/Device/SubmitControlScreenChanges request <CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:14feadcb-a323-421a-94f9-455240a32a09', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:136', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 16:49:36 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0745525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 16:47:18 GMT;path=/;secure;httponly')> : <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:14feadcb-a323-421a-94f9-455240a32a09', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:136', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 16:49:36 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0745525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 16:47:18 GMT;path=/;secure;httponly')>
>
2023-02-03 11:49:36.591 DEBUG (MainThread) [somecomfort] AndyLog: _request_json: API returned 200 from /portal/Device/SubmitControlScreenChanges request <CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:71d22422-ff67-4068-8194-987f0c27c2ba', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:31', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 16:49:35 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0045525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 16:47:18 GMT;path=/;secure;httponly')> : <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:71d22422-ff67-4068-8194-987f0c27c2ba', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:31', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 16:49:35 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0045525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 16:47:18 GMT;path=/;secure;httponly')>
>
2023-02-03 11:49:36.591 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-03 11:49:36.598 ERROR (MainThread) [homeassistant.components.honeywell.const] Invalid temperature 70.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-03 11:49:36.760 DEBUG (MainThread) [somecomfort] AndyLog: _request_json: API returned 200 from /portal/Device/CheckDataSession/7061292 request <CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:0f0e8058-3eb1-49d4-934b-a7e6010652e4', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:117', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 16:49:36 GMT', 'Content-Length': '1695', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0345525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 16:47:18 GMT;path=/;secure;httponly')> : <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/CheckDataSession/7061292) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:0f0e8058-3eb1-49d4-934b-a7e6010652e4', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:117', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 16:49:36 GMT', 'Content-Length': '1695', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0345525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 16:47:18 GMT;path=/;secure;httponly')>
>
ShortPutt commented 1 year ago

Here's a log from the last automation run.

2023-02-03 12:15:00.282 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp Data - Before Setting Temp
Date / Time              2023/02/03 12:15:00
Thermostat Temp          71.0
ESP Temp                 73.22
Target Temp              71.0
Temp Adjustment           2
New Thermostat Temp      68
2023-02-03 12:15:00.539 DEBUG (MainThread) [somecomfort] AndyLog: _request_json: API returned 200 from /portal/Device/SubmitControlScreenChanges request <CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:77c187c2-6ba4-4d0b-9b14-1664ff34b8e9', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:129', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 17:14:59 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0745525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 17:12:42 GMT;path=/;secure;httponly')> : <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:77c187c2-6ba4-4d0b-9b14-1664ff34b8e9', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:129', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 17:14:59 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0745525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 17:12:42 GMT;path=/;secure;httponly')>
>
2023-02-03 12:15:00.817 DEBUG (MainThread) [somecomfort] AndyLog: _request_json: API returned 200 from /portal/Device/SubmitControlScreenChanges request <CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:42be7458-b9cf-407f-b4fe-dc9f4dff991d', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:15', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 17:14:59 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1f45525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 17:12:42 GMT;path=/;secure;httponly')> : <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:42be7458-b9cf-407f-b4fe-dc9f4dff991d', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:15', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 17:14:59 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1f45525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 17:12:42 GMT;path=/;secure;httponly')>
>
2023-02-03 12:15:00.818 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-03 12:15:00.821 ERROR (MainThread) [homeassistant.components.honeywell.const] Invalid temperature 68.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-03 12:15:01.016 DEBUG (MainThread) [somecomfort] AndyLog: _request_json: API returned 200 from /portal/Device/CheckDataSession/7039159 request <CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:2bf6e16a-b5d1-4c5f-b744-3bb37a051061', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:125', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 17:15:00 GMT', 'Content-Length': '1695', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0445525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 17:12:42 GMT;path=/;secure;httponly')> : <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/CheckDataSession/7039159) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:2bf6e16a-b5d1-4c5f-b744-3bb37a051061', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:125', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Fri, 03 Feb 2023 17:15:00 GMT', 'Content-Length': '1695', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0445525d5f4f58455e445a4a42378b;expires=Fri, 03-Feb-2023 17:12:42 GMT;path=/;secure;httponly')>
>
2023-02-03 12:15:02.597 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp FAILED
Date / Time              2023/02/03 12:15:00
Thermostat Temp          71.0
ESP Temp                 73.22
Target Temp              71.0
Temp Adjustment           2
New Thermostat Temp      68
Thermostat set to        71
ShortPutt commented 1 year ago

I removed the _LOG from _request_json and added _LOGs in _set_thermostat_settings. I put the thermostat in following schedule mode and ran service to set temp to 70. It failed, but it put the thermostat in temp hold at the schedule temp. Here's the log

2023-02-03 12:30:38.562 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': None, 'HeatNextPeriod': None, 'CoolNextPeriod': 72, 'StatusHeat': None, 'DeviceID': 7061292, 'StatusCool': 1}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-03 12:30:38.928 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: after _post_json: result: {'success': 1}
2023-02-03 12:30:38.929 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 70.0, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7061292}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-03 12:30:39.185 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-03 12:30:39.189 ERROR (MainThread) [homeassistant.components.honeywell.const] Invalid temperature 70.0: API returned 200, /portal/Device/SubmitControlScreenChanges
mkmer commented 1 year ago

That may be it - the first message sets CoolNextPeriod, then setting CoolSetpoint fails. You must not be in hold mode, so it's setting a temporary hold?!? I'll tinker with that and see if I can get mine to fail. I feel like it should consolidate the message into a single temporary hold and temperature message (aka CoolNextPeriod AND CoolSetpoint should be one message).

Try putting your Tstat in hold mode, then let the automation run - that will only send one message to "prove" it out

ShortPutt commented 1 year ago

I put both thermostats in temp hold at 71 and ran service to change each to 70. Both calls failed. Thermostats remained in temp hold at 71.

Then put them both following schedule (71) and ran service to change each to 70. Both calls failed. Thermostats were changed to temp hold at 71.

Then the automation ran and tried to change 24B to 71. It also failed. Thermostat remained in temp hold @ 71.

2023-02-03 13:11:14.822 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 70.0, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7061292}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-03 13:11:15.244 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-03 13:11:15.246 ERROR (MainThread) [homeassistant.components.honeywell.const] Invalid temperature 70.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-03 13:11:23.313 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 70.0, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7039159}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-03 13:11:23.560 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-03 13:11:23.563 ERROR (MainThread) [homeassistant.components.honeywell.const] Invalid temperature 70.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-03 13:13:56.913 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': None, 'HeatNextPeriod': None, 'CoolNextPeriod': 72, 'StatusHeat': None, 'DeviceID': 7061292, 'StatusCool': 1}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-03 13:13:57.154 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: after _post_json: result: {'success': 1}
2023-02-03 13:13:57.154 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 70.0, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7061292}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-03 13:13:57.396 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-03 13:13:57.399 ERROR (MainThread) [homeassistant.components.honeywell.const] Invalid temperature 70.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-03 13:14:02.421 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': None, 'HeatNextPeriod': None, 'CoolNextPeriod': 72, 'StatusHeat': None, 'DeviceID': 7039159, 'StatusCool': 1}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-03 13:14:02.654 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: after _post_json: result: {'success': 1}
2023-02-03 13:14:02.655 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 70.0, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7039159}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-03 13:14:02.939 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-03 13:14:02.942 ERROR (MainThread) [homeassistant.components.honeywell.const] Invalid temperature 70.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-03 13:15:00.260 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp Data - Before Setting Temp
Date / Time              2023/02/03 01:15:00
Thermostat Temp          71.0
ESP Temp                 73.04
Target Temp              71.0
Temp Adjustment           2
New Thermostat Temp      68
2023-02-03 13:15:00.285 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 68.0, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7039159}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-03 13:15:00.531 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-03 13:15:00.532 ERROR (MainThread) [homeassistant.components.honeywell.const] Invalid temperature 68.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-03 13:15:02.282 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp FAILED
Date / Time              2023/02/03 01:15:00
Thermostat Temp          71.0
ESP Temp                 73.04
Target Temp              71.0
Temp Adjustment           2
New Thermostat Temp      68
Thermostat set to        71
mkmer commented 1 year ago

Darn - looks like it sent only one message in temp hold too. Could you try adding int() around the temp setpoints where they are added to the data - so they only go with 71 or 72 not 71.0/72.0? I don't think that's it, but nothing obvious is jumping out here.

If not that, I think we need to dump the headers out for the messages so we can see if anything is wonky there.

ShortPutt commented 1 year ago

The target temps are already ints - its set in the automation

service: climate.set_temperature
data:
  temperature: |
    {{ newThermostatTemp | int }}
target:
  entity_id: climate.24a

Where is the best place to dump the headers?

ShortPutt commented 1 year ago

Just got a successful run. Moved thermostat from temp hold @71 to temp hold @ 72

2023-02-03 13:30:00.214 WARNING (MainThread) [HVAC] HA HVAC 24A Set Temp Data - Before Setting Temp
Date / Time              2023/02/03 01:30:00
Thermostat Temp          71.0
ESP Temp                 69.98
Target Temp              71.0
Temp Adjustment           -1
New Thermostat Temp      72
2023-02-03 13:30:00.228 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 72.0, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'DeviceID': 7061292}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-03 13:30:00.442 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: after _post_json: result: {'success': 1}
2023-02-03 13:30:02.224 WARNING (MainThread) [HVAC] HA HVAC 24A Set Temp Successful
2023/02/03 01:30:00
Thermostat Temp          71.0
ESP Temp                 69.98
Target Temp              71.0
Temp Adjustment           -1
New Thermostat Temp      72
Thermostat set to        72
mkmer commented 1 year ago

The values may be int, but the value being sent is a float 72.0 - change temp to int(temp) - could do it in heat too, but your just working in cool mode. https://github.com/mkmer/AIOSomecomfort/blob/07e84d5c5e4e10ae67c1051927670ff1de78c9a8/aiosomecomfort/device.py#L148

The headers are in the kwargs where you added the above debug - just _LOG with %s kwargs - that should give us everything.

One more thought - if it is related to 2 thermostats maybe trying just adjustments to 1 of them only. Maybe it want's only to control the last thermostat we last read data from - could explain why it's hit & miss.... we could try adding a await self.refresh() to the set_setpoint_cool/heat right before setting the value: https://github.com/mkmer/AIOSomecomfort/blob/07e84d5c5e4e10ae67c1051927670ff1de78c9a8/aiosomecomfort/device.py#L147

After 3 est today, I'll be out of pocket for a week - feel free to keep poking around, I'll catch up with your findings when I return.

ShortPutt commented 1 year ago

Sounds good. I'm out for the rest of the day, so I'll work on it and we can touch base when u get back.

mkmer commented 1 year ago

I did find a default missing value - StatusCool : None is not in there. I added it to the default and release 0.0.7 - you can modify your manifest.json in your local install to 0.0.7 and restart to give it a try. One would think something like this would fail every time, so I'm not convinced this is the problem.

ShortPutt commented 1 year ago

I think I found something. _request_json has the following check

if resp.status == 200 and resp.content_type == "application/json":
   return await resp.json() 

The successful calls return a response with 'Content-Type': 'application/json; charset=utf-8'

The unsuccessful calls return a response with 'Content-Type': 'text/html; charset=utf-8'

so _request_json logs 2023-02-07 13:15:00.879 ERROR (MainThread) [somecomfort] API returned 200 from /portal/Device/SubmitControlScreenChanges request

and then _set_temperature in climate.py logs 2023-02-07 13:15:00.885 ERROR (MainThread) [homeassistant.components.honeywell.const] Invalid temperature 69.0: API returned 200, /portal/Device/SubmitControlScreenChanges

So, its not really an invalid temperature, its a response in an unexpected Content-type

Here's the log code I put in _request_json

if req == "/portal/Device/SubmitControlScreenChanges":                                                                                                                                              
   _LOG.debug ("AndyLog: _request_json: API returned %s from %s request %s : %s | resp: %s | args: %s | kwargs: %s" % (resp.status, req, resp.headers, resp.text, resp, args, kwargs))

Here's the full logs from a failed run and a successful run

2023-02-07 12:45:00.193 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp Data - Before Setting Temp
Date / Time              2023/02/07 12:45:00
Thermostat Temp          71.0
ESP Temp                 72.14
Target Temp              71.0
Temp Adjustment           1
New Thermostat Temp      69

Thermostat Attributes
current_temperature        71
temperature                71
target_temp_high           None
target_temp_low            None
current_humidity           38.0
fan_mode                   auto
hvac_action                idle
preset_mode                None
fan_action                 idle
permanent_hold             False
dr_phase                   -1
friendly_name              24B
supported_features         ClimateEntityFeature.PRESET_MODE|FAN_MODE|TARGET_TEMPERATURE_RANGE|TARGET_TEMPERATURE
min_temp                   60
max_temp                   99
2023-02-07 12:45:00.220 DEBUG (MainThread) [somecomfort] AndyLog: device.py.set_etpoint_cool: lower: 60.0.  upper: 99.0.  temp: 69.0
2023-02-07 12:45:00.393 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 69, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7039159}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-07 12:45:00.672 DEBUG (MainThread) [somecomfort] AndyLog: _request_json: API returned 200 from /portal/Device/SubmitControlScreenChanges request <CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:451d9da0-8e3b-4459-a90d-89f95ab563ff', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:31', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Tue, 07 Feb 2023 17:44:59 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0345525d5f4f58455e445a4a42378b;expires=Tue, 07-Feb-2023 17:42:41 GMT;path=/;secure;httponly')> : <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8' 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:451d9da0-8e3b-4459-a90d-89f95ab563ff', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:31', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Tue, 07 Feb 2023 17:44:59 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0345525d5f4f58455e445a4a42378b;expires=Tue, 07-Feb-2023 17:42:41 GMT;path=/;secure;httponly')>
> | resp: <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:451d9da0-8e3b-4459-a90d-89f95ab563ff', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:31', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Tue, 07 Feb 2023 17:44:59 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0345525d5f4f58455e445a4a42378b;expires=Tue, 07-Feb-2023 17:42:41 GMT;path=/;secure;httponly')>
 | args: ('https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges',) | kwargs: {'data': {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 69, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7039159}, 'timeout': 30, 'headers': {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}}
2023-02-07 12:45:00.672 ERROR (MainThread) [somecomfort] AndyLog: init._request_json: API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-07 12:45:00.676 ERROR (MainThread) [homeassistant.components.honeywell.const] AndyLog: climate._set_temperature: Invalid temperature 69.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-07 12:45:02.337 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp FAILED
Date / Time              2023/02/07 12:45:00
Thermostat Temp          71.0
ESP Temp                 72.14
Target Temp              71.0
Temp Adjustment           1
New Thermostat Temp      69
Thermostat set to        71

2023-02-07 13:15:00.406 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp Data - Before Setting Temp
Date / Time              2023/02/07 01:15:00
Thermostat Temp          71.0
ESP Temp                 72.14
Target Temp              71.0
Temp Adjustment           1
New Thermostat Temp      69

Thermostat Attributes
current_temperature        71
temperature                71
target_temp_high           None
target_temp_low            None
current_humidity           40.0
fan_mode                   auto
hvac_action                idle
preset_mode                None
fan_action                 idle
permanent_hold             False
dr_phase                   -1
friendly_name              24B
supported_features         ClimateEntityFeature.PRESET_MODE|FAN_MODE|TARGET_TEMPERATURE_RANGE|TARGET_TEMPERATURE
min_temp                   60
max_temp                   99
2023-02-07 13:15:00.425 DEBUG (MainThread) [somecomfort] AndyLog: device.py.set_etpoint_cool: lower: 60.0.  upper: 99.0.  temp: 69.0
2023-02-07 13:15:00.646 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 69, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7039159}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-07 13:15:00.878 DEBUG (MainThread) [somecomfort] AndyLog: _request_json: API returned 200 from /portal/Device/SubmitControlScreenChanges request <CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:20ad894f-51b9-48d5-a8e3-ad4d25fa707e', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:18', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Tue, 07 Feb 2023 18:15:00 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1c45525d5f4f58455e445a4a42378b;expires=Tue, 07-Feb-2023 18:12:42 GMT;path=/;secure;httponly')> : <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:20ad894f-51b9-48d5-a8e3-ad4d25fa707e', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:18', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Tue, 07 Feb 2023 18:15:00 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1c45525d5f4f58455e445a4a42378b;expires=Tue, 07-Feb-2023 18:12:42 GMT;path=/;secure;httponly')>
> | resp: <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:20ad894f-51b9-48d5-a8e3-ad4d25fa707e', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:18', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Tue, 07 Feb 2023 18:15:00 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1c45525d5f4f58455e445a4a42378b;expires=Tue, 07-Feb-2023 18:12:42 GMT;path=/;secure;httponly')>
 | args: ('https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges',) | kwargs: {'data': {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 69, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7039159}, 'timeout': 30, 'headers': {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}}
2023-02-07 13:15:00.879 ERROR (MainThread) [somecomfort] AndyLog: init._request_json: API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-07 13:15:00.885 ERROR (MainThread) [homeassistant.components.honeywell.const] AndyLog: climate._set_temperature: Invalid temperature 69.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-07 13:15:04.253 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp FAILED
Date / Time              2023/02/07 01:15:00
Thermostat Temp          71.0
ESP Temp                 72.14
Target Temp              71.0
Temp Adjustment           1
New Thermostat Temp      69
Thermostat set to        71
2023-02-07 13:22:35.839 WARNING (MainThread) [homeassistant.helpers.entity] Updating state for sensor.time (<class 'homeassistant.components.time_date.sensor.TimeDateSensor'>) took 0.571 seconds. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+time_date%22
2023-02-07 13:30:00.312 WARNING (MainThread) [HVAC] HA HVAC 24A Set Temp Data - Before Setting Temp
Date / Time              2023/02/07 01:30:00
Thermostat Temp          73.0
ESP Temp                 72.14
Target Temp              71.0
Temp Adjustment           1
New Thermostat Temp      71

Thermostat Attributes
current_temperature        73
temperature                73
target_temp_high           None
target_temp_low            None
current_humidity           41.0
fan_mode                   auto
hvac_action                idle
preset_mode                None
fan_action                 idle
permanent_hold             False
dr_phase                   -1
friendly_name              24A
supported_features         ClimateEntityFeature.PRESET_MODE|FAN_MODE|TARGET_TEMPERATURE_RANGE|TARGET_TEMPERATURE
min_temp                   60
max_temp                   99
2023-02-07 13:30:00.325 DEBUG (MainThread) [somecomfort] AndyLog: device.py.set_etpoint_cool: lower: 60.0.  upper: 99.0.  temp: 71.0
2023-02-07 13:30:00.504 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 71, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7061292}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}

2023-02-07 13:30:00.714 DEBUG (MainThread) [somecomfort] AndyLog: _request_json: API returned 200 from /portal/Device/SubmitControlScreenChanges request <CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:81dffc85-4320-4093-a24c-96cffcb55ed2', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:108', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Tue, 07 Feb 2023 18:30:00 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1a45525d5f4f58455e445a4a42378b;expires=Tue, 07-Feb-2023 18:27:41 GMT;path=/;secure;httponly')> : <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:81dffc85-4320-4093-a24c-96cffcb55ed2', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:108', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Tue, 07 Feb 2023 18:30:00 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1a45525d5f4f58455e445a4a42378b;expires=Tue, 07-Feb-2023 18:27:41 GMT;path=/;secure;httponly')>
> | resp: <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:81dffc85-4320-4093-a24c-96cffcb55ed2', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:108', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Tue, 07 Feb 2023 18:30:00 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1a45525d5f4f58455e445a4a42378b;expires=Tue, 07-Feb-2023 18:27:41 GMT;path=/;secure;httponly')>
 | args: ('https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges',) | kwargs: {'data': {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 71, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7061292}, 'timeout': 30, 'headers': {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}}
2023-02-07 13:30:00.715 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: after _post_json: result: {'success': 1}
2023-02-07 13:30:02.280 WARNING (MainThread) [HVAC] HA HVAC 24A Set Temp Successful
mkmer commented 1 year ago

The text return is a redirect to the error page, that's why we needed to check for Json before decoding. We really need to see what the text payload is to see if it gives us a clue. In your added debug, I believe you need await resp.text() for the text to show in the log (unless I missed the text... I'm looking at it from my phone).

If you have some time, you can connect to tcc with web browser, turn on dev mode, and set a temperature. In the dev section you can see the sent and received messages and headers, etc... Compare to what we are sending. Maybe your stat has additional payload data or header data

When I ported the code, I only saw redirect errors when the session key was expired, I don't understand how they would be renewed in this situation for it to work some times...

ShortPutt commented 1 year ago

I added the await and updated the log so its clearer

        await resp.text()                                              
        if req == "/portal/Device/SubmitControlScreenChanges":                 
           _LOG.debug ("AndyLog: _request_json reqs:         %s" % req)         
           _LOG.debug ("AndyLog: _request_json resp.status:  %s" % resp.status) 
           _LOG.debug ("AndyLog: _request_json resp.headers: $s" % resp.headers)
           _LOG.debug ("AndyLog: _request_json resp.text:    %s" % resp.text)
           _LOG.debug ("AndyLog: _request_json resp:         %s" % resp)  
           _LOG.debug ("AndyLog: _request_json args:         %s" % args)  
           _LOG.debug ("AndyLog: _request_json resp kwargs:  %s" % kwargs) 

Same issue. Content-type on a successful run is 'application/json; charset=utf-8' and in a failed run its 'Content-Type': 'text/html; charset=utf-8'. So in a failed run the if resp.status == 200 and resp.content_type == "application/json": branch is skipped and it drops down to the else branch.

Here's the log of a successful run

2023-02-08 09:30:00.265 WARNING (MainThread) [HVAC] HA HVAC 24A Set Temp Data - Before Setting Temp
Date / Time              2023/02/08 09:30:00
Thermostat Temp          70.0
ESP Temp                 68.36
Target Temp              70.0
Temp Adjustment           -2
New Thermostat Temp      71

Thermostat Attributes
current_temperature        70
temperature                70
target_temp_high           None
target_temp_low            None
current_humidity           42.0
fan_mode                   auto
hvac_action                cooling
preset_mode                None
fan_action                 running
permanent_hold             False
dr_phase                   -1
friendly_name              24A
supported_features         ClimateEntityFeature.PRESET_MODE|FAN_MODE|TARGET_TEMPERATURE_RANGE|TARGET_TEMPERATURE
min_temp                   60
max_temp                   99
2023-02-08 09:30:00.309 DEBUG (MainThread) [somecomfort] AndyLog: device.py.set_etpoint_cool: lower: 60.0.  upper: 99.0.  temp: 71.0
2023-02-08 09:30:02.944 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 71, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7061292}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-08 09:30:03.504 DEBUG (MainThread) [somecomfort] AndyLog: _request_json reqs:         /portal/Device/SubmitControlScreenChanges
2023-02-08 09:30:03.504 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.status:  200
2023-02-08 09:30:03.505 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.headers: $s
2023-02-08 09:30:03.505 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.text:    <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges) [200 OK]> <CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:5b50d724-c344-4c87-b930-200731b067b0', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:119', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Wed, 08 Feb 2023 14:30:03 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0245525d5f4f58455e445a4a42378b;expires=Wed, 08-Feb-2023 14:27:44 GMT;path=/;secure;httponly')>>
2023-02-08 09:30:03.505 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp:         <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges) [200 OK]><CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:5b50d724-c344-4c87-b930-200731b067b0', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:119', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Wed, 08 Feb 2023 14:30:03 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0245525d5f4f58455e445a4a42378b;expires=Wed, 08-Feb-2023 14:27:44 GMT;path=/;secure;httponly')>
2023-02-08 09:30:03.505 DEBUG (MainThread) [somecomfort] AndyLog: _request_json args:         https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges
2023-02-08 09:30:03.505 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp kwargs:  {'data': {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 71, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7061292}, 'timeout': 30, 'headers': {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}}
2023-02-08 09:30:03.505 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: after _post_json: result: {'success': 1}
2023-02-08 09:30:04.303 WARNING (MainThread) [HVAC] HA HVAC 24A Set Temp Successful
2023/02/08 09:30:00
Thermostat Temp          70.0
ESP Temp                 68.36
Target Temp              70.0
Temp Adjustment           -2
New Thermostat Temp      71
Thermostat set to        71

Here's the log of a failed run

2023-02-08 10:45:00.359 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp Data - Before Setting Temp
Date / Time              2023/02/08 10:45:00
Thermostat Temp          72.0
ESP Temp                 72.5
Target Temp              71.0
Temp Adjustment           2
New Thermostat Temp      70

Thermostat Attributes
current_temperature        72
temperature                72
target_temp_high           None
target_temp_low            None
current_humidity           41.0
fan_mode                   auto
hvac_action                idle
preset_mode                None
fan_action                 idle
permanent_hold             False
dr_phase                   -1
friendly_name              24B
supported_features         ClimateEntityFeature.PRESET_MODE|FAN_MODE|TARGET_TEMPERATURE_RANGE|TARGET_TEMPERATURE
min_temp                   60
max_temp                   99
2023-02-08 10:45:00.373 DEBUG (MainThread) [somecomfort] AndyLog: device.py.set_etpoint_cool: lower: 60.0.  upper: 99.0.  temp: 70.0
2023-02-08 10:45:00.765 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 70, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7039159}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-08 10:45:01.161 DEBUG (MainThread) [somecomfort] AndyLog: _request_json reqs:         /portal/Device/SubmitControlScreenChanges
2023-02-08 10:45:01.163 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.status:  200
2023-02-08 10:45:01.163 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.headers: $s
2023-02-08 10:45:01.164 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.text:    <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]><CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:1e3fe8c9-a909-4405-b4b6-455743558251', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:15', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Wed, 08 Feb 2023 15:45:00 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1a45525d5f4f58455e445a4a42378b;expires=Wed, 08-Feb-2023 15:42:42 GMT;path=/;secure;httponly')>>
2023-02-08 10:45:01.164 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp:         <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]><CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:1e3fe8c9-a909-4405-b4b6-455743558251', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:15', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Wed, 08 Feb 2023 15:45:00 GMT', 'Content-Length': '3449', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1a45525d5f4f58455e445a4a42378b;expires=Wed, 08-Feb-2023 15:42:42 GMT;path=/;secure;httponly')>
2023-02-08 10:45:01.164 DEBUG (MainThread) [somecomfort] AndyLog: _request_json args:         https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges
2023-02-08 10:45:01.164 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp kwargs:  {'data': {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 70, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7039159}, 'timeout': 30, 'headers': {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}}
2023-02-08 10:45:01.165 ERROR (MainThread) [somecomfort] AndyLog: init._request_json: API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-08 10:45:01.169 ERROR (MainThread) [homeassistant.components.honeywell.const] AndyLog: climate._set_temperature: Invalid temperature 70.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-08 10:45:01.411 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp FAILED
Date / Time              2023/02/08 10:45:00
Thermostat Temp          72.0
ESP Temp                 72.5
Target Temp              71.0
Temp Adjustment           2
New Thermostat Temp      70
Thermostat set to        72
mkmer commented 1 year ago

The text return is a redirect to the error page, that's why we needed to check for Json before decoding. We really need to see what the text payload is to see if it gives us a clue. In your added debug, I believe you need await resp.text() for the text to show in the log (unless I missed the text... I'm looking at it from my phone).

If you have some time, you can connect to tcc with web browser, turn on dev mode, and set a temperature. In the dev section you can see the sent and received messages and headers, etc... Compare to what we are sending. Maybe your stat has additional payload data or header data

When I ported the code, I only saw redirect errors when the session key was expired, I don't understand how they would be renewed in this situation for it to work some times...

mkmer commented 1 year ago

resp.text: <bound method ClientResponse.text of

This call needs an await to show the actual text

ShortPutt commented 1 year ago

Sorry, but I'm going to need a little more direction.

I added await resp.text() before the _LOG commands, but I guess that's not the right place. And I'm not sure how to use a browser to connect to tcc.

So if you let me know where to put the await statement and give me a little more direction on how to use the browser to test it. I can look into it. I can use Firefox, Chrome or Edge.

mkmer commented 1 year ago

Yah I'm on my phone (vacation) and can't help much more till I get home.

Website: https://mytotalconnectcomfort.com/portal

Just display one of the stats, put Firefox in developer mode (shows stats on bottom of screen). When you interact with the tstat you will see the messages. XHTML carry the payloads.

On the debug, any resp.text or messages coming from aiohttp need await xxx.text(). I'm not sure what message I was looking at in the log, but it was reporting the binding rather than the text we want to see.

ShortPutt commented 1 year ago

I don't want to bother you anymore while you are on vacation. Let's look into it when you are back.

mkmer commented 1 year ago

OK - had a bit of time to look at this again. In the successful run, you had a different T-stat than the failed run. I believe you have had successful on both T-stats? From what I can see in the examples 7061292 works and 7039159 fails.

The "unexpected" text is a redirect https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges - this means the host doesn't like something about what we sent it. The only time I've seen this during my testing was when the session keys were expired.

I still don't see any clues from the site what it doesn't like about the message. I suppose we need to add some more log points to try to figure this out.

I suspect maybe they don't like submitting changes unless you are working on the "same" thermostat - could try refreshing the device just before setting the thermostat by adding: await self.refresh() in device.py, line 147 (Just before the await self._client._set_thermostat_settings( line. You would do this for set_setpoint_heat too, but for this test it looks like your just working with cool.

Maybe need it everywhere just before calling _client._set_thermostat_settings()

ShortPutt commented 1 year ago

I get successful runs on both thermostats, but 7039159 fails much more frequently. The fact that I do get successful runs on both thermostats and I'm able to control both with no problem from the TCC website leads me to believe the problem is not with the thermostat.

I already added await self.refresh() before await self._client._set_thermostat_settings in set_setpoint_cool. It had no effect.

I don't think its the session keys because that would cause both thermostats to fail, right? The requests for both thermostats are in the logs and other than the device_id they look identical to me.

Do you have thoughts on where to add additional logs?

ShortPutt commented 1 year ago

Not sure if this will help, but I used MS Edge in Dev mode and changed each thermostat. Here's the data:

24A

General
Request URL: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges
Request Method: POST
Status Code: 200 OK
Remote Address: 199.62.84.100:443
Referrer Policy: strict-origin-when-cross-origin

Response Headers
ADRUM_0: g:a8f09e02-d54a-4ff4-bd6a-9d1e5b464e66
ADRUM_1: n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7
ADRUM_2: i:197974
ADRUM_3: e:153
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 13
Content-Type: application/json; charset=utf-8
Date: Wed, 15 Feb 2023 12:58:10 GMT
Expires: -1
Pragma: no-cache
Server: Microsoft-IIS/8.5
Set-Cookie: NSC_NZUDD-443-WT=ffffffff090ecc0745525d5f4f58455e445a4a42378b;expires=Wed, 15-Feb-2023 12:55:50 GMT;path=/;secure;httponly
X-Frame-Options: DENY
X-UA-Compatible: IE=edge
X-XSS-Protection: 1; mode=block

Request Headers
Accept: application/json, text/javascript, */*; q=0.01
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Content-Length: 167
Content-Type: application/json; charset=UTF-8
Cookie: _ga=GA1.2.951668251.1676465188; _gid=GA1.2.1944135098.1676465188; __utma=195468848.951668251.1676465188.1676465188.1676465188.1; __utmc=195468848; __utmz=195468848.1676465188.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmb=195468848.2.9.1676465195792; LocalisationCultureCookie=en-US; ASP.NET_SessionId=uwv1mzexrc1r5tkl05vt2eh3; TrueHomeCheckCookie=; checkCookie=checkValue; notice_behavior=implied|us; .ASPXAUTH_TRUEHOME=451C9CAA5FB5353800DC6F404B2A4616F475F648C7D384385135AE5428FF4D8FA2CDD993F7B487E79E5D1A262EE2E9A1BC4A587040DF3431B6770DD5F7643C047CC411074A56BAA48EFF0D97F1B438E34CA91C1D9DDD2E515EA9EC8EC25FED7D8834CC3D4FC2A73046DFDF793AC90830A13F61D52A0FD27A8B7338C1EB943DD43550FBF4D656C2947BCCC30143F701C7E66FBDB814F99E8E8167D81C3380FE7BB4552038B9B8E27DFE0E62AFFE7A1026B7217B59BAD5B9DA85C05D9FCCEC1AA95E102BCF5D578D5AABABA476DD415D5075D1F018E17B1F190F1B7D64142961224E025EC06703149B234347ACE5C0C7BAE56A601DD96FA284919DD3B717C3631920D314F5C1B3621ECAC8C0A155E7CF20E87E82941ACBCCCE4EB398774E0118BF4F3A1F9E24A923BE3912D4A37A9D421D1EAC0E9E1CA4FC5C3D1DE8848537BA544A7A5FEA01F2804CDC0B776DBCD9038A1A9E2690; .ASPXAUTH_TRUEHOME_AT=wDFM1bhsRZ_blJXJkUBU2aMFQm2-ZMRYp4oLshZzrQqGewO9KfexfR4u4Vfy1OJQVglCzA10zwWEFpcSbAuta98sKJ-qY5OWQLp488bYOjGQbO36Vw9_Q7A-28H-vGIPCjnijNArSnkNEZMoH47_8ow8vCJOCOwy5V3qpcx32zbfD7N2UaXBke2cP2SMnHo-Z4ZTOBHhU6Q_pW23Kl11L-7KfG1yaVrimbe0pfqyoPpidg3u_cy-PkrSU26evUBi9bZilfefBTy4DpmwfCuhR-mbj8_NhvKMxYL6Z2zOvIB8Xth-DEeZXUq43GNFYuDKcfiFZB4OzRAdVyJhjxKGWQmNlcRdWO3KsTC2YyHfxoW4yKYByZ7CNalKUlk1sEtcwfXyZGvhg9F9jdzhnVXjw5IUcC1dBA88lsiy0JkB0LZfXDXzqt-JfqZKyz67eM7NSrQ76dD9Fe4lf2-PYkp2-DhkUYwf-raKBFnRvy3Na5qTk67fliFITMLWQa26TKw4JLoTNnYZJC354V8G2W9AT3pkjT348R60EAfwXaXBJpukZ7t9HLo79fGNzr-btNs2SgB7lhl10IqJsGBilYGdMG7ZChBO7eRHtuEfJ-DkSEG5ssO2t07tC5u2Zn26_mxI-MzMg_ni8umuupwGO1s9e0gAIhfQnuK7MIohr-41rkGvNtDCQ0BO6Smk0QcRjGMUXo0Fsg; .ASPXAUTH_TRUEHOME_RT=yBOUrWyM0ndQCpnHRCg0DNZrBEEQY5yvVoWHano_TTBZhdeHp973fx4HNrR6Ev4ENLGbVvnzYZQYyWr_ESZhSKnwZlszW-e1C8_WQuVu9c342avWaz087vIEKQ171y52hSm22YxiYpicac89zq2SsHI96hWLL37CPn-NDVRFS4voyy_Din2j4Z7vq4tRr1ruKy7uIaGo1Tg6wawqZ-jswhs-gUVdtKVn5B_P8p-96emlzGOUtN6K8-xQVfF6Lg-CmbqkHMhWFJr8AewWJ_h9-kbIN5wWGIGXA7s6lrI3TBxF_xxOr4otZdlRyK4TVZ8jJgHbiNPtrOoATPiVcPL2YuEQmJYIlj9LxfadozNciYuEVcUrCGPcdLpIke9jqvO-GAYKZumQ5saiXDRf0BbcczRMc-4wx16ZXcExtPt-AGKZqGWzrVcrPKuzX5J_dHVDnrb9fdkYULoD-o41nPR4NMpo70n2HN3X6Sl2vPWCI4FI3elkkguuG01onqm0iQQF8PwqUOdO2FrOBH06pvFOXKu7YcQeQzF7EhS4HyFSZ3icWMSj3Rq_CUMYuPbQrDJT-mlKpUOmfPlgRqkuobV_4x31kukbSgw-k9lFzR5HEYJc2uFnvj8_2j4OZHyBRNJQgT2kIXPk0Y37zrVaL_gjup8IwZNaxPmnjG3eUB8SZGNd9gqV8gbh5lMwHy1dExe1KAoteA; thlang=en-US
Host: www.mytotalconnectcomfort.com
Origin: https://www.mytotalconnectcomfort.com
Referer: https://www.mytotalconnectcomfort.com/portal/Device/Control/7061292?page=1
sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Microsoft Edge";v="110"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.41
X-Requested-With: XMLHttpRequest

Payload
{"DeviceID":7061292,"SystemSwitch":null,"HeatSetpoint":null,"CoolSetpoint":70,"HeatNextPeriod":null,"CoolNextPeriod":null,"StatusHeat":0,"StatusCool":0,"FanMode":null}

24B

General
Request URL: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges
Request Method: POST
Status Code: 200 OK
Remote Address: 199.62.84.100:443
Referrer Policy: strict-origin-when-cross-origin

Response Headers
ADRUM_0: g:13da75c0-7142-40bd-a70a-f14fc03e8f7f
ADRUM_1: n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7
ADRUM_2: i:197974
ADRUM_3: e:2364
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 13
Content-Type: application/json; charset=utf-8
Date: Wed, 15 Feb 2023 13:09:44 GMT
Expires: -1
Pragma: no-cache
Server: Microsoft-IIS/8.5
Set-Cookie: NSC_NZUDD-443-WT=ffffffff090ecc0045525d5f4f58455e445a4a42378b;expires=Wed, 15-Feb-2023 13:07:24 GMT;path=/;secure;httponly
X-Frame-Options: DENY
X-UA-Compatible: IE=edge
X-XSS-Protection: 1; mode=block

Request Headers
Accept: application/json, text/javascript, */*; q=0.01
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Content-Length: 167
Content-Type: application/json; charset=UTF-8
Cookie: _ga=GA1.2.951668251.1676465188; _gid=GA1.2.1944135098.1676465188; __utma=195468848.951668251.1676465188.1676465188.1676465188.1; __utmc=195468848; __utmz=195468848.1676465188.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmb=195468848.2.9.1676465195792; LocalisationCultureCookie=en-US; ASP.NET_SessionId=uwv1mzexrc1r5tkl05vt2eh3; TrueHomeCheckCookie=; checkCookie=checkValue; notice_behavior=implied|us; .ASPXAUTH_TRUEHOME=451C9CAA5FB5353800DC6F404B2A4616F475F648C7D384385135AE5428FF4D8FA2CDD993F7B487E79E5D1A262EE2E9A1BC4A587040DF3431B6770DD5F7643C047CC411074A56BAA48EFF0D97F1B438E34CA91C1D9DDD2E515EA9EC8EC25FED7D8834CC3D4FC2A73046DFDF793AC90830A13F61D52A0FD27A8B7338C1EB943DD43550FBF4D656C2947BCCC30143F701C7E66FBDB814F99E8E8167D81C3380FE7BB4552038B9B8E27DFE0E62AFFE7A1026B7217B59BAD5B9DA85C05D9FCCEC1AA95E102BCF5D578D5AABABA476DD415D5075D1F018E17B1F190F1B7D64142961224E025EC06703149B234347ACE5C0C7BAE56A601DD96FA284919DD3B717C3631920D314F5C1B3621ECAC8C0A155E7CF20E87E82941ACBCCCE4EB398774E0118BF4F3A1F9E24A923BE3912D4A37A9D421D1EAC0E9E1CA4FC5C3D1DE8848537BA544A7A5FEA01F2804CDC0B776DBCD9038A1A9E2690; .ASPXAUTH_TRUEHOME_AT=wDFM1bhsRZ_blJXJkUBU2aMFQm2-ZMRYp4oLshZzrQqGewO9KfexfR4u4Vfy1OJQVglCzA10zwWEFpcSbAuta98sKJ-qY5OWQLp488bYOjGQbO36Vw9_Q7A-28H-vGIPCjnijNArSnkNEZMoH47_8ow8vCJOCOwy5V3qpcx32zbfD7N2UaXBke2cP2SMnHo-Z4ZTOBHhU6Q_pW23Kl11L-7KfG1yaVrimbe0pfqyoPpidg3u_cy-PkrSU26evUBi9bZilfefBTy4DpmwfCuhR-mbj8_NhvKMxYL6Z2zOvIB8Xth-DEeZXUq43GNFYuDKcfiFZB4OzRAdVyJhjxKGWQmNlcRdWO3KsTC2YyHfxoW4yKYByZ7CNalKUlk1sEtcwfXyZGvhg9F9jdzhnVXjw5IUcC1dBA88lsiy0JkB0LZfXDXzqt-JfqZKyz67eM7NSrQ76dD9Fe4lf2-PYkp2-DhkUYwf-raKBFnRvy3Na5qTk67fliFITMLWQa26TKw4JLoTNnYZJC354V8G2W9AT3pkjT348R60EAfwXaXBJpukZ7t9HLo79fGNzr-btNs2SgB7lhl10IqJsGBilYGdMG7ZChBO7eRHtuEfJ-DkSEG5ssO2t07tC5u2Zn26_mxI-MzMg_ni8umuupwGO1s9e0gAIhfQnuK7MIohr-41rkGvNtDCQ0BO6Smk0QcRjGMUXo0Fsg; .ASPXAUTH_TRUEHOME_RT=yBOUrWyM0ndQCpnHRCg0DNZrBEEQY5yvVoWHano_TTBZhdeHp973fx4HNrR6Ev4ENLGbVvnzYZQYyWr_ESZhSKnwZlszW-e1C8_WQuVu9c342avWaz087vIEKQ171y52hSm22YxiYpicac89zq2SsHI96hWLL37CPn-NDVRFS4voyy_Din2j4Z7vq4tRr1ruKy7uIaGo1Tg6wawqZ-jswhs-gUVdtKVn5B_P8p-96emlzGOUtN6K8-xQVfF6Lg-CmbqkHMhWFJr8AewWJ_h9-kbIN5wWGIGXA7s6lrI3TBxF_xxOr4otZdlRyK4TVZ8jJgHbiNPtrOoATPiVcPL2YuEQmJYIlj9LxfadozNciYuEVcUrCGPcdLpIke9jqvO-GAYKZumQ5saiXDRf0BbcczRMc-4wx16ZXcExtPt-AGKZqGWzrVcrPKuzX5J_dHVDnrb9fdkYULoD-o41nPR4NMpo70n2HN3X6Sl2vPWCI4FI3elkkguuG01onqm0iQQF8PwqUOdO2FrOBH06pvFOXKu7YcQeQzF7EhS4HyFSZ3icWMSj3Rq_CUMYuPbQrDJT-mlKpUOmfPlgRqkuobV_4x31kukbSgw-k9lFzR5HEYJc2uFnvj8_2j4OZHyBRNJQgT2kIXPk0Y37zrVaL_gjup8IwZNaxPmnjG3eUB8SZGNd9gqV8gbh5lMwHy1dExe1KAoteA; thlang=en-US; notice_preferences=2:; notice_gdpr_prefs=0|1|2:; cmapi_gtm_bl=; cmapi_cookie_privacy=permit_1|2|3
Host: www.mytotalconnectcomfort.com
Origin: https://www.mytotalconnectcomfort.com
Referer: https://www.mytotalconnectcomfort.com/portal/Device/Control/7039159?page=1
sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Microsoft Edge";v="110"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.41
X-Requested-With: XMLHttpRequest

Payload
{"DeviceID":7039159,"SystemSwitch":null,"HeatSetpoint":null,"CoolSetpoint":72,"HeatNextPeriod":null,"CoolNextPeriod":null,"StatusHeat":0,"StatusCool":0,"FanMode":null}
mkmer commented 1 year ago

I have added this line of code in the __init__.py _request_json function one line before the if resp.status == 200 and resp.content_type == "application/json":

_LOG.debug(f"request json response {resp} with payload {await resp.text()}")

When I get a redirect from attempting to set the temperature, this dumps the redirected web page. In my case it's complaining about an unsupported browser. I'd like to know if that's what your seeing on the failures too.

I'm not sure why it's detecting IE on my test, but it is :( If you are the same, the question will be why does it detect the wrong browser only some times.

ShortPutt commented 1 year ago

I made a slight change - added the following so we get the also log when content_type is 'text/html; charset=utf-8' and only on calls to change the temp - make sense?

if resp.status == 200 and req == "/portal/Device/SubmitControlScreenChanges":
   _LOG.debug(f"request json response {resp} with payload {await resp.text()}")

Will send output in a bit.

mkmer commented 1 year ago

Actually, the "title" on the returned web page is "unexpected error" `</p> <p>Unexpected Error</p> <p>`

mkmer commented 1 year ago

I found a possible issue. Change "data" to "json" as seen below.
https://github.com/mkmer/AIOSomecomfort/blob/224a15e6954d2a0720f19d4c3bbff898c5efa6e7/aiosomecomfort/__init__.py#L182

This was causing me issues in my test code... let's hope it's the issue.

ShortPutt commented 1 year ago

Im not able to test it until the weekend. I’ll let u know how it goes on Saturday.

ShortPutt commented 1 year ago

I made the data/json change but it did not fix the problem I also made the log change, so you can see the new info in the logs

Here's the log from a failed run

2023-02-18 17:15:00.521 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp Data - Before Setting Temp
Date / Time              2023/02/18 05:15:00
Thermostat Temp          71.0
ESP Temp                 73.04
Target Temp              72.0
Temp Adjustment           1
New Thermostat Temp      69

Thermostat Attributes
current_temperature        71
temperature                71
target_temp_high           None
target_temp_low            None
current_humidity           42.0
fan_mode                   auto
hvac_action                idle
preset_mode                None
fan_action                 idle
permanent_hold             False
dr_phase                   -1
friendly_name              24B
supported_features         ClimateEntityFeature.PRESET_MODE|FAN_MODE|TARGET_TEMPERATURE_RANGE|TARGET_TEMPERATURE
min_temp                   60
max_temp                   99
2023-02-18 17:15:00.547 DEBUG (MainThread) [somecomfort] AndyLog: device.py.set_setpoint_cool: lower: 60.0.  upper: 99.0.  temp: 69.0
2023-02-18 17:15:00.734 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 69, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7039159}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-18 17:15:00.968 DEBUG (MainThread) [somecomfort] AndyLog: _request_json req:          /portal/Device/SubmitControlScreenChanges
2023-02-18 17:15:00.968 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.status:  200
2023-02-18 17:15:00.968 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.headers: $s
2023-02-18 17:15:00.969 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.text:    <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:4e15922c-3c5b-4714-a441-83c2e8d7d169', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:31', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Sat, 18 Feb 2023 22:15:00 GMT', 'Content-Length': '3114', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0445525d5f4f58455e445a4a42378b;expires=Sat, 18-Feb-2023 22:12:40 GMT;path=/;secure;httponly')>
>
2023-02-18 17:15:00.969 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp:         <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:4e15922c-3c5b-4714-a441-83c2e8d7d169', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:31', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Sat, 18 Feb 2023 22:15:00 GMT', 'Content-Length': '3114', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0445525d5f4f58455e445a4a42378b;expires=Sat, 18-Feb-2023 22:12:40 GMT;path=/;secure;httponly')>

2023-02-18 17:15:00.969 DEBUG (MainThread) [somecomfort] AndyLog: _request_json args:         https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges
2023-02-18 17:15:00.969 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp kwargs:  {'json': {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 69, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7039159}, 'timeout': 30, 'headers': {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}}
2023-02-18 17:15:00.969 DEBUG (MainThread) [somecomfort] request json response <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Error?aspxerrorpath=/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Expires': '-1', 'Vary': 'Accept-Encoding', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:4e15922c-3c5b-4714-a441-83c2e8d7d169', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197987', 'ADRUM_3': 'e:31', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Sat, 18 Feb 2023 22:15:00 GMT', 'Content-Length': '3114', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc0445525d5f4f58455e445a4a42378b;expires=Sat, 18-Feb-2023 22:12:40 GMT;path=/;secure;httponly')>
 with payload <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!--[if IE 8 ]>    <html class="ie8" xmlns="http://www.w3.org/1999/xhtml"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie9" xmlns="http://www.w3.org/1999/xhtml"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html xmlns="http://www.w3.org/1999/xhtml">
<!--<![endif]-->
<head><title>

Unexpected Error

</title>

    <!--[if IE]>
        <style>
            .page { 
                    height: auto !important;
                  }
        </style>
    <![endif]-->

    <script type="text/javascript" src="/portal/Scripts/jquery-1.12.0.min.js"></script>
    <script type="text/javascript" src="/portal/Scripts/jquery.unobtrusive-ajax.js"></script>
    <script type="text/javascript" src="/portal/Scripts/jquery.validate.min.js"></script>
    <script type="text/javascript" src="/portal/Scripts/jquery.validate.unobtrusive.min.js"></script>
    <script type="text/javascript" src="/portal/Scripts/jquery-ui-1.10.4.min.js"></script>
    <script type="text/javascript" src="/portal/Scripts/jquery.qtip.min.js"></script>
    <script type="text/javascript" src="/portal/Scripts/jquery.idletimer.js"></script>
    <script type="text/javascript" src="/portal/Scripts/jquery.idletimeout.js"></script>

    <link rel="stylesheet" type="text/css" href="/portal/Content/TrueHome/jquery.qtip.truehome.css" />

    <link rel="stylesheet" type="text/css" href="/portal/Content/TrueHome/jquery.ui.truhome.css" />

    <link rel="stylesheet" type="text/css" href="/portal/Content/TrueHome/Layout.css?v=2.11.2" />
    <link rel="stylesheet" type="text/css" href="/portal/Content/TrueHome/Site.css?v=2.11.2" />
    <link rel="stylesheet" type="text/css" href="/portal/Content/TrueHome/Buttons.css?v=2.11.2" />
    <link rel="stylesheet" type="text/css" href="/portal/Content/TrueHome/EditorTemplates.css?v=2.11.2" />
    <link rel="stylesheet" type="text/css" href="/portal/Content/TrueHome/ModalAjaxContentDialog.css?v=2.11.2" />

    <script type="text/javascript" src="/portal/Scripts/Common/SessionTimeoutHandler.js?v=2.11.2"></script>

    <script type="text/javascript" src="/portal/Scripts/Common/ModalAjaxContentDialog.js?v=2.11.2"></script>
    <script type="text/javascript" src="/portal/Scripts/Common/CustomEvents.js?v=2.11.2"></script>
    <script type="text/javascript" src="/portal/Scripts/Common/EditorTemplates.js?v=2.11.2"></script>
    <script type="text/javascript" src="/portal/Scripts/Common/BrowserDetect.js?v=2.11.2"></script>

    </head>
<body>
    <!-- dialog window markup -->
    <div id="_verticalGradientBackground">
    </div>

    <div id="_contentWrapper">
        <div id="_leftBackground">
        </div>
        <div id="_content">
            <div id="header">
                <div id="header-top">
                    <ul id="toplinks">
                        <li><a href="https://www.honeywellhome.com" target="_blank">HoneywellHome.com</a></li>                        
                    </ul>
                </div>
                <div id="logo">
                    <a href="/portal/">Honeywell Home - My Total Connect Comfort<span></span></a>
                </div>
            </div>
            <div id="menucontainer">
                <ul id="menu">
                    <li class="menulink"><a href="https://www.honeywellhome.com/en/support"
                        target="_blank">
                        Contact Us</a></li>
                    <li class="menudivider"></li>
                    <li class="menulink">
                        <a href="/portal/Home/FAQs">FAQs</a></li>
                    <li class="menudivider"></li>

                    <li class="menulink">
                        <a href="/portal/MyAccount">My Account</a></li>
                    <li class="menudivider"></li>
                    <li class="menulink">
                        <a href="/portal/">Control Center</a></li>
                    <li class="menudivider"></li>
                    <li class="menulink">
                        <a href="/portal/Account/LogOff">Sign Out</a></li>
                    <li class="menudivider"></li>
                    <li id="greeting">
                        Welcome
                        <b>
                            Andrew</b></li>

                </ul>
            </div>
            <div id="red-grey-line">
            </div>
            <div id="breadcrumb">

    <div class="crumbs">Unexpected Error</div>

            </div>
            <div id="main">
                <noscript>
                    <div id="NoJavaScript">
                        This site will not operate without JavaScript enabled.  Refer to the FAQs tab on this site to learn about enabling JavaScript for your browser.
                    </div>
                </noscript>
                <div id="NoCookies">

This site will not operate without Cookies enabled.   Refer to the FAQs tab on this site to learn about enabling Cookies for your browser.
                </div>
                <div id="unsupportedbrowser">
                </div>
                <div id="mainContent">

 <div id="resetpassword">
        <h1>Unexpected Error</h1>
        <div class="formfield">
            <div class="rounded-bevel-border-topleftcorner">
            </div>
            <div class="rounded-bevel-border-top">
            </div>
            <div class="rounded-bevel-border-toprightcorner">
            </div>
            <div class="rounded-bevel-border-left">
                <div class="rounded-bevel-border-right">
                    <div class="whiteborder">
                        <div class="white-border-top">
                        </div>
                        <div class="white-border-left-side">
                            <div class="white-border-right-side">
                                <div id="account-success-whitebox">
                                    <div class="account-success">
                                        <div class="white-border-top">
                                        </div>
                                        <div class="white-border-left-side">
                                            <div class="white-border-right-side">

                                                <img src="/portal/Images/Icons/icon_red_x.gif?v=2.11.2" alt="Error" />
                                                <div class="Success">Error</div>
                                            </div>
                                        </div>
                                        <div class="white-border-bottom">
                                        </div>
                                    </div>
                                    <div class="success-text">
                                        <p>
                                        Sorry, an error occurred while processing your request.
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="white-border-bottom">
                        </div>
                    </div>
                    <div class="buttonarea">
                        <div class="buttonwrapper">
                            <div class="red-button-gray">
                                <a href="/portal/">Home</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="rounded-bevel-border-bottomleftcorner">
            </div>
            <div class="rounded-bevel-border-bottom">
            </div>
            <div class="rounded-bevel-border-bottomrightcorner">
            </div>
        </div>
    </div>

                </div>
            </div>
            <div id="gatewaylog">

            </div>
            <div id="_push">
            </div>
            <div id="_footer">
                <div>
                    Version 2.11.2 - February 07, 2023
                </div>
                <ul class="left" style="width: 700px;margin-top: 5px;">
                    <li class="rightborder">
                        <a href="/portal/Home/TermsAndConditions">Privacy Statement and End User License Agreement</a></li>
                    <li class="rightborder">
                        <a href="/portal/Home/TermsConditions">Terms &amp; Conditions</a></li>
                    <li class="rightborder"><a href="http://www.mytotalconnectcomfort.com/Account/ResetLocalisationCulture">Global Site</a></li>

                    <li class="rightborder">
                        <a href="/portal/Home/Feedback">Feedback</a></li>
                    <li><br/>&nbsp;&nbsp;<a href="https://honeywellhome.com/" target="_blank">&copy;
                        2023
                        Resideo Technologies, Inc.</a>
                        The Honeywell Home trademark is used under license from Honeywell International Inc. All rights reserved.
                    </li>
                </ul>
                <ul id="CultureControl">

<li class="rightborder"><a class="culture-link" data-ajax="false" href="/portal/Account/ChangeCulture?lang=en-US&amp;returnUrl=%2Fportal%2FError%3Faspxerrorpath%3D%2Fportal%2FDevice%2FSubmitControlScreenChanges" style="text-decoration: underline;">English</a> </li>

<li><a class="culture-link" data-ajax="false" href="/portal/Account/ChangeCulture?lang=fr-CA&amp;returnUrl=%2Fportal%2FError%3Faspxerrorpath%3D%2Fportal%2FDevice%2FSubmitControlScreenChanges" style="">Fran&#231;ais</a></li>

                </ul>
            </div>
        </div>
        <div id="_rightBackground">
        </div>
    </div>

    <div id="dialog" style="display: none">
        <div class="warning"></div>
        <ul>
            <li class="header">Your session is about to expire.</li>
            <li>You will be logged off in <span id='dialog-countdown' style='font-weight:bold'></span> seconds.</li>
            <li>Do you want to continue your session?</li>
        </ul>
    </div>

        <script type="text/javascript">
            var sessionTimeoutHandler = new SessionTimeoutHandler(
                "#dialog",
                "#dialog-countdown",
                "Yes",
                "No",
                '/portal/Account/LogOff',
                '/portal/Account/Timeout'
            );
            sessionTimeoutHandler.Initialize();
        </script>

    <script type="text/javascript" language="javascript">
        $(function ()
        {
            var isMobileDevice = true;

            if (BrowserDetect.browser == "Explorer" && parseFloat(BrowserDetect.version) < 8)
            {
                $("#unsupportedbrowser").html('The web browser you are using is not supported.  A supported browser is required to use Total Connect Comfort.  The most recent versions of Chrome, Safari, Firefox and Internet Explorer may be used.  Update or download one of these browsers to use Total Connect Comfort.');
            }
        });
    </script>
</body>
</html>

2023-02-18 17:15:00.969 ERROR (MainThread) [somecomfort] AndyLog: init._request_json: API returned 200 from /portal/Device/SubmitControlScreenChanges request
2023-02-18 17:15:00.971 ERROR (MainThread) [homeassistant.components.honeywell.const] AndyLog: climate._set_temperature: Invalid temperature 69.0: API returned 200, /portal/Device/SubmitControlScreenChanges
2023-02-18 17:15:01.182 WARNING (MainThread) [HVAC] HA HVAC 24B Set Temp FAILED
Date / Time              2023/02/18 05:15:00
Thermostat Temp          71.0
ESP Temp                 73.04
Target Temp              72.0
Temp Adjustment           1
New Thermostat Temp      69
Thermostat set to        71

Here's the log from a successful run

2023-02-18 17:35:00.385 WARNING (MainThread) [HVAC] HA HVAC 24A Set Temp Data - Before Setting Temp
Date / Time              2023/02/18 05:35:00
Thermostat Temp          71.0
ESP Temp                 68.9
Target Temp              71.0
Temp Adjustment           -2
New Thermostat Temp      73

Thermostat Attributes
current_temperature        71
temperature                71
target_temp_high           None
target_temp_low            None
current_humidity           41.0
fan_mode                   auto
hvac_action                cooling
preset_mode                None
fan_action                 running
permanent_hold             False
dr_phase                   -1
friendly_name              24A
supported_features         ClimateEntityFeature.PRESET_MODE|FAN_MODE|TARGET_TEMPERATURE_RANGE|TARGET_TEMPERATURE
min_temp                   60
max_temp                   99
2023-02-18 17:35:00.396 DEBUG (MainThread) [somecomfort] AndyLog: device.py.set_setpoint_cool: lower: 60.0.  upper: 99.0.  temp: 73.0
2023-02-18 17:35:00.654 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: before _post_json:  url: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges. data: {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 73, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7061292}. headers: {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}
2023-02-18 17:35:00.963 DEBUG (MainThread) [somecomfort] AndyLog: _request_json req:          /portal/Device/SubmitControlScreenChanges
2023-02-18 17:35:00.964 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.status:  200
2023-02-18 17:35:00.964 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.headers: $s
2023-02-18 17:35:00.964 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp.text:    <bound method ClientResponse.text of <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:05673d0e-fd74-4bdf-8e81-da184f996e18', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:133', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Sat, 18 Feb 2023 22:35:00 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1c45525d5f4f58455e445a4a42378b;expires=Sat, 18-Feb-2023 22:32:40 GMT;path=/;secure;httponly')>
>
2023-02-18 17:35:00.964 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp:         <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:05673d0e-fd74-4bdf-8e81-da184f996e18', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:133', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Sat, 18 Feb 2023 22:35:00 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1c45525d5f4f58455e445a4a42378b;expires=Sat, 18-Feb-2023 22:32:40 GMT;path=/;secure;httponly')>

2023-02-18 17:35:00.964 DEBUG (MainThread) [somecomfort] AndyLog: _request_json args:         https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges
2023-02-18 17:35:00.964 DEBUG (MainThread) [somecomfort] AndyLog: _request_json resp kwargs:  {'json': {'SystemSwitch': None, 'HeatSetpoint': None, 'CoolSetpoint': 73, 'HeatNextPeriod': None, 'CoolNextPeriod': None, 'StatusHeat': None, 'StatusCool': None, 'FanMode': None, 'DeviceID': 7061292}, 'timeout': 30, 'headers': {'X-Requested-With': 'XMLHttpRequest', 'Accept': '*/*', 'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate'}}
2023-02-18 17:35:00.965 DEBUG (MainThread) [somecomfort] request json response <ClientResponse(https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges) [200 OK]>
<CIMultiDictProxy('Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'Server': 'Microsoft-IIS/8.5', 'ADRUM_0': 'g:05673d0e-fd74-4bdf-8e81-da184f996e18', 'ADRUM_1': 'n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7', 'ADRUM_2': 'i:197974', 'ADRUM_3': 'e:133', 'X-XSS-Protection': '1; mode=block', 'X-UA-Compatible': 'IE=edge', 'X-Frame-Options': 'DENY', 'Date': 'Sat, 18 Feb 2023 22:35:00 GMT', 'Content-Length': '13', 'Set-Cookie': 'NSC_NZUDD-443-WT=ffffffff090ecc1c45525d5f4f58455e445a4a42378b;expires=Sat, 18-Feb-2023 22:32:40 GMT;path=/;secure;httponly')>
 with payload {"success":1}
2023-02-18 17:35:00.965 DEBUG (MainThread) [somecomfort] AndyLog: _set_thermostat_settings: after _post_json: result: {'success': 1}
2023-02-18 17:35:01.154 WARNING (MainThread) [HVAC] HA HVAC 24A Set Temp Successful
mkmer commented 1 year ago

Well that's disappointing :( That is the same error I was receiving when the payload was sent as URL encode (aka data= rather than json=) What is strange is that HA wasn't throwing the error (for me), but utilizing the test program that's provided with the API 100% threw the :

Unexpected Error I'm fairly sure it doesn't like something in the payload, but it's not jumping out what is "wrong".
ShortPutt commented 1 year ago

It always works when I change the target temp on tcc, so it would seem we should be able to figure this out. I used MS Edge to capture the output from a temp change on the thermostat that fails 90% of the time.

General

Request URL: https://www.mytotalconnectcomfort.com/portal/Device/SubmitControlScreenChanges
Request Method: POST
Status Code: 200 OK
Remote Address: 199.62.84.100:443
Referrer Policy: strict-origin-when-cross-origin

Response Headers

ADRUM_0: g:f960df7a-68f9-40b5-9a45-c6fe74844f7b
ADRUM_1: n:honeywell-prod_f7be1c76-506d-4111-81c5-fc62766aedb7
ADRUM_2: i:197974
ADRUM_3: e:125
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 13
Content-Type: application/json; charset=utf-8
Date: Tue, 21 Feb 2023 13:23:14 GMT
Expires: -1
Pragma: no-cache
Server: Microsoft-IIS/8.5
Set-Cookie: NSC_NZUDD-443-WT=ffffffff090ecc1c45525d5f4f58455e445a4a42378b;expires=Tue, 21-Feb-2023 13:20:54 GMT;path=/;secure;httponly
X-Frame-Options: DENY
X-UA-Compatible: IE=edge
X-XSS-Protection: 1; mode=block

Request Headers

Accept: application/json, text/javascript, */*; q=0.01
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Content-Length: 167
Content-Type: application/json; charset=UTF-8
Cookie: checkCookie=checkValue; _ga=GA1.2.951668251.1676465188; __utma=195468848.951668251.1676465188.1676465188.1676465188.1; __utmc=195468848; __utmz=195468848.1676465188.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); LocalisationCultureCookie=en-US; ASP.NET_SessionId=uwv1mzexrc1r5tkl05vt2eh3; TrueHomeCheckCookie=; checkCookie=checkValue; notice_behavior=implied|us; thlang=en-US; notice_preferences=2:; notice_gdpr_prefs=0|1|2:; cmapi_gtm_bl=; cmapi_cookie_privacy=permit_1|2|3; __RequestVerificationToken_L3BvcnRhbA2=2rnmP48Np8Jutj_ZJ_92UAX4mQUJ6C-VOS6KzRmmnbM9UK5D1YHwJ5ILbf8cDdrrP-Pyx8mUj7Mi1b90L7hrPif7pxU1; .ASPXAUTH_TRUEHOME=90E84FC1E182C75C0036581382914163ADAA306BD25D3C1F3D396E4D6C10FEF92034977F808AD1888B90B8934B46D97323DA033FF6762926CEBB935912ED7BD5EE2870A6628A1874D956E44D6B13BE45B1518CB2F6229991E575616253D1872944F5791498D45BDB9DF7654FFA8A187754990D740B87B4049D3C82FDD93C6B7BB8F79A6E819A4CB7047D41C9FE893D9B458DF0E39ECE15567777433AA66A73EA510622C7ABB222014E32A3E49C11B2BE14AA3926669F2927839BE336885B78FCAA47BF00F0A77E88203C68BF0E65679ED861C614F16C439A8BD2D8A982EAF9E39E64676BAD283F2595ABBF35AC19BA3EE36645E6E3AEFD9D204AF3AFF5FF7FB76391F292042EDBF1F6BFAF4DA0C50E89BE1E3A0F2E16C0F8CCCA871B390EB85D8625462E00B725C8BF9E0A3316A960F5CC7B8AE6F1CC601366A8A2C590B612553F57287EC0B353CB118107EFD50EB12092997752; .ASPXAUTH_TRUEHOME_AT=l-OmeD3VuNhTsirRznBtS8F5iL1BFP6zZhpH60c0J_aXUj-Y-un12YBzYYueXtofDAKBsJGUr1xgDqG5ZiVKQn7gMz7_PWDY7D1vhy-GXMv8ZnpiGKFesAPvp8zQPFRHkTK0ujv3s4nSQQ_wfBDjPHtGXU3wcOs6GakSc_OKWsMju8CgHF-igLXuPYrLL6Cr23uPCtqN_RPZfPMdVO6EUGv9APb2kSr43fAtePGRmnxGBnI6cLbA3NJpZu7lqlYf9nhaK6CsCcAul4MJVgSM1W_nwDDFQrAbx-IiujW1NeGaU5JzrBLbuiesiMlYWHFhbQuVBoOBr3yDhQ9FFmIxqiiRJUGu3z6JJv2-4clQeBIjbiB4SzlUcpBcin7jj-r556vgY8cqUbcHD1v8jG6C0HrWHVu5dWZ1jnwU2RYIr_Qo6AVoOcdmERYyd5XztJZV51dWAVTiFoLGf0KvXaqNPqGI9p3jPtFoXfsal9OWG-eicGz3mLoODXtRAo-wVh9-wdtSXmRD_NvoEiSFrJa1yddsQpfLTyKLQkf_AF_eOyd8VPg9V9NC9gJc9Za-eEgS0BVZTG08_LKUU09EZl4Vx08v6GKjSwxTTKlndQsfEWaT8A5dia8LPpsZzTZ16MaG0TPfezgEepEiffGio_QgGz7ESIqEgE4jTaSwu7yc2JmJrgjf5itAcC-07A33RxSvsvZKwQ; .ASPXAUTH_TRUEHOME_RT=Evroo6rCjuqsdnobhaeh9FioK82T04XuuwFt4yIcDzelmfVvwuH2iCTbmlR11qFYQ0pSd5z39g_I7jVvFaC8_5t6HcLCI6KeVATXjB5LucVfQ4zgehTZCN4ZPj1SELR6sXMcEAu4CJ0M145ACEJvK57aQG29TV7SlvsUR_lBFq0puS1LhPbPQEK9DfIMn0lpWcTy6-aWCZG-BUqvGaQoBA-T80ShIWkyhxZl5rKhFfG0GSOOIS7M6z10hRTyjHhdhqssUrIF_2QRfXHwcDRAKsQpT4YuCB1yPmLqkN5AKF9PFk63RnbOiNgSekOOsE7DztMbhN3J54J3tKumXTctrCyKVYMtc0JnIUoa5nemjoaYaIklE4KEnUXXN6fXOQlt1057QdqqAtElv1d2I5oSbTBNMbL9UPZdhtlNq4-XGm-BVVWmSzFAusRZp66VCCfhtkNwsOx2qVBTQJQhHLVXOFIwNwgeRGP0yEKwFDCbJjrzP41puCuiDgQO69azOtxHZEUN8-UTRmx_PdQQ9x9HtR0oD_2YhKdrjETUqFR3LNtDaAmHAyMOqiyQhaGqUWfZVEypZbx1Q24WjKDXCmaTfRDTR7BUNOBtgHaSBSC_rMJfzG5JgOE94fXlU66kGGT2X8AaawATk_cPocAKwIJZYBQ9Py_rgT-8VgY4767md-Bj0iMmk6ntXVLd0L2TjmtT-gJjZg
Host: www.mytotalconnectcomfort.com
Origin: https://www.mytotalconnectcomfort.com
Referer: https://www.mytotalconnectcomfort.com/portal/Device/Control/7039159?page=1
sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Microsoft Edge";v="110"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.41
X-Requested-With: XMLHttpRequest

Request Payload {"DeviceID":7039159,"SystemSwitch":null,"HeatSetpoint":null,"CoolSetpoint":73,"HeatNextPeriod":null,"CoolNextPeriod":null,"StatusHeat":1,"StatusCool":1,"FanMode":null}

Request Cookies

.ASPXAUTH_TRUEHOME  90E84FC1E182C75C0036581382914163ADAA306BD25D3C1F3D396E4D6C10FEF92034977F808AD1888B90B8934B46D97323DA033FF6762926CEBB935912ED7BD5EE2870A6628A1874D956E44D6B13BE45B1518CB2F6229991E575616253D1872944F5791498D45BDB9DF7654FFA8A187754990D740B87B4049D3C82FDD93C6B7BB8F79A6E819A4CB7047D41C9FE893D9B458DF0E39ECE15567777433AA66A73EA510622C7ABB222014E32A3E49C11B2BE14AA3926669F2927839BE336885B78FCAA47BF00F0A77E88203C68BF0E65679ED861C614F16C439A8BD2D8A982EAF9E39E64676BAD283F2595ABBF35AC19BA3EE36645E6E3AEFD9D204AF3AFF5FF7FB76391F292042EDBF1F6BFAF4DA0C50E89BE1E3A0F2E16C0F8CCCA871B390EB85D8625462E00B725C8BF9E0A3316A960F5CC7B8AE6F1CC601366A8A2C590B612553F57287EC0B353CB118107EFD50EB12092997752    www.mytotalconnectcomfort.com   /   Session 698 ✓       Lax         Medium  
.ASPXAUTH_TRUEHOME_AT   l-OmeD3VuNhTsirRznBtS8F5iL1BFP6zZhpH60c0J_aXUj-Y-un12YBzYYueXtofDAKBsJGUr1xgDqG5ZiVKQn7gMz7_PWDY7D1vhy-GXMv8ZnpiGKFesAPvp8zQPFRHkTK0ujv3s4nSQQ_wfBDjPHtGXU3wcOs6GakSc_OKWsMju8CgHF-igLXuPYrLL6Cr23uPCtqN_RPZfPMdVO6EUGv9APb2kSr43fAtePGRmnxGBnI6cLbA3NJpZu7lqlYf9nhaK6CsCcAul4MJVgSM1W_nwDDFQrAbx-IiujW1NeGaU5JzrBLbuiesiMlYWHFhbQuVBoOBr3yDhQ9FFmIxqiiRJUGu3z6JJv2-4clQeBIjbiB4SzlUcpBcin7jj-r556vgY8cqUbcHD1v8jG6C0HrWHVu5dWZ1jnwU2RYIr_Qo6AVoOcdmERYyd5XztJZV51dWAVTiFoLGf0KvXaqNPqGI9p3jPtFoXfsal9OWG-eicGz3mLoODXtRAo-wVh9-wdtSXmRD_NvoEiSFrJa1yddsQpfLTyKLQkf_AF_eOyd8VPg9V9NC9gJc9Za-eEgS0BVZTG08_LKUU09EZl4Vx08v6GKjSwxTTKlndQsfEWaT8A5dia8LPpsZzTZ16MaG0TPfezgEepEiffGio_QgGz7ESIqEgE4jTaSwu7yc2JmJrgjf5itAcC-07A33RxSvsvZKwQ  www.mytotalconnectcomfort.com   /   Session 731 ✓   ✓               Medium  
.ASPXAUTH_TRUEHOME_RT   Evroo6rCjuqsdnobhaeh9FioK82T04XuuwFt4yIcDzelmfVvwuH2iCTbmlR11qFYQ0pSd5z39g_I7jVvFaC8_5t6HcLCI6KeVATXjB5LucVfQ4zgehTZCN4ZPj1SELR6sXMcEAu4CJ0M145ACEJvK57aQG29TV7SlvsUR_lBFq0puS1LhPbPQEK9DfIMn0lpWcTy6-aWCZG-BUqvGaQoBA-T80ShIWkyhxZl5rKhFfG0GSOOIS7M6z10hRTyjHhdhqssUrIF_2QRfXHwcDRAKsQpT4YuCB1yPmLqkN5AKF9PFk63RnbOiNgSekOOsE7DztMbhN3J54J3tKumXTctrCyKVYMtc0JnIUoa5nemjoaYaIklE4KEnUXXN6fXOQlt1057QdqqAtElv1d2I5oSbTBNMbL9UPZdhtlNq4-XGm-BVVWmSzFAusRZp66VCCfhtkNwsOx2qVBTQJQhHLVXOFIwNwgeRGP0yEKwFDCbJjrzP41puCuiDgQO69azOtxHZEUN8-UTRmx_PdQQ9x9HtR0oD_2YhKdrjETUqFR3LNtDaAmHAyMOqiyQhaGqUWfZVEypZbx1Q24WjKDXCmaTfRDTR7BUNOBtgHaSBSC_rMJfzG5JgOE94fXlU66kGGT2X8AaawATk_cPocAKwIJZYBQ9Py_rgT-8VgY4767md-Bj0iMmk6ntXVLd0L2TjmtT-gJjZg  www.mytotalconnectcomfort.com   /   Session 731 ✓   ✓               Medium  
ASP.NET_SessionId   uwv1mzexrc1r5tkl05vt2eh3    www.mytotalconnectcomfort.com   /   Session 41  ✓   ✓   Lax         Medium  
LocalisationCultureCookie   en-US   .mytotalconnectcomfort.com  /   2024-02-15T12:46:35.849Z    30  ✓   ✓               Medium  
TrueHomeCheckCookie     www.mytotalconnectcomfort.com   /   Session 19  ✓   ✓               Medium  
__RequestVerificationToken_L3BvcnRhbA2  2rnmP48Np8Jutj_ZJ_92UAX4mQUJ6C-VOS6KzRmmnbM9UK5D1YHwJ5ILbf8cDdrrP-Pyx8mUj7Mi1b90L7hrPif7pxU1    www.mytotalconnectcomfort.com   /   Session 130 ✓   ✓               Medium  
__utma  195468848.951668251.1676465188.1676465188.1676465188.1  .mytotalconnectcomfort.com  /   2024-03-21T12:46:35.792Z    60                      Medium  
__utmc  195468848   .mytotalconnectcomfort.com  /   Session 15                      Medium  
__utmz  195468848.1676465188.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)  .mytotalconnectcomfort.com  /   2023-08-17T00:46:35.000Z    76                      Medium  
_ga GA1.2.951668251.1676465188  .mytotalconnectcomfort.com  /   2024-03-21T12:46:28.359Z    29                      Medium  
checkCookie checkValue  www.mytotalconnectcomfort.com   /portal Session 21                      Medium  
checkCookie checkValue  www.mytotalconnectcomfort.com   /   Session 21                      Medium  
cmapi_cookie_privacy    permit_1|2|3    .mytotalconnectcomfort.com  /   2023-08-14T12:06:39.000Z    32      ✓   None            Medium  
cmapi_gtm_bl        .mytotalconnectcomfort.com  /   2023-08-14T12:06:39.000Z    12      ✓   None            Medium  
notice_behavior implied|us  .mytotalconnectcomfort.com  /   Session 25      ✓   None            Medium  
notice_gdpr_prefs   0|1|2:  .mytotalconnectcomfort.com  /   2023-08-14T12:06:39.000Z    23      ✓   None            Medium  
notice_preferences  2:  .mytotalconnectcomfort.com  /   2023-08-14T12:06:39.000Z    20      ✓   None            Medium  
thlang  en-US   www.mytotalconnectcomfort.com   /   2024-03-27T13:17:45.912Z    11  ✓   ✓               Medium

Response {"success":1}

I saw the request payload had StatusCool:1 and StatusHeat:1 so I ran three more temp changes - all had StatusCool and StatusHeat : null, so not sure that tells us anything. Maybe when we get an error we retry w StatusCool:1 and StatusHeat:1 ?

Temp Hold 72 {"DeviceID":7039159,"SystemSwitch":null,"HeatSetpoint":null,"CoolSetpoint":72,"HeatNextPeriod":null,"CoolNextPeriod":null,"StatusHeat":null,"StatusCool":null,"FanMode":null} Temp Hold 71 {"DeviceID":7039159,"SystemSwitch":null,"HeatSetpoint":68,"CoolSetpoint":71,"HeatNextPeriod":null,"CoolNextPeriod":null,"StatusHeat":null,"StatusCool":null,"FanMode":null} Temp Hold 72 {"DeviceID":7039159,"SystemSwitch":null,"HeatSetpoint":null,"CoolSetpoint":72,"HeatNextPeriod":null,"CoolNextPeriod":null,"StatusHeat":null,"StatusCool":null,"FanMode":null}

mkmer commented 1 year ago

Making sure I understand - the above log is from MSEdge (right?) AIOSomecomfort NEVER sets the StatusCool or StatusHeat values. I wouldn't be hard to modify the set_setpoint_heat() and set_setpoint_cool() routines to add StatusCool/StatusHeat to the JSON message (modify to {CoolSetpoint: temp, StatusCool: 1, StatusHeat:1} payload (just to see if that makes a difference).

So far, it looks like we're sending the same payloads - but the error page is not forthcoming about what it doesn't like.... The web site is a bit flaky with cookies - sending expired cookies. You should see some of those errors on the Edge debug screen too.

Can you 100% successfully set temps via the UI in HA? Maybe via the service something is "sneaking" in that they don't like?

ShortPutt commented 1 year ago

Yes I used MS Edge for the browser info, but I can use another browser if you want.

I can't get it to fail when using tcc in the browser, so debug info there is not helpful.

But this may be helpful - I can't get it to fail when I use the UI to change the temp, but it does fail when I use the service call. Maybe we need to see what's being sent via the UI vs the service call?

mkmer commented 1 year ago

Browser doesn't matter - just wanted to see your payloads for your thermostats. Without a specification, we are only guessing that every thermostat is the "same" messages.

Since we can change the temp via the UI (and I believe it simply calls the same service), I wonder if the service call your code is generating is giving us some sort of bad data that is just passed along to the API. Maybe an extra space, or something that's not "obvious" when we look at the logs. I'm grasping at straws...

ShortPutt commented 1 year ago

UR right. The UI does call the same service and it does fail when I use the UI - same as the automation and using developer tools to call the service directly. Sorry for the bad info in my last msg.

So basically it fails pretty consistently from HA but from TCC in a browser it has never failed.

mkmer commented 1 year ago

I suppose we need to tinker with the API program directly - there is some additional debug in the test program provided with the API that can show us the exact messages AIOHttp is sending. At this point I'm out of ideas.

Looking at the issue trail, I don't think moving to AIOhttp broke this - it was broken before the move (right?) I have a program that changes the temperature every 15 seconds - ran on my stat for 2 hours with 100% success....
If you look for me on discord, I can share a few debug files I've been using for testing the API.

ShortPutt commented 1 year ago

Yes this was broken before, so I agree AIOhttp is not likely the cause.

I searched for mkmer on discord, but did not find you. What is your discord tag?

mkmer commented 1 year ago

mkmer#0872

On Wed, Feb 22, 2023 at 11:57 AM ShortPutt @.***> wrote:

Yes this was broken before, so I agree AIOhttp is not likely the cause.

I searched for mkmer on discord, but did not find you. What is your discord tag?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/78531#issuecomment-1440424288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3GVBH3A7P7HGFSFKL7HJLWYZAQVANCNFSM6AAAAAAQNKLA2I . You are receiving this because you were mentioned.Message ID: @.***>

mrsnyds commented 1 year ago

I don't have the wherewithal to do testing and tracing of API calls, but I have made some observations that may be helpful for those who can do those types of tests. I have a Honeywell Vision Pro 8000 controller, and I experience the problem that others have noted: I change a temperature setting, and the temperature does not change. What follows are more specifics of my setup and testing, and a description of the pattern of steps that IS SUCCESSFUL.

I am using the "heat/cool" mode for these steps.

FIRST OBSERVATION:

If I attempt to change either the "heat to" or the "cool to" temperatures, the settings are not applied to the conroller, however, if I change the system mode to something other than "heat/cool", that change is applied, no problem. In other words if I change from "heat/cool", to either "heat", or "cool", or back to "heat/cool" from one of those other modes, the mode change ALWAYS works.

The next part of this observation is that, once I have successfully changed the mode, I can adjust the temperature in the following manner: if I want to change the "cool to" temperature, I changed to "cool" mode and adjust the temperature there, and if I also want to change the "heat to" temperature I changed to "heat" mode and then also adjust that temperature, and then when I change back to "heat/cool" mode, I find the new temperatures have in fact been successfully applied to the controller.

This suggests to me that a "mode" parameter _might_ be mandatory in all web requests, even if you are only desiring to change the temperature (but again, I don't know how to do direct API testing, so this is just a circumstantial guess.)

SECOND OBSERVATION:

This observation might not be that helpful, but I wanted to note that adding the controller to my Google Home hub, I can change modes and temperatures using the Google Home app, and everything works consistently and in the usual way, meaning that I do not have change the mode back in forth if I only wanted to change the temperature.

I hope this information is helpful to anyone attempting to do lower level debugging.