I think there is a much easier way to get the codes. Documented here: https://www.home-assistant.io/components/switch.broadlink/#how-to-obtain-irrf-packets
"HOW TO OBTAIN IR/RF PACKETS?
Choose Call Service from the Developer Tools. Choose the service switch.broadlink_learn_command from the list of Available services: and hit CALL SERVICE. Press the button on your remote with in 20 seconds. The packet will be printed as a persistent notification in the States page of the web interface."
That worked fine for me for my LG air conditioning unit: Broadlink IR Climate Component