tinytuya
tinytuya copied to clipboard
Aubess WiFi IR Controller S16 - cannot control SONY TV set
Hi, I wonder if you could help me out. The device model S16 is based on Tuya CBU BK7231.
What I did so far but the SONY TV cannot be controlled.
-
I retrieved the Device Log from Tuya cloud while using Tuya Smart App and pressing PWR button on it: IR send{"control":"send_ir","head":"010fbb00000000000f001900320064032c0313044c041a03450433046502fa0401035e02e1047e", "key1":"002$000CA900)","type":0,"delay":300}
-
also tested other buttons like VOL+/VOL-
-
I tested different DP ID from 1 to 255 range.
-
I use the following piece of code: import tinytuya import json d = tinytuya.OutletDevice( dev_id='bf778fxxxxx', address='192.168.1.61', local_key='x;Df9Fxxxx', version=3.3)
sony_pwr = { "control": "send_ir", "head": "", "key1": "002$000CA900)", "type": 0, "delay": 300, }
payload = d.generate_payload(tinytuya.CONTROL, {"201": json.dumps(sony_pwr)})
d.send(payload)
I would be grateful for any hint what else I could try.
Have you tried using the IRRemoteControlDevice in Contrib? https://github.com/jasonacox/tinytuya/blob/master/examples/Contrib/IRRemoteControlDevice-example.py
head = '010fbb00000000000f001900320064032c0313044c041a03450433046502fa0401035e02e1047e'
key1 = '002$000CA900'
ir.send_key( head, key1 )
Tried this without success
import sys
import tinytuya
from tinytuya import Contrib
from time import sleep
tinytuya.set_debug(True)
# SONY Tuya Device Debug Log: IR send{"control":"send_ir","head":"010fbb00000000000f001900320064032c0313044c041a03450433046502fa0401035e02e1047e","key1":"002$000CA900)","type":0,"delay":300}
head = '010fbb00000000000f001900320064032c0313044c041a03450433046502fa0401035e02e1047e'
key1 = '002$000CA900)'
ir = Contrib.IRRemoteControlDevice( 'bf778fxxxx', '192.168.1.61', 'x;Df9FZxxx', persist=True )
ir.send_key( head, key1 )
Actually, remove a leading zero from key1 and try it again (so, key1 = '02$000CA900'
). Depending on what DPS set the device uses the key1 from the debug logs could have an extra 0.
Yes, this works. Thank you.
Maybe you can share more tips about how to use the Contrib library in the real world - like the latest one (i.e. "remove the leading zero"). I know it may require some detailed knowledge about the difference between what we see in the Device Log and the way the data is encoded in the packet. Also the DP ID is kind of interesting topics (I have noticed that it is discovered somehow within the lib).
I also noticed this lib has some 'learning' capabilities - it kind of brute force approach but it looks like it might be very useful when you have the real Remote available. Thank you again. The working script is attached below..
import sys
import tinytuya
from tinytuya import Contrib
from time import sleep
# SONY Tuya Device Debug Log: IR send{"control":"send_ir","head":"010fbb00000000000f001900320064032c0313044c041a03450433046502fa0401035e02e1047e","key1":"002$000CA900)","type":0,"delay":300}
head = '010fbb00000000000f001900320064032c0313044c041a03450433046502fa0401035e02e1047e'
key1 = '02$000CA900)' # leading zero removed
ir = Contrib.IRRemoteControlDevice( 'bf778f99xxxxx', '192.168.1.61', 'x;Dfxxx', persist=True )
ir.send_key( head, key1 )
Maybe you can share more tips about how to use the Contrib library in the real world
Fair point. I'll capture that.