Skip to content

Commit

Permalink
Add error detection and logging for properties in the thermostat
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Mulliken committed May 17, 2021
1 parent 62a5ec7 commit 6a5be46
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
# replace with your username:
name = wyzeapy
version = 0.0.23-beta.7
version = 0.0.23-beta.8
author = Mulliken LLC
author_email = [email protected]
description = Python client for private Wyze API
Expand Down
7 changes: 4 additions & 3 deletions src/wyzeapy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
# of the attached license. You should have received a copy of
# the license with this file. If not, please write to:
# [email protected] to receive a copy

import logging
import re

from typing import Any, Optional, List, Tuple
from .base_client import BaseClient
from .exceptions import ActionNotSupported
from .types import ThermostatProps, Device, DeviceTypes, PropertyIDs, Event, Group

_LOGGER = logging.getLogger(__name__)

class Client:
def __init__(self, email, password):
Expand Down Expand Up @@ -201,8 +202,8 @@ def get_thermostat_info(self, device) -> List[Tuple[ThermostatProps, Any]]:
try:
prop = ThermostatProps(property)
device_props.append((prop, properties[property]))
except AttributeError as e:
print(e)
except ValueError as e:
_LOGGER.debug(f"{e} with value {properties[property]}")

return device_props

Expand Down
2 changes: 2 additions & 0 deletions src/wyzeapy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class ThermostatProps(Enum):
W_LON = "w_lon"
DEV_HOLD = "dev_hold"
TEMP_UNIT = "temp_unit"
ASW_HOLD = "asw_hold"



class ResponseCodes(Enum):
Expand Down

0 comments on commit 6a5be46

Please sign in to comment.