tinytuya icon indicating copy to clipboard operation
tinytuya copied to clipboard

Local support for sending IR

Open rluvaton opened this issue 2 years ago • 6 comments

there is a cloud API for sending learned key for IR remote: Docs

Is there an equivalent for local mode?

rluvaton avatar May 20 '23 23:05 rluvaton

https://github.com/jasonacox/tinytuya/blob/master/examples/Contrib/IRRemoteControlDevice-example.py

uzlonewolf avatar May 20 '23 23:05 uzlonewolf

Hi @rluvaton, were you able to get it working with the example?

uzlonewolf avatar May 23 '23 03:05 uzlonewolf

Hey, I don't see in that example the key id 😬

rluvaton avatar May 23 '23 06:05 rluvaton

Hmm, it does appear to be kinda buried at the bottom in favor of parsing it into its head+key components. A more succinct example would be:

ir = Contrib.IRRemoteControlDevice( 'abcdefghijklmnop123456', '172.28.321.475', '1234567890123abc', persist=True )

# learn a new remote
print("Press button on your remote control")
button = ir.receive_button(timeout=15)
if (button == None):
    print("Timeout, button code is not received")
    sys.exit(1)

print("Received button:", button)

for i in range(10):
    print("Simulating button press...")
    ir.send_button(button)
    sleep(1)

uzlonewolf avatar May 23 '23 07:05 uzlonewolf

Hi @rluvaton, did the above example help any?

uzlonewolf avatar May 31 '23 18:05 uzlonewolf

It's not the same, I already have learned key

rluvaton avatar May 31 '23 20:05 rluvaton