Nexia and Trane XL1050 / XL850 thermostat

Okay, I can replicate that. :slight_smile:

ATX?

“Between a Rock and a Weird place”, so right next door :wink:

Pflugerville! Nice. I’m in South Austin towards Dripping Springs. Small world!

Okay, pull the latest update and let me know how that one goes.

As for your second thermostat, I’ll probably need more info. Does your Nexia interface look any different than mine?

Okay… I see what I need to do for your second thermostat… It’ll have to wait for another night. I saw that the JSON was returned as an array, but never really understood why until I looked at your JSON again and saw that thermostats appear as a list.

It’s going to be a pretty big change.

Updated fixed the issue.

Yeah, I had a quick look at the code the other day and noticed you had a hard-coded index in there and changing to support multiple units due to the way to JSON blobs are passed around will need to be refactored…

The Nexia site looks the same except the other unit shows up below the first one.

I just pushed the update that should support multiple thermostats. Hopefully it works. Single and multiple thermostats should work the same way in all of the Home Assistant components, so I think this should work. I tested the basic functionality and it all seems to work.

I got the following errors after the latest update:

2019-06-11 10:21:05 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up platform nexia
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/nexia/binary_sensor.py", line 20, in setup_platform
    if thermostat.has_emergency_heat():
  File "/config/custom_components/nexia/nexia_thermostat.py", line 547, in has_emergency_heat
    return self._get_thermostat_key("emergency_heat_supported", thermostat_id)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 285, in _get_thermostat_key
    thermostat = self._get_thermostat_json(thermostat_id)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 276, in _get_thermostat_json
    raise IndexError("More than one thermostat detected. You must provide a thermostat_id")
IndexError: More than one thermostat detected. You must provide a thermostat_id
2019-06-11 10:21:05 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform nexia
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/nexia/sensor.py", line 22, in setup_platform
    if thermostat.has_variable_speed_compressor():
  File "/config/custom_components/nexia/nexia_thermostat.py", line 539, in has_variable_speed_compressor
    return self._get_thermostat_key("has_variable_speed_compressor", thermostat_id)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 285, in _get_thermostat_key
    thermostat = self._get_thermostat_json(thermostat_id)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 276, in _get_thermostat_json
    raise IndexError("More than one thermostat detected. You must provide a thermostat_id")
IndexError: More than one thermostat detected. You must provide a thermostat_id
2019-06-11 10:21:05 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 255, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 237, in state_attributes
    if self.current_humidity is not None:
  File "/config/custom_components/nexia/climate.py", line 108, in current_humidity
    return round(self._device.get_relative_humidity(self._thermostat_id) * 100.0, 1)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 658, in get_relative_humidity
    if self.has_relative_humidity():
  File "/config/custom_components/nexia/nexia_thermostat.py", line 531, in has_relative_humidity
    return self._get_thermostat_key("have_rh", thermostat_id)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 285, in _get_thermostat_key
    thermostat = self._get_thermostat_json(thermostat_id)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 276, in _get_thermostat_json
    raise IndexError("More than one thermostat detected. You must provide a thermostat_id")
IndexError: More than one thermostat detected. You must provide a thermostat_id
2019-06-11 10:21:05 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 255, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 237, in state_attributes
    if self.current_humidity is not None:
  File "/config/custom_components/nexia/climate.py", line 108, in current_humidity
    return round(self._device.get_relative_humidity(self._thermostat_id) * 100.0, 1)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 658, in get_relative_humidity
    if self.has_relative_humidity():
  File "/config/custom_components/nexia/nexia_thermostat.py", line 531, in has_relative_humidity
    return self._get_thermostat_key("have_rh", thermostat_id)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 285, in _get_thermostat_key
    thermostat = self._get_thermostat_json(thermostat_id)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 276, in _get_thermostat_json
    raise IndexError("More than one thermostat detected. You must provide a thermostat_id")
IndexError: More than one thermostat detected. You must provide a thermostat_id

Oops, yea, I forgot to add thermostat_id to most of the has_*() calls. I think I got the fix committed, but it’s untested.

