Skip to content

Commit

Permalink
Поправлено логирование
Browse files Browse the repository at this point in the history
- убраны warning и error в логах, где они не нужны
- добавлено больше логов для новых устройств
  • Loading branch information
and7ey committed May 24, 2024
1 parent 257aa14 commit a28ef6c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion api.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def pull_data(self):
and "application/json" in resp.headers.get("content-type")
and resp.json().get("data", {}).get("presentation", {}).get("layout", {}).get('scrollContainer', [])
):
_LOGGER.debug(resp.text)
containers = resp.json().get("data", {}).get("presentation", {}).get("layout", {}).get('scrollContainer', [])
for item in containers:
if item.get("contractName", "") == "deviceList":
Expand Down Expand Up @@ -179,7 +180,7 @@ def __init__(self, device_mac: str, device_serial: str, device_title: str, haier


status_url = API_STATUS.replace("{mac}", self._id)
_LOGGER.debug(f"Getting initial status of device {self._id}, url: {status_url}")
_LOGGER.info(f"Getting initial status of device {self._id}, url: {status_url}")
resp = requests.get(
status_url,
headers={"X-Auth-token": self._haier._token}
Expand All @@ -189,6 +190,7 @@ def __init__(self, device_mac: str, device_serial: str, device_title: str, haier
and resp.json().get("attributes", {})
):
_LOGGER.debug(f"Update device {self._id} status code: {resp.status_code}")
_LOGGER.debug(resp.text)
attributes = resp.json().get("attributes", {})
for attr in attributes:
if attr.get('name', '') == "0": # Температура в комнате
Expand Down Expand Up @@ -250,6 +252,8 @@ def _on_message(self, ws: websocket.WebSocket, message: str) -> None:
self._handle_status_update(message_dict)
elif message_type == "command_response":
pass
elif message_type == "info":
pass
else:
_LOGGER.debug(f"Got unknown message of type: {message_type}")

Expand Down
2 changes: 1 addition & 1 deletion climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def hvac_mode(self) -> str:

def set_hvac_mode(self, hvac_mode: str) -> None:
"""Set new target hvac mode."""
_LOGGER.warning(f"set_hvac_mode {hvac_mode}")
_LOGGER.debug(f"set_hvac_mode {hvac_mode}")
if hvac_mode == HVACMode.OFF:
self._module.switchOff()
else:
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/and7ey/haier_evo/issues",
"requirements": ["requests"],
"version": "0.1.1",
"version": "0.1.2",
"zeroconf": []
}

0 comments on commit a28ef6c

Please sign in to comment.