Last active
June 24, 2019 15:50
-
-
Save TonyBogomoloff/9c5fa5a86ebb77eebc51625af6ef93a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wr_device = device.Device(serial="WR2870546688") ## the one from Gautier | |
command_set = 1 # b'\x00\xe6\x00' # https://my.tado.com/support/index?home.id=21004 | |
subset = metadata[metadata.command_set_code == command_set] | |
print('Number of commands in the subset:', len(subset)) | |
cmd = subset.ir_data.values[1] | |
cmd = 'AF12D1A832B2121255540E65556F1A63E7586A07A96FB26B000053FF5500818B210001646110115580116164640065726570716F01111110001111010321000100001011011111001000000000011001011100001000000000001111111011111110111100001010000000000000101010054210001000010110111110010000001111101100001111110001111010321000100001011011111001000000000010110000111111000111101054' | |
cmd = metadata.ir_data.values[0] | |
org = 0 if metadata[metadata.ir_data == cmd].command_set_code.values[0] < 10000 else 1 | |
command = bytearray.fromhex(cmd) | |
envelope_with_freq = wr_device.ir_translate(2, org, command) ## 0 == remotec, 1 == user | |
# command = bytearray(b'\x95\x17\xaa\x8d\xbc\r\xaf\x81\x01\x05\xaf\x81\xbf\x01\xad\x81\x02\x05\xaf\x81\x14\x05\xb1\x81\xa8\x01\xaf\x81\xbf\x01\xae\x81\x01\x05\xaf\x81\xbf\x01\xad\x81\xaa\x01\xaf\x81\x15\x05\xaf\x81\xab\x01\xad\x81\xbf\x01\xaf\x81\x00\x05\xaf\x81\x16\x05\xaf\x81\xaa\x01\xaf\x81\x15\x05\xaf\x81\xaa\x01\xad\x81\x17\x05\xaf\x81\x00\x05\xb0\x81\x15\x05\xaf\x81\x16\x05\xaf\x81\xab\x01\xad\x81\x16\x05\xaf\x81\x00\x05\xaf\x81\x17\x05\xaf\x81\xaa\x01\xad\x81\xc0\x01\xad\x81\xaa\x01\xae\x81\xbf\x01\xad\x81\x02\x05\xaf\x81\xc0\x01\xad\x81\xaa\x01\xaf\x81\x14\x05\xaf\x81\x02\x05\xaf\x81\x16\x05\xaf\x81\xaa\x01\xad\x81\xc0\x01\xad\x81\xaa\x01\xae\x81\xbf\x01\xad\x81\xaa\x01\xaf\x81\xbe\x01\xaf\x81\xaa\x01\xad\x81\xab\x01\xc2\x81\x02\x05\xaf\x81\x15\x05\xaf\x81\x01\x05\xaf\x81\x16\x05\xaf\x81\x01\x05\xb0\x81A\x10\xac\x8d\xba\r\xaf\x81\x02\x05\xaf\x81\xbf\x01\xad\x81\x02\x05\xaf\x81\x15\x05\xaf\x81\xaa\x01\xaf\x81\xbd\x01\xb0\x81\xff\x04\xaf\x81\xc0\x01\xad\x81\xab\x01\xad\x81\x17\x05\xaf\x81\xa9\x01\xaf\x81\xbf\x01\xad\x81\x01\x05\xaf\x81\x17\x05\xaf\x81\xa8\x01\xaf\x81\x16\x05\xaf\x81\xaa\x01\xc3\x81\x00\x05\xaf\x81\x17\x05\xaf\x81\x00\x05\xaf\x81\x15\x05\xaf\x81\xaa\x01\xb0\x81\x14\x05\xaf\x81\x01\x05\xb0\x81\x16\x05\xaf\x81\xbf\x01\xad\x81\xaa\x01\xad\x81\xac\x01\xad\x81\xbf\x01\xae\x81\x01\x05\xaf\x81\xbf\x01\xae\x81\xaa\x01\xaf\x81\x14\x05\xaf\x81\x17\x05\xaf\x81\x00\x05\xaf\x81\xc0\x01\xad\x81\xab\x01\xad\x81\xaa\x01\xad\x81\xc0\x01\xaf\x81\xa8\x01\xb0\x81\xbd\x01\xaf\x81\xaa\x01\xae\x81\xbf\x01\xad\x81\x01\x05\xaf\x81\x17\x05\xaf\x81\x00\x05\xaf\x81\x16\x05\xaf\x81\x15\x05\xb1\x81\x00\x00') | |
# envelope_with_freq = b'\x95\x17\xaa\x8d\xbc\r\xaf\x81\x01\x05\xaf\x81\xbf\x01\xad\x81\x02\x05\xaf\x81\x14\x05\xb1\x81\xa8\x01\xaf\x81\xbf\x01\xae\x81\x01\x05\xaf\x81\xbf\x01\xad\x81\xaa\x01\xaf\x81\x15\x05\xaf\x81\xab\x01\xad\x81\xbf\x01\xaf\x81\x00\x05\xaf\x81\x16\x05\xaf\x81\xaa\x01\xaf\x81\x15\x05\xaf\x81\xaa\x01\xad\x81\x17\x05\xaf\x81\x00\x05\xb0\x81\x15\x05\xaf\x81\x16\x05\xaf\x81\xab\x01\xad\x81\x16\x05\xaf\x81\x00\x05\xaf\x81\x17\x05\xaf\x81\xaa\x01\xad\x81\xc0\x01\xad\x81\xaa\x01\xae\x81\xbf\x01\xad\x81\x02\x05\xaf\x81\xc0\x01\xad\x81\xaa\x01\xaf\x81\x14\x05\xaf\x81\x02\x05\xaf\x81\x16\x05\xaf\x81\xaa\x01\xad\x81\xc0\x01\xad\x81\xaa\x01\xae\x81\xbf\x01\xad\x81\xaa\x01\xaf\x81\xbe\x01\xaf\x81\xaa\x01\xad\x81\xab\x01\xc2\x81\x02\x05\xaf\x81\x15\x05\xaf\x81\x01\x05\xaf\x81\x16\x05\xaf\x81\x01\x05\xb0\x81A\x10\xac\x8d\xba\r\xaf\x81\x02\x05\xaf\x81\xbf\x01\xad\x81\x02\x05\xaf\x81\x15\x05\xaf\x81\xaa\x01\xaf\x81\xbd\x01\xb0\x81\xff\x04\xaf\x81\xc0\x01\xad\x81\xab\x01\xad\x81\x17\x05\xaf\x81\xa9\x01\xaf\x81\xbf\x01\xad\x81\x01\x05\xaf\x81\x17\x05\xaf\x81\xa8\x01\xaf\x81\x16\x05\xaf\x81\xaa\x01\xc3\x81\x00\x05\xaf\x81\x17\x05\xaf\x81\x00\x05\xaf\x81\x15\x05\xaf\x81\xaa\x01\xb0\x81\x14\x05\xaf\x81\x01\x05\xb0\x81\x16\x05\xaf\x81\xbf\x01\xad\x81\xaa\x01\xad\x81\xac\x01\xad\x81\xbf\x01\xae\x81\x01\x05\xaf\x81\xbf\x01\xae\x81\xaa\x01\xaf\x81\x14\x05\xaf\x81\x17\x05\xaf\x81\x00\x05\xaf\x81\xc0\x01\xad\x81\xab\x01\xad\x81\xaa\x01\xad\x81\xc0\x01\xaf\x81\xa8\x01\xb0\x81\xbd\x01\xaf\x81\xaa\x01\xae\x81\xbf\x01\xad\x81\x01\x05\xaf\x81\x17\x05\xaf\x81\x00\x05\xaf\x81\x16\x05\xaf\x81\x15\x05\xb1\x81\x00\x00' | |
freq = struct.unpack('!H', envelope_with_freq[0:2])[0] | |
extractedEnvelope = envelope_with_freq[2:] | |
extractedEnvelope = irlib.deltastream_to_abs_timestamps(extractedEnvelope) | |
clear_output() | |
print(f'Freq: {freq}') | |
print('Origin: ', org) | |
print('len(extractedEnvelope) =', len(extractedEnvelope)) | |
plotSignal([visualize_waveform(extractedEnvelope)]) | |
# metadata[metadata.command_set_code == command_set].head(5) | |
# metadata[metadata.ir_data == cmd].head(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment