Nexia and Trane XL1050 / XL850 thermostat

So I removed the ‘/100’ on line 446 of climate.py and got the following error message:

Mon Jan 06 2020 17:04:59 GMT-0500 (Eastern Standard Time)
Failed PUT Request:
  Url: /houses/698509/xxl_thermostats/1052143/humidity_setpoints
  Payload {'id': 1052143, 'humidify_setpoint': True, 'dehumidify_setpoint': 0.5, 'humidify_allowed': True, 'dehumidify_allowed': True, 'current_relative_humidity': 0.4366, 'display': {'humidity': 44, 'humidify_setpoint': 100, 'dehumidify_setpoint': 50, 'humidify_allowed': True, 'dehumidify_allowed': True, 'both_humidify_and_dehumidify_allowed': True, 'show_humidity_setpoint_changer': True, 'heat': False}}
  _content: b'<!DOCTYPE HTML>\n<!--[if IE 7 ]>    <html class="ie7"> <![endif]-->\n<!--[if IE 8 ]>    <html class="ie8"> <![endif]-->\n<!--[if IE 9 ]>    <html class="ie8"> <![endif]-->\n<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->\n<head>\n  <meta charset="utf-8">\n  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <title>Nexia&trade;</title>\n\n  <link href="/assets/nexia/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />\n  <link href="/assets/static_page.css?body=1" media="screen" rel="stylesheet" type="text/css" />\n\n  <!--[if lt IE 9]>\n    <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>\n    <![endif]-->\n\n</head>\n<body id="login-body">\n  <div id="footer_wrapper">\n    <header>\n      <div id="header-utility">\n        <div class="header-utility-content">\n          <div class="right">\n          </div>\n          <div class="left">\n          </div>\n        </div>\n      </div>\n      <nav id="header-navigation">\n        <div class="header-navigation-content">\n          <div class="left">\n            <a href="/"><img alt="Link_logo" src="/assets/nexia/link_logo.png"></a>\n          </div>\n          <div class="right">\n          </div>\n        </div>\n      </nav>\n    </header>\n\n    <div id="content">\n      <div id="external-wrapper">\n        <div id="external-content">\n          <div class="nexia_content"> <!-- Main body content: .com -->\n            <h2>We\'re sorry, an error has occurred (500).</h2>\n            <p>In order to provide you with the best possible service and reliability, we have logged this error and will do our best to correct it as quickly as possible.</p>\n            <p>In the meantime, please click the link below to return to the Nexia&trade; website. If you need further assistance, please contact Nexia support at 877-288-7707 or [email protected].</p>\n            <p>\n            <a href="/">Return to <span class="system_name">Nexia&trade;</span></a>\n            </p>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div id="footer_push"></div>\n  </div>\n  <footer id="content_footer">\n    <div class="footer-content">\n      <div class="column-a">\n        <a href="/privacy_policy.html" target="_blank">Privacy Policy</a>\n        <a href="/terms_and_conditions.html" target="_blank">Terms and Conditions</a>\n        <a href="http://mynexiahome.com" target="_blank">Subscriber Community</a>\n      </div>\n      <div class="column-b">\n        <a href="http://www.nexiahome.com" target="_blank">Where to Buy</a>\n        <a href="http://www.nexiahome.com/faq/" target="_blank">Contact Nexia</a>\n        <a href="https://mynexia.helpdocsonline.com" id="help_button" target="_blank">Help <span></span></a>\n      </div>\n      <div class="copyright">\n        \xc2\xa9 2015 Nexia Intelligence LLC\n      </div>\n      <div class="social-buttons">\n        <a href="https://twitter.com/NexiaHome" class="twitter" target="_blank">Twitter</a>\n        <a href="https://www.facebook.com/NexiaHome" class="facebook" target="_blank">Facebook</a>\n        <a href="https://www.youtube.com/user/NexiaHome" class="youtube" target="_blank">YouTube</a>\n      </div>\n    </div>\n  </footer>\n</body>\n</html>\n'
  status_code: 500
  headers: {'Content-Type': 'text/html; charset=utf-8', 'Date': 'Mon, 06 Jan 2020 22:04:59 GMT', 'Server': 'nginx/1.15.8 + Phusion Passenger', 'Status': '500 Internal Server Error', 'Strict-Transport-Security': 'max-age=631139040; includeSubdomains', 'Vary': 'Origin', 'X-Content-Type-Options': 'nosniff', 'X-Download-Options': 'noopen', 'X-Frame-Options': 'SAMEORIGIN', 'X-Permitted-Cross-Domain-Policies': 'none', 'X-Powered-By': 'Phusion Passenger Enterprise', 'X-Request-Id': 'd23922c8-fd36-4d16-abbb-b939228b99f5', 'X-Runtime': '0.040871', 'X-XSS-Protection': '1; mode=block', 'Content-Length': '3244', 'Connection': 'keep-alive'}
  url: https://www.mynexia.com/houses/698509/xxl_thermostats/1052143/humidity_setpoints
  history: []
  encoding: utf-8
  reason: Internal Server Error
  cookies: <RequestsCookieJar[]>
  elapsed: 0:00:00.116483
  request: <PreparedRequest [PUT]>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 133, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1262, in _execute_service
    await self._hass.async_add_executor_job(handler.func, service_call)
  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/climate.py", line 71, in humidify_set_service
    zone.set_humidify_setpoint(humidity)
  File "/config/custom_components/nexia/climate.py", line 447, in set_humidify_setpoint
    self._device.set_humidify_setpoint(humidify_setpoint, self._thermostat_id)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 1011, in set_humidify_setpoint
    thermostat_id=thermostat_id)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 980, in set_humidity_setpoints
    self._put_url(url, data)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 181, in _put_url
    request)
  File "/config/custom_components/nexia/nexia_thermostat.py", line 255, in _check_response
    raise Exception(f"{error_text}\n{response}")
Exception: Failed PUT Request:
  Url: /houses/698509/xxl_thermostats/1052143/humidity_setpoints
  Payload {'id': 1052143, 'humidify_setpoint': True, 'dehumidify_setpoint': 0.5, 'humidify_allowed': True, 'dehumidify_allowed': True, 'current_relative_humidity': 0.4366, 'display': {'humidity': 44, 'humidify_setpoint': 100, 'dehumidify_setpoint': 50, 'humidify_allowed': True, 'dehumidify_allowed': True, 'both_humidify_and_dehumidify_allowed': True, 'show_humidity_setpoint_changer': True, 'heat': False}}
  _content: b'<!DOCTYPE HTML>\n<!--[if IE 7 ]>    <html class="ie7"> <![endif]-->\n<!--[if IE 8 ]>    <html class="ie8"> <![endif]-->\n<!--[if IE 9 ]>    <html class="ie8"> <![endif]-->\n<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->\n<head>\n  <meta charset="utf-8">\n  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <title>Nexia&trade;</title>\n\n  <link href="/assets/nexia/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />\n  <link href="/assets/static_page.css?body=1" media="screen" rel="stylesheet" type="text/css" />\n\n  <!--[if lt IE 9]>\n    <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>\n    <![endif]-->\n\n</head>\n<body id="login-body">\n  <div id="footer_wrapper">\n    <header>\n      <div id="header-utility">\n        <div class="header-utility-content">\n          <div class="right">\n          </div>\n          <div class="left">\n          </div>\n        </div>\n      </div>\n      <nav id="header-navigation">\n        <div class="header-navigation-content">\n          <div class="left">\n            <a href="/"><img alt="Link_logo" src="/assets/nexia/link_logo.png"></a>\n          </div>\n          <div class="right">\n          </div>\n        </div>\n      </nav>\n    </header>\n\n    <div id="content">\n      <div id="external-wrapper">\n        <div id="external-content">\n          <div class="nexia_content"> <!-- Main body content: .com -->\n            <h2>We\'re sorry, an error has occurred (500).</h2>\n            <p>In order to provide you with the best possible service and reliability, we have logged this error and will do our best to correct it as quickly as possible.</p>\n            <p>In the meantime, please click the link below to return to the Nexia&trade; website. If you need further assistance, please contact Nexia support at 877-288-7707 or [email protected].</p>\n            <p>\n            <a href="/">Return to <span class="system_name">Nexia&trade;</span></a>\n            </p>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div id="footer_push"></div>\n  </div>\n  <footer id="content_footer">\n    <div class="footer-content">\n      <div class="column-a">\n        <a href="/privacy_policy.html" target="_blank">Privacy Policy</a>\n        <a href="/terms_and_conditions.html" target="_blank">Terms and Conditions</a>\n        <a href="http://mynexiahome.com" target="_blank">Subscriber Community</a>\n      </div>\n      <div class="column-b">\n        <a href="http://www.nexiahome.com" target="_blank">Where to Buy</a>\n        <a href="http://www.nexiahome.com/faq/" target="_blank">Contact Nexia</a>\n        <a href="https://mynexia.helpdocsonline.com" id="help_button" target="_blank">Help <span></span></a>\n      </div>\n      <div class="copyright">\n        \xc2\xa9 2015 Nexia Intelligence LLC\n      </div>\n      <div class="social-buttons">\n        <a href="https://twitter.com/NexiaHome" class="twitter" target="_blank">Twitter</a>\n        <a href="https://www.facebook.com/NexiaHome" class="facebook" target="_blank">Facebook</a>\n        <a href="https://www.youtube.com/user/NexiaHome" class="youtube" target="_blank">YouTube</a>\n      </div>\n    </div>\n  </footer>\n</body>\n</html>\n'
  status_code: 500
  headers: {'Content-Type': 'text/html; charset=utf-8', 'Date': 'Mon, 06 Jan 2020 22:04:59 GMT', 'Server': 'nginx/1.15.8 + Phusion Passenger', 'Status': '500 Internal Server Error', 'Strict-Transport-Security': 'max-age=631139040; includeSubdomains', 'Vary': 'Origin', 'X-Content-Type-Options': 'nosniff', 'X-Download-Options': 'noopen', 'X-Frame-Options': 'SAMEORIGIN', 'X-Permitted-Cross-Domain-Policies': 'none', 'X-Powered-By': 'Phusion Passenger Enterprise', 'X-Request-Id': 'd23922c8-fd36-4d16-abbb-b939228b99f5', 'X-Runtime': '0.040871', 'X-XSS-Protection': '1; mode=block', 'Content-Length': '3244', 'Connection': 'keep-alive'}
  url: https://www.mynexia.com/houses/698509/xxl_thermostats/1052143/humidity_setpoints
  history: []
  encoding: utf-8
  reason: Internal Server Error
  cookies: <RequestsCookieJar[]>
  elapsed: 0:00:00.116483
  request: <PreparedRequest [PUT]>

Your ‘is_percent’ function in init.py is broken and just returns True if between 1 and 100 and False otherwise. I added a # to comment out everything from the “AND” afterwards on the line and now it changes the Humidify settings.

I’ve used this as a means to learn more Python so I’ll look at adding the bounds checking that works to return a number.

I added an if-elif-else block to limit it to 0-100 in is_percent and it works well now.

Thanks for finding the typos.
In init.py,

is_percent()

is supposed to return True if the value is >=0 and <=100. Home Assistant deals with the humidity set point as an integer from 0 to 100, so to maintain consistency, that’s what I went with. cv.positive_int() seems to return 0 when passed in 0… I guess that makes sense since 0 is neither positive nor negative.

I fixed it by changing it to this:

def is_percent(value):
    return isinstance(value, int) and 0 <= value <= 100

There’s no way to tell from the JSON, but at least on nexiahome.com and on the Nexia app, the limits to humidity are 35% to 65% with a stepping of 5%. I don’t round to the nearest 5, but I do limit the input from 35% to 65%… or at least that’s what I intended. It doesn’t seem that I added the same check for humidify. :open_mouth:

I’m going to test and push to prerelease.

Done testing and pushed into prerelease.

OK I understand how is_percent is supposed to function, but with it returning TRUE/FALSE what gets sent to set_humidity_setpoint is a Boolean and Nexia so Nexia gets told to set the humidify setpoint to 0 or 1%.

Looking up the voluptuous lib that line 47 of climate.py uses and looking at the example at https://pypi.org/project/voluptuous/ it seems to me that instead of is_percent on line 47 it should have something like “All(int, Range(min=35, max=65)” (or would that be “vol.All(int,vol.Range(min=35, max=65)”?)

After looking at the developer docs I changed line 47 of climate.py to the following and now it works to limit the values to 35-65 and nexia gets the changes correct:

    vol.Required(ATTR_HUMIDITY): vol.All(vol.Coerce(int), vol.Range(min=35, max=65)),

Looks like a good fix. I’ll make that change tonight and push it to prerelease again. If you approve, I’ll push that to master.

I’ll check it out once you get it pushed. I also noticed a couple things in services.yaml that could confuse people. One place has climate misspelled and the example for humidity is “0.45” when it should be “45”

Rob

Fixed both and pushed.

Humidify seems to work well although it took me a minute to realize it wouldn’t set above the dehumidify setting. on the other hand nexia doesn’t seem to be getting the dehumidify setpoint changes. My connection to Nabu Casa seems to be having trouble so I may not be able to look at it again until late tonight.

Rob

Yea, I did put that functionality in where you can’t humidify above your dehumidify set point, and vice-versa. I’m not sure if Nexia does that or not, but it made logical sense for me to put that in there.

I see why climate.set_dehumidify wasn’t working. Entity_id is not optional on it. So it works as well as humidify. Everything looks good to release from my point of view.

Now if I could get nabu casa remote control to connect again

Ryan,

I’m not sure where to ask this so I thought I’d try here…
With the 0.018 beta The Nexia support is added in to HASS. I changed over and now there is not a climate device although there are thermostat sensors and nativezone scenes, and I get some errors to do with zones in the log. Since i see you and @bdraco have been working on it I wanted to figure out how to provide info to make it work right.

Can you point me to the best feedback portal?

thanks

Rob

Please open an issue here https://github.com/home-assistant/core/issues/new/choose and we will take a look to see what needs to be adjusted

EDIT2: Removing the nexia integration from my config file, deleting the integration via the web UI, rebooting, and re-enabling integration in config file may have resolved the latest issue.

EDIT: I signed into Nexia and removed the “Home” mobile device, and then restarted Home Assistant - the Home device got recreated and things worked for a minute and now show up as “Unavailable”.

Original message:

Is anyone else getting the following in the logs and the integration not working?

[homeassistant.components.nexia] Access error from Nexia service, please check credentials: 404 Client Error: Not Found for url: https://www.mynexia.com/mobile/session

I removed the custom component and HACs version and now looks like I’m SOL.

//TB

Ryan,

I originally tried to use the HACS version and couldn’t resolve a zones issue. It wasn’t a priority at the time as I had access via my smartthings integration.

I just tried the new integration as part of v108 and I’m getting the same exact issue as before.

Unexpected error fetching Nexia update data: ‘zones’
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 129, in async_refresh
self.data = await self._async_update_data()
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 117, in _async_update_data
return await self.update_method()
File “/usr/src/homeassistant/homeassistant/components/nexia/init.py”, line 87, in _async_update_data
return await hass.async_add_job(nexia_home.update)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.7/site-packages/nexia/home.py”, line 225, in update
self._update_devices()
File “/usr/local/lib/python3.7/site-packages/nexia/home.py”, line 245, in _update_devices
thermostat_updates_by_id[thermostat.thermostat_id]
File “/usr/local/lib/python3.7/site-packages/nexia/thermostat.py”, line 634, in update_thermostat_json
for zone_json in thermostat_json[“zones”]:
KeyError: ‘zones’

I have 2 stats with no zoning. The json confirms zoning_enabled = false

Here’s a snippet of my xxl json. Is there a stat configuration I’m missing? Both stats have unique names.

   "dealer_identifier": "8675309",
    "zones": [{
            "id": 833332233,
            "xxl_thermostat_id": 2298880,
            "name": "NativeZone",
            "tid": 29766,
            "display_temp_f": 77.0,
            "display_temp_c": 25.0,
            "cooling_setpoint": 77,
            "heating_setpoint": 70,
            "zone_mode": "COOL",
            "created_at": "2019-12-28T13:38:58.000Z",
            "updated_at": "2020-04-10T15:01:06.000Z",
            "requested_zone_mode": "COOL",
            "schedule_mode_status": "DISA",
            "zone_manual_status": "NEXT",
            "preset_selected": 0,
            "preset_cool1": 75,
            "preset_heat1": 70,
            "preset_cool2": 78,
            "preset_heat2": 65,
            "preset_cool3": 75,

Issues with the new core integration should be posted at https://github.com/home-assistant/core/issues/new/choose.

I can comment on github later but has anyone else seen this what rmertz3282 is posting about? I installed the nexia integration and it loaded fine initially. Now after reboot the system says unavailable and I have errors in my log file like

[homeassistant.components.nexia] Unexpected error fetching Nexia update data: 404 Client Error: Not Found for url: https://www.mynexia.com/mobile/

I can confirm this. I did some CentOS 7 updates and rebooted. Now I’m unable to get Nexia thermostat to come up in Home Assistant. Same error as above :slight_smile:

[homeassistant.components.nexia] Unexpected error fetching Nexia update data: 404 Client Error: Not Found for url: https://www.mynexia.com/mobile/houses/XXXXXX

Sorry to bring up an old topic, but does this allow control of the z-wave connected devices? I have a section thermostat that I connected to my XL824, so through my Nexia app I can control both, but when I link it through HA, it only shows the XL824, and not the other thermostat.

I am currently updating that thermostat though, so hoping that might change something, but just curious if this is my oversight of if this isn’t a thing yet