Cloud control for IR devices #283
-
Hello
To use the Cloud Discussion #104 is similar but aimed at subdevices created when adding a device to the Smart IR. I don't think it is possible to send the command to the subdevice via cloud. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
import tinytuya
import json
tinytuya.set_debug()
c = tinytuya.Cloud()
device_id = '...'
ir_cmd = {
"control":"send_ir",
"head":"010ed20000000000040015004000ad0730",
"key1":"002$$0020E0E0E01F@%",
"type":0,
"delay":300
}
cloud_cmd = {
"commands": [
{
"code": "ir_send",
"value": json.dumps(ir_cmd)
},
]
}
res = c.sendcommand(device_id, cloud_cmd)
print(res)
print('')
print( json.dumps(res, indent=2) ) If you have remotes programmed/defined you can also send keys: import tinytuya
import json
tinytuya.set_debug()
c = tinytuya.Cloud()
device_id = '...' # Smart IR (IR blaster)
# Get a listing of all programmed remotes
#res = c.cloudrequest( '/v2.0/infrareds/' + device_id + '/remotes' )
# Get a list of all keys on a remote
remote_id = '...'
#res = c.cloudrequest( '/v2.0/infrareds/' + device_id + '/remotes/' + remote_id + '/keys' )
# Send a key
post_data = {
"category_id": 2,
"remote_index": 10572,
"key": "Power"
}
#res = c.cloudrequest( '/v2.0/infrareds/' + device_id + '/remotes/' + remote_id + '/command', post=post_data )
print( res )
print( json.dumps(res, indent=2) ) |
Beta Was this translation helpful? Give feedback.
-
Not sure if this is the correct place, but I made a comment on an issue and I realized it is closed already, so this discussion here may be the correct place for it. I think I found a new pattern for the |
Beta Was this translation helpful? Give feedback.
If you have remotes programmed/defined you can also send keys: