Skip to content

Instantly share code, notes, and snippets.

@svyatogor
Last active July 12, 2025 14:27
Show Gist options
  • Save svyatogor/7839d00303998a9fa37eb48494dd680f to your computer and use it in GitHub Desktop.
Save svyatogor/7839d00303998a9fa37eb48494dd680f to your computer and use it in GitHub Desktop.
Convert SmartIR Broadlink commands to Tuya
@cord-otten
Copy link

cord-otten commented May 8, 2025

I seem to have an issue when trying to convert 1344 or 1161 (both relate to the "YB1FA" remote):

Traceback (most recent call last):
  File "C:\temp\script.py", line 175, in <module>
     output_file.write(process_commands(sys.argv[1]))

  File "C:\temp\script.py", line 167, in process_commands
    data['commands'] = process_commands_recursively(data.get('commands', {}))

  File "C:\temp\script.py", line 161, in process_commands_recursively
    processed_commands[key] = process_commands_recursively(value)

  File "C:\temp\script.py", line 161, in process_commands_recursively
    processed_commands[key] = process_commands_recursively(value)

  File "C:\temp\script.py", line 161, in process_commands_recursively
    processed_commands[key] = process_commands_recursively(value)

  File "C:\temp\script.py", line 159, in process_commands_recursively
    processed_commands[key] = encode_ir(value)

  File "C:\temp\script.py", line 16, in encode_ir
    signal = filter(get_raw_from_broadlink(base64.b64decode(command).hex()))

  File "C:\temp\script.py", line 137, in get_raw_from_broadlink
    length = int(string[6:8] + string[4:6], 16)  # Length of payload in little endian
ValueError: invalid literal for int() with base 16: ''

As far as I can see, they are for Broadlink, as opposed to the issue from @nazmibojan

Already thanks for any support and a huge thank you for the work!

@Jody1818
Copy link

@cord-otten
any luck with that issue? trying the same file for same remote and getting errors as well

@cord-otten
Copy link

Not yet. I tried some online converters without luck. I suspect the codes are not "standard" broadlink format.

@Jody1818
Copy link

I used the code and it does not add "ir_code_to_send":
should I do it menually? am I doing something wrong?
is it not a must?

@sneakysandals
Copy link

I got the script to run but have the same issue as @Jody1818 where none of the lines in the output have "ir_code_to_send"

Also all the output IR codes are wildly different from the original .json codes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment