Turned all 'print' messages into _LOGGER.debug
This commit is contained in:
@@ -176,7 +176,7 @@ class LocaltuyaClimate(LocalTuyaEntity, ClimateEntity):
|
|||||||
self._has_presets = self.has_config(CONF_ECO_DP) or self.has_config(
|
self._has_presets = self.has_config(CONF_ECO_DP) or self.has_config(
|
||||||
CONF_PRESET_DP
|
CONF_PRESET_DP
|
||||||
)
|
)
|
||||||
print("Initialized climate [{}]".format(self.name))
|
_LOGGER.debug("Initialized climate [%s]", self.name)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
|
@@ -3,10 +3,13 @@ import functools
|
|||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
# Signature algorithm.
|
# Signature algorithm.
|
||||||
def calc_sign(msg, key):
|
def calc_sign(msg, key):
|
||||||
@@ -55,7 +58,7 @@ class TuyaCloudApi:
|
|||||||
+ "\n/"
|
+ "\n/"
|
||||||
+ url.split("//", 1)[-1].split("/", 1)[-1] # Url
|
+ url.split("//", 1)[-1].split("/", 1)[-1] # Url
|
||||||
)
|
)
|
||||||
# print("PAYLOAD: {}".format(payload))
|
# _LOGGER.debug("PAYLOAD: %s", payload)
|
||||||
return payload
|
return payload
|
||||||
|
|
||||||
async def async_make_request(self, method, url, body=None, headers={}):
|
async def async_make_request(self, method, url, body=None, headers={}):
|
||||||
@@ -70,7 +73,7 @@ class TuyaCloudApi:
|
|||||||
"sign_method": "HMAC-SHA256",
|
"sign_method": "HMAC-SHA256",
|
||||||
}
|
}
|
||||||
full_url = self._base_url + url
|
full_url = self._base_url + url
|
||||||
# print("\n" + method + ": [{}]".format(full_url))
|
# _LOGGER.debug("\n" + method + ": [%s]", full_url)
|
||||||
|
|
||||||
if method == "GET":
|
if method == "GET":
|
||||||
func = functools.partial(
|
func = functools.partial(
|
||||||
@@ -83,7 +86,7 @@ class TuyaCloudApi:
|
|||||||
headers=dict(default_par, **headers),
|
headers=dict(default_par, **headers),
|
||||||
data=json.dumps(body),
|
data=json.dumps(body),
|
||||||
)
|
)
|
||||||
# print("BODY: [{}]".format(body))
|
# _LOGGER.debug("BODY: [%s]", body)
|
||||||
elif method == "PUT":
|
elif method == "PUT":
|
||||||
func = functools.partial(
|
func = functools.partial(
|
||||||
requests.put,
|
requests.put,
|
||||||
@@ -121,14 +124,13 @@ class TuyaCloudApi:
|
|||||||
|
|
||||||
r_json = resp.json()
|
r_json = resp.json()
|
||||||
if not r_json["success"]:
|
if not r_json["success"]:
|
||||||
# print(
|
# _LOGGER.debug(
|
||||||
# "Request failed, reply is {}".format(
|
# "Request failed, reply is %s",
|
||||||
# json.dumps(r_json, indent=2, ensure_ascii=False)
|
# json.dumps(r_json, indent=2, ensure_ascii=False)
|
||||||
# )
|
# )
|
||||||
# )
|
|
||||||
return f"Error {r_json['code']}: {r_json['msg']}"
|
return f"Error {r_json['code']}: {r_json['msg']}"
|
||||||
|
|
||||||
self.device_list = {dev["id"]: dev for dev in r_json["result"]}
|
self.device_list = {dev["id"]: dev for dev in r_json["result"]}
|
||||||
# print("DEV__LIST: {}".format(self.device_list))
|
# _LOGGER.debug("DEV_LIST: %s", self.device_list)
|
||||||
|
|
||||||
return "ok"
|
return "ok"
|
||||||
|
@@ -74,10 +74,6 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
if len(entities_to_setup) > 0:
|
if len(entities_to_setup) > 0:
|
||||||
|
|
||||||
if dev_id not in hass.data[DOMAIN][TUYA_DEVICES]:
|
|
||||||
print("STRANO: {}".format(hass.data[DOMAIN][TUYA_DEVICES]))
|
|
||||||
return
|
|
||||||
|
|
||||||
tuyainterface = hass.data[DOMAIN][TUYA_DEVICES][dev_id]
|
tuyainterface = hass.data[DOMAIN][TUYA_DEVICES][dev_id]
|
||||||
|
|
||||||
dps_config_fields = list(get_dps_for_platform(flow_schema))
|
dps_config_fields = list(get_dps_for_platform(flow_schema))
|
||||||
|
@@ -39,6 +39,7 @@ CONF_ACTION = "action"
|
|||||||
CONF_ADD_DEVICE = "add_device"
|
CONF_ADD_DEVICE = "add_device"
|
||||||
CONF_EDIT_DEVICE = "edit_device"
|
CONF_EDIT_DEVICE = "edit_device"
|
||||||
CONF_SETUP_CLOUD = "setup_cloud"
|
CONF_SETUP_CLOUD = "setup_cloud"
|
||||||
|
CONF_NO_CLOUD = "no_cloud"
|
||||||
|
|
||||||
# light
|
# light
|
||||||
CONF_BRIGHTNESS_LOWER = "brightness_lower"
|
CONF_BRIGHTNESS_LOWER = "brightness_lower"
|
||||||
|
@@ -75,7 +75,7 @@ class LocaltuyaCover(LocalTuyaEntity, CoverEntity):
|
|||||||
self._state = self._stop_cmd
|
self._state = self._stop_cmd
|
||||||
self._previous_state = self._state
|
self._previous_state = self._state
|
||||||
self._current_cover_position = 0
|
self._current_cover_position = 0
|
||||||
print("Initialized cover [{}]".format(self.name))
|
_LOGGER.debug("Initialized cover [%s]", self.name)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
|
@@ -40,7 +40,7 @@ class LocaltuyaSwitch(LocalTuyaEntity, SwitchEntity):
|
|||||||
"""Initialize the Tuya switch."""
|
"""Initialize the Tuya switch."""
|
||||||
super().__init__(device, config_entry, switchid, _LOGGER, **kwargs)
|
super().__init__(device, config_entry, switchid, _LOGGER, **kwargs)
|
||||||
self._state = None
|
self._state = None
|
||||||
print("Initialized switch [{}]".format(self.name))
|
_LOGGER.debug("Initialized switch [%s]", self.name)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
|
@@ -117,8 +117,7 @@ class LocaltuyaVacuum(LocalTuyaEntity, StateVacuumEntity):
|
|||||||
|
|
||||||
self._fan_speed = ""
|
self._fan_speed = ""
|
||||||
self._cleaning_mode = ""
|
self._cleaning_mode = ""
|
||||||
|
_LOGGER.debug("Initialized vacuum [%s]", self.name)
|
||||||
print("Initialized vacuum [{}]".format(self.name))
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
|
Reference in New Issue
Block a user