How to send learned IR codes with an Z2M IR Blaster

Hi, I have an Zigbee IR Reciver/Blaster and plan to start and stop a beamer. I managed to learn an IR code, but it seams to be a different format then what I saw in my websearches.

B2EjnRFgAhwC4CUDAYgGgAPgAzcCiAYcIANABwNgAhwCgAPAC8AH4AMXwBNABwEJtMCHBBwCYAIc4AoBgBXgAwVAAQGIBkADQBVAAwEcAkAFAYgGQAMAYGAHBBwCYAIcIAELiAYcAhwCYAKIBmACQAeAAwEcAkAPBYgGHAIcAkAHAWAC4AGHAWAC4CMDQDtAA+ADM0APwAPAF0APQAvAB0ALQANADwuIBmACHAJgAogGYAI=

Now I have no clue on how send this IR command with an automation.

Edit:
With chatGPT I came the solution a bit closer, but still getting an error message.
Error: Message malformed: extra keys not allowed @ data['service']

import base64

ir_code = "B2EjnRFgAhwC4CUDAYgGgAPgAzcCiAYcIANABwNgAhwCgAPAC8AH4AMXwBNABwEJtMCHBBwCYAIc4AoBgBXgAwVAAQGIBkADQBVAAwEcAkAFAYgGQAMAYGAHBBwCYAIcIAELiAYcAhwCYAKIBmACQAeAAwEcAkAPBYgGHAIcAkAHAWAC4AGHAWAC4CMDQDtAA+ADM0APwAPAF0APQAvAB0ALQANADwuIBmACHAJgAogGYAI="

decoded_code = base64.b64decode(ir_code)

description: ""
mode: single
trigger: []
condition: []

service: switch.turn_on
data:
  entity_id: switch.ir_blaster_stube
  payload_on: '{"frequency": 38000, "data": [decoded_code]}'

alias: Test IR send

Any ideas on how to solve this? Thanks

Zigbee Model
TS1201

Zigbee Manufacturer
_TZ3290_7v1k4vufotpowp9z

IR Blaster Stube (switch.ir_blaster_stube)
MQTT discovery data:
Topic: homeassistant/switch/0x70ac08fffe180750/switch/config
Payload
availability:
  - topic: zigbee2mqtt/bridge/state
command_topic: zigbee2mqtt/IR Blaster Stube/set
device:
  identifiers:
    - zigbee2mqtt_0x70ac08fffe180750
  manufacturer: TuYa
  model: Universal smart IR remote control (ZS06)
  name: IR Blaster Stube
json_attributes_topic: zigbee2mqtt/IR Blaster Stube
name: IR Blaster Stube
payload_off: 'OFF'
payload_on: 'ON'
state_topic: zigbee2mqtt/IR Blaster Stube
unique_id: 0x70ac08fffe180750_switch_zigbee2mqtt
value_template: '{{ value_json.learn_ir_code }}'

Edit: I don’t know how bit the interest in this topic is, but after a long time I figured the syntax out:

service: mqtt.publish
data_template:
  topic: zigbee2mqtt/Device Name/set
  payload: >-
    {"ir_code_to_send":"BYAjfxErAuANAQJrAivgAAHgBQsCewYrIAMCawIroAEBewZAAwBr4AAHACugAQN7BisCgAHgARNAAUAXQANAAQV7BmsCALTAhwFrAoADQAFAC0AB4AMHQAvgAQNAO0ADwBNAC+ADA+ADF8AL4AMHwCsHKwJrAnsGawI="}

3 Likes

Did you ever solved this? Im trying to use codes from Global Cache

The way I do it is via a separate script for each code.
Service: MQTT: Publish
Topic: zigbee2mqtt/{Device friendly name}/set
Payload: {“ir_code_to_send”, “”}

That’s how I’m controlling my aircon.