I’m patching locally and I’ll try to send you a zip file with the changes to save on some back-and-forth.

I created a PR with additional fixes: https://github.com/ryannazaretian/home-assistant/pull/1 but looks like there are some other bits that need tweaking - I’ll amend that PR once I’ve done some testing.

Edit: PR updated with fixes so setting temperature works (though there might be a bug where you can’t set the temp if the mode is “off”, but that’s unrelated to these changes).

I merged your PR in, ran Pylint and fixed a bunch of formatting, and saw what you were talking about with setting the temperature while the mode is off. It was an actual check I had in the code from when I thought that wasn’t valid so I actively prevented it. I removed that check.

Excellent, thanks.

Do you have an air cleaner for your unit? I see code related to that, but I don’t see those showing up in the UI for me. I haven’t looked at the code in detail, so not sure what state that’s in / is it supposed to work yet.

//TB

My unit supports it, and the NexiaThermostat class supports it, but I didn’t add the code for it into Home Assistant. We could create a new service for setting the air cleaner mode.

Hi Ryan, thanks so much for your work on this. I have a pair of American Standard (Trane TEM8) and the XL1050 Thermostats. I managed to get them going with your process, but have something weird. One unit shows the Compressor speed properly and the other shows it as 0% which is incorrect for sure. The other odd thing is that in the temperature control of the North unit has the adjustments (not sure that the correct name is) between 1 o’clock and 2 o’clock and the south unit has them like between 11 and 12 noon. Any ideas why that will be the case?

I guess the Requested Compressor Speed is odd too.

The only other thing needed is to override DNS with whatever the thermostat is calling and reverse engineer what they are doing and then we dont need Nexia :slight_smile:

Again, thanks so much, this is really amazing!

Paul

And it seems that if the blower is off, the compressor does not turn off. It has been solid at 69% since I restarted HA.

Hey Paul,

The compressor speed with my system seems weird too, but that’s what Nexia is reporting. You can always cross check on the Nexia app.

As for the scaling, it’s based on the reported maximum and minimum temperatures for that zone. You can go to the states panel and view what your mom and max is within the climate controls attributes.

Thanks for checking it out!

How are you guys getting compressor speed? I’m not seeing it anywhere…

First, you have to have a system that supports variable speed control.

Second, in your sensor configuration, you would need to add platform: nexia.

Oh, I see. On one unit is min_temp: 45, max_temp: 80 and on the other is min_temp: 45, max_temp: 100. Is that setting on the thermostat itself or just adjusting the states?

The json returned from Nexia has the second unit compressor on zero, so that is how they are reading it.

I am not a fan of these units. I had a Lennox XC25 and they are way superior than Trane IMHO.

Here are both units side by side…

current_temperature: 74 current_temperature: 75
min_temp: 45 min_temp: 45
max_temp: 80 max_temp: 100
temperature: 74 temperature: 75
current_humidity: 45.2 current_humidity: 48.6
humidity: 45 humidity: 45
fan_mode: auto fan_mode: auto
fan_list: auto,on,circulate fan_list: auto,on,circulate
operation_mode: AUTO operation_mode: AUTO
hold_mode: none hold_mode: none
away_mode: off away_mode: off
attribution: Data provided by nexiahome.com attribution: Data provided by nexiahome.com
target_temp_high: 74 target_temp_high: 75
target_temp_low: 70 target_temp_low: 70
target_temp_step: 1 target_temp_step: 1
operation_list: AUTO,COOL,HEAT,OFF operation_list: AUTO,COOL,HEAT,OFF
model: AZON1050AC52ZAA model: AZON1050AC52ZAA
firmware: 5.5.1 firmware: 5.5.1
thermostat_name: North thermostat_name: South
setpoint_status: Following Schedule - Sleep setpoint_status: Following Schedule - Sleep
zone_status: zone_status:
thermostat_id: 1581922 thermostat_id: 1741377
zone_id: 0 zone_id: 0
min_humidity: 35 min_humidity: 35
max_humidity: 65 max_humidity: 65
friendly_name: NativeZone friendly_name: NativeZone
supported_features: 1481 supported_features: 1481