core/homeassistant/components/nexia/util.py

19 lines
450 B
Python

"""Utils for Nexia / Trane XL Thermostats."""
from http import HTTPStatus
def is_invalid_auth_code(http_status_code):
"""HTTP status codes that mean invalid auth."""
if http_status_code in (HTTPStatus.UNAUTHORIZED, HTTPStatus.FORBIDDEN):
return True
return False
def percent_conv(val):
"""Convert an actual percentage (0.0-1.0) to 0-100 scale."""
if val is None:
return None
return round(val * 100.0, 1)