
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Tuya Cloud Client Python package based on http-API for Tuya IoT Development Platform. TuyaCloudClient provides full fuctionality for remote manipulation with Tuya IoT platform based smart devices.
Tuya Cloud Client implies quick client functionality for an easy interaction with Tuya services. Most suitable for building software with Tuya API integrated services.
Major fuctionality of Tuya Cloud Client package is based on two classes: TuyaCloudClient & TuyaCloudClientNicer. TuyaCloudClientNicer is an extension over TuyaCloudClient. It provides just the same methods, but brings more significant data in responses, cleaned from meta. Usage of TuyaCloudClientNicer class is preferable for the most cases.
Intuitive functional interface of a service object
python3 -m pip install tuyacloud
OOP based package
tcc = tuyacloud.TuyaCloudClientNicer(
ACCESS_ID = 'XXXXXXXXXXXXXX',
ACCESS_SECRET = 'XXXXXXXXXXXXXX',
UID = 'XXXXXXXXXXXXXX',
ENDPOINT_URL = 'XXXXXXXXXXXXXX'
)
Credentials ACCESS_ID, ACCESS_SECRET, UID could be claimed at iot.tuya.com. ENDPOINT_URL is to be chosen by user from
Availability zone Endpoint
America openapi.tuyaus.com
China openapi.tuyacn.com
Europe openapi.tuyaeu.com
India openapi.tuyain.com
Eastern America openapi-ueaz.tuyaus.com
Western Europe openapi-weaz.tuyaeu.com
Call methods
homes = tcc.get_user_homes()
print(homes)
Get response
[
{
"geo_name": "Hong-Kong, Main str. 2716",
"home_id": 1490003,
"lat": 00.460004060004,
"lon": 00.219918549988,
"name": "Bachelor Condo",
"role": "OWNER"
},
...
]
Call methods
device_uuid = "3217xxxxxxxxxxx"
commands = []
commands.append({
"code": "switch_led_1",
"value": True
})
exec_result = tcc.exec_device_command(device_uuid, {"commands": commands})
print(exec_result)
Get response
{
"result": True,
"success": True,
"t": 1676636545787,
"tid": "bcc21939aebd11ed838e2a0aa76353ad"
}
You may capture logs by setting logger with id tuyacloud.TuyaCloudClient like so
def setup_logger():
logger_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger_file_handler = logging.handlers.RotatingFileHandler('tuyacloud.log', maxBytes=51200, backupCount=2)
logger_file_handler.setLevel(logging.DEBUG)
logger_file_handler.setFormatter(logger_formatter)
logger_tuya_cloud_client = logging.getLogger('tuyacloud.TuyaCloudClient')
logger_tuya_cloud_client.setLevel(logging.DEBUG)
logger_tuya_cloud_client.addHandler(logger_file_handler)
logger_tuya_cloud_client.info("script started")
setup_logger()
For more info see github.com/mrtxee/tuyacloud
FAQs
Tuya Cloud Client package based on http-API for Tuya IoT Development Platform
We found that tuyacloud demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.