Broadlink IR code --> switch

Is it possible to create a “switch” from only a Broadlink IR code?
I want to make an automation such as:

  • Turn on a switch (IR code to set the heat pump to 18 degrees) when device tracker gets signal to group.device_tracker = away
  • Turns off the TV in the living room if group.device_tracker = away
    +++
    May also be easier for Google Home to understand … “Hey Goorle, turn on / off …”

The broadlink ir_codes are switches, are they not?

Unless I misunderstand the question. :thinking:

if I’m going to make an automation like this … how should switch.climate_18_low look like?

- alias: Set climate to 18-low if away
  trigger:
    - platform: state
      entity_id: group.family
      state: 'away'
  action:
    - service: homeassistant.turn_off
      entity_id: switch.climate_18_low

All I got to work with is a code like this:
JgC8AXI6DRANLA0QDQ8NEA0PDg8NEA0PDg8NEA0PDRANLA0QDQ8NEA0PDg8NEA0PDS0NLA0sDRANDw4sDQ8ODw0QDQ8NEA0PDg8NEA0PDRANDw4PDRANDw0QDQ8ODw0QDQ8NEA0PDg8NEA0PDRANEA0PDRANDw4PDSwNLA4PDRANDw4PDRANAAFVcjoNEA0sDRANDw0QDQ8ODw0QDQ8ODw0QDQ8NEA0sDRANDw0QDQ8ODw0QDQ8NLQ0sDSwNEA0PDiwNDw4PDRANDw0QDQ8ODw0QDQ8NEA0PDg8NEA0sDRANDw0sDg8NEA0PDg8NDw4PDSwODw0QDSwNEA0PDRANDw4PDRANDw0QDQ8OLA0sDSwODw0QDSwNLA4PDQ8ODw0sDRANLA0QDQ8ODw0QDQ8NEA0PDg8NEA0PDRANDw4PDSwOLA0sDRANDw0QDQ8ODw0QDQ8NEA0PDiwNLA0sDg8NEA0PDRANDw4PDRANDw0QDQ8ODw0QDQ8NEA0PDg8NLQ0PDRANDw0QDQ8ODw0sDg8NEA0PDRANDw4PDRANDw0QDQ8ODw0QDQ8NEA0PDg8NLA4sDSwNLA4sDQ8NLA4PDQANBQAAAAAAAAAAAAAAAA==

Your ir code goes in your broadlink config…

switch:
  - platform: broadlink
    host: 192.168.x.x
    mac: 'XX:XX:XX:XX:XX'
    switches:
      climate_18_low:
        friendly_name: "Climate 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LA0QDQ8ODw0QDQ8NEA0PDg8NEA0PDRANDw4PDSwOLA0sDRANDw0QDQ8ODw0QDQ8NEA0PDiwNLA0sDg8NEA0PDRANDw4PDRANDw0QDQ8ODw0QDQ8NEA0PDg8NLQ0PDRANDw0QDQ8ODw0sDg8NEA0PDRANDw4PDRANDw0QDQ8ODw0QDQ8NEA0PDg8NLA4sDSwNLA4sDQ8NLA4PDQANBQAAAAAAAAAAAAAAAA=='

Then the automation is exactly what you already have.

Broadlink doc…

1 Like

Thank you @anon43302295 !
Is it possible to send two codes?
if I want to see the Discovery channel then it is number 32 in the channel list. Is it possible to send code for 3 and 2 in one command?

Not in one command, but in two commands one after the other:

- service: homeassistant.turn_on
  entity_id: switch.tv_remote_3
- service: homeassistant.turn_on
  entity_id: switch.tv_remote_2
1 Like