Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nexia emergency heat does not turn on. #64013

Closed
mlebaugh opened this issue Jan 13, 2022 · 8 comments · Fixed by #64020
Closed

Nexia emergency heat does not turn on. #64013

mlebaugh opened this issue Jan 13, 2022 · 8 comments · Fixed by #64020
Assignees

Comments

@mlebaugh
Copy link

The problem

Attempting to toggle emergency heat using service: climate.set_aux_heat fails with 400 response code.

service: climate.set_aux_heat
data:
  aux_heat: true
target:
  entity_id: climate.living_room

What version of Home Assistant Core has the issue?

2021.12.8

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Nexia

Link to integration documentation on our website

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

Example YAML snippet

service: climate.set_aux_heat
data:
  aux_heat: true
target:
  entity_id: climate.living_room


### Anything in the logs that might be useful for us?

```txt
2022-01-12 17:59:32 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2022-01-12 17:59:32 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2022-01-12 17:59:32 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 400 Client Error: Bad Request for url: https://www.tranehome.com/mobile/xxl_thermostats/[redactedhouseid]/emergency_heat
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 584, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 566, in async_service_aux_heat
    await entity.async_turn_aux_heat_on()
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 494, in async_turn_aux_heat_on
    await self.hass.async_add_executor_job(self.turn_aux_heat_on)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/nexia/climate.py", line 428, in turn_aux_heat_on
    self._thermostat.set_emergency_heat(True)
  File "/usr/local/lib/python3.9/site-packages/nexia/thermostat.py", line 433, in set_emergency_heat
    self._post_and_update_thermostat_json(
  File "/usr/local/lib/python3.9/site-packages/nexia/thermostat.py", line 665, in _post_and_update_thermostat_json
    response = self._nexia_home.post_url(url, payload)
  File "/usr/local/lib/python3.9/site-packages/nexia/home.py", line 174, in post_url
    response.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://www.tranehome.com/mobile/xxl_thermostats/[redactedhouseid]/emergency_heat
2022-01-12 17:59:32 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [redacted] Error handling message: Unknown error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 527, in handle_execute_script
    await script_obj.async_run(msg.get("variables"), context=context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1260, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 363, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 584, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 566, in async_service_aux_heat
    await entity.async_turn_aux_heat_on()
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 494, in async_turn_aux_heat_on
    await self.hass.async_add_executor_job(self.turn_aux_heat_on)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/nexia/climate.py", line 428, in turn_aux_heat_on
    self._thermostat.set_emergency_heat(True)
  File "/usr/local/lib/python3.9/site-packages/nexia/thermostat.py", line 433, in set_emergency_heat
    self._post_and_update_thermostat_json(
  File "/usr/local/lib/python3.9/site-packages/nexia/thermostat.py", line 665, in _post_and_update_thermostat_json
    response = self._nexia_home.post_url(url, payload)
  File "/usr/local/lib/python3.9/site-packages/nexia/home.py", line 174, in post_url
    response.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://www.tranehome.com/mobile/xxl_thermostats/[redactedhouseid]/emergency_heat

Additional information

https://community.home-assistant.io/t/nexia-and-trane-xl1050-xl850-thermostat/48673/205?u=mattlebaugh

@probot-home-assistant
Copy link

nexia documentation
nexia source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (nexia) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@bdraco
Copy link
Member

bdraco commented Jan 13, 2022

Can you get a dump of what the mobile app is doing to set heat using Charles Proxy ? (https://www.charlesproxy.com/documentation/ios/)

@mlebaugh
Copy link
Author

mlebaugh commented Jan 13, 2022

I think I have that app working. The URL it is using appears to be the same. Looks like the request Body was

{ "value": "false" }
and
{ "value": "true" }

69267E4F-069B-4FF0-9CCF-D6F8AD237C39

@bdraco
Copy link
Member

bdraco commented Jan 13, 2022

Looks like the boolean needs to be stringed
https://github.com/bdraco/nexia/blob/master/nexia/thermostat.py#L434

@mlebaugh
Copy link
Author

mlebaugh commented Jan 13, 2022

I was also just looking at that, I can make that change that line and test on my system, but I'm no python expert so I will need some help on what to change.

@bdraco
Copy link
Member

bdraco commented Jan 13, 2022

I just released a new version of the nexia library with the fix and opened #64020 to merge the changes to Home Assistant.

If you want to test the PR, that would be great, but if not thats ok as well as I'm 99.9% sure its the right fix given it works exactly the same way as set_follow_schedule

@mlebaugh
Copy link
Author

That fixed it! Thank you!

@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants