Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud command #485

Open
kstelios opened this issue Apr 8, 2024 · 1 comment
Open

Cloud command #485

kstelios opened this issue Apr 8, 2024 · 1 comment
Labels
tuya_iot_cloud Support questions for getting local key and Tuya Cloud APIs.

Comments

@kstelios
Copy link

kstelios commented Apr 8, 2024

Using Cloud.py example, whenever i put a value other than 0 on countdown_1, the result always toggles state regardless of switch_1 'value' (True or False).
My project: i created two batch commands to run cloud_on, cloud_off, but after some delay of 30 seconds.
It could be better to use only one py file and check with If state and arguments but i am not familiar to do this.

import tinytuya

c = tinytuya.Cloud(
apiRegion="xx",
apiKey="xxxxxx",
apiSecret="xxxxxx")

id = "xxxxxx"

commands = {
'commands': [{
'code': 'switch_1',
'value': False
}, {
'code': 'countdown_1',
'value': 0
}]
}
result = c.sendcommand(id,commands)`

@jasonacox jasonacox added the tuya_iot_cloud Support questions for getting local key and Tuya Cloud APIs. label Apr 9, 2024
@jasonacox
Copy link
Owner

I suspect the countdown command expects you want to turn on the device until countdown is reached at which it will turn it off. Have you tried just sending the countdown?

import tinytuya

c = tinytuya.Cloud(
    apiRegion="xx",
    apiKey="xxxxxx",
    apiSecret="xxxxxx"
)

device_id = "xxxxxx"  # Replace this with your actual device ID

commands = {
    'commands': [
        {'code': 'countdown_1', 'value': 0}
    ]
}

result = c.sendcommand(device_id, commands)

You can poke around the iot.tuya.com developer portal to see if gives any guidance. I would also try different combinations of sequencing different commands to see what they do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tuya_iot_cloud Support questions for getting local key and Tuya Cloud APIs.
Projects
None yet
Development

No branches or pull requests

2 participants