Home Assistant Unofficial Reference 2024.12.1
util.py
Go to the documentation of this file.
1 """Utils for Nexia / Trane XL Thermostats."""
2 
3 from http import HTTPStatus
4 
5 
6 def is_invalid_auth_code(http_status_code):
7  """HTTP status codes that mean invalid auth."""
8  if http_status_code in (HTTPStatus.UNAUTHORIZED, HTTPStatus.FORBIDDEN):
9  return True
10 
11  return False
12 
13 
14 def percent_conv(val):
15  """Convert an actual percentage (0.0-1.0) to 0-100 scale."""
16  if val is None:
17  return None
18  return round(val * 100.0, 1)
def is_invalid_auth_code(http_status_code)
Definition: util.py:6