Use Tradfri switch to send IR command

I’ve got a set of Ikea bulbs and plugs in my lounge which is controlled by an Ikea remote switch. I’ve also got another light that is controlled by a standard IR remote.

I have a broadlink RM pro, I’m wondering if it’s possible to use hassio in some way to trigger the broadlink to send an IR command to turn the light on when I press the Tradfri remote switch?

Yes, it is possible:

  • add Broadlink to HA if not already done;
  • use Developer tools-> Service to find service broadlink.learn and learn the IR remote code;
  • test that the code works with service broadlink.send;
  • write an automation (something similar to below for the service or save learned command as a switch; I don’t know how Tradfri will appear in HA, if it is a switch or a binary sensor/sensor):
- alias: turn_on_ir_light
  initial_state: 'on'
  trigger: 
    - platform: state
      entity_id: switch.tradfri
      to: 'on'
  action:
    - service: broadlink.send
      data:
        host: 192.168.1.100
        packet: 
          - "abcde"

Thanks, I’ll try that and let you know how I get